Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
95 lines
2.1 KiB
C++
95 lines
2.1 KiB
C++
// Z3DEditorGeneralChrModel.cpp: implementation of the CZ3DEditorGeneralChrModel class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
#include "worldcreator.h"
|
|
#include "Z3DEditorGeneralChrModel.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CZ3DGeneralChrModelSkeleton::CZ3DGeneralChrModelSkeleton()
|
|
{
|
|
m_pVertices = NULL;
|
|
m_lVertexCount = 0;
|
|
|
|
m_pIndices = NULL;
|
|
m_lIndexCount = 0;
|
|
|
|
m_rpSkeleton = NULL;
|
|
|
|
m_pTexture = NULL;
|
|
}
|
|
|
|
CZ3DGeneralChrModelSkeleton::~CZ3DGeneralChrModelSkeleton()
|
|
{
|
|
SAFE_DELETEA( m_pIndices );
|
|
SAFE_DELETEA( m_pVertices );
|
|
}
|
|
|
|
bool CZ3DGeneralChrModelSkeleton::Create( CZ3DGCMDS* pGCMDS, CZ3DSkeletonObject* pSkeleton )
|
|
{
|
|
m_lVertexCount = pGCMDS->GetSkeletonCount();
|
|
m_pVertices = new D3DVERTEX[m_lVertexCount];
|
|
|
|
m_lIndexCount = (m_lVertexCount-1)*2;
|
|
m_pIndices = new WORD[m_lIndexCount];
|
|
|
|
const long* pHierarchy = pGCMDS->GetSkeletonHierarchy();
|
|
|
|
for( int i = 0; i < pGCMDS->GetSkeletonCount()-1; ++i )
|
|
{
|
|
m_pIndices[i*2] = pHierarchy[i+1];
|
|
m_pIndices[i*2+1] = i+1;
|
|
}
|
|
|
|
m_rpSkeleton = pSkeleton;
|
|
|
|
return true;
|
|
}
|
|
|
|
void CZ3DGeneralChrModelSkeleton::Render()
|
|
{
|
|
for( int i = 0; i < m_lVertexCount; ++i )
|
|
{
|
|
m_pVertices[i].x = m_rpSkeleton[i].GetTM()->_41;
|
|
m_pVertices[i].y = m_rpSkeleton[i].GetTM()->_42;
|
|
m_pVertices[i].z = m_rpSkeleton[i].GetTM()->_43;
|
|
}
|
|
|
|
GetDevice()->SetVertexShader( D3DFVF_VERTEX );
|
|
GetDevice()->DrawIndexedPrimitiveUP( D3DPT_LINELIST, 0, m_lVertexCount,
|
|
m_lIndexCount/2, m_pIndices, D3DFMT_INDEX16, m_pVertices, sizeof(D3DVERTEX) );
|
|
}
|
|
|
|
|
|
CZ3DEditorGeneralChrModel::CZ3DEditorGeneralChrModel()
|
|
{
|
|
|
|
}
|
|
|
|
CZ3DEditorGeneralChrModel::~CZ3DEditorGeneralChrModel()
|
|
{
|
|
|
|
}
|
|
|
|
bool CZ3DEditorGeneralChrModel::Init( const char* szGCMDSname )
|
|
{
|
|
if( false == CZ3DGeneralChrModel::Init( szGCMDSname ) )
|
|
{
|
|
return false;
|
|
}
|
|
|
|
m_SkelRender.Create( m_rpGCMDS, m_pSkeletonObjects );
|
|
m_pSkin->SetIndividualRender( false );
|
|
|
|
return false;
|
|
} |