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>
235 lines
5.8 KiB
C++
235 lines
5.8 KiB
C++
// Z3DMultipartPortion.h: interface for the Z3DMultipartPortion class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#if !defined(AFX_Z3DMULTIPARTPORTION_H__1B9AE6C4_16F6_11D5_A643_0000E8EB4C69__INCLUDED_)
|
|
#define AFX_Z3DMULTIPARTPORTION_H__1B9AE6C4_16F6_11D5_A643_0000E8EB4C69__INCLUDED_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
#include "misc.h"
|
|
|
|
#include "Z3DCharacterModel.h"
|
|
#include "Z3DTexture.h"
|
|
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
|
|
|
|
#define Z3D_MPID_FACE 10
|
|
#define Z3D_MPID_HAIR 11
|
|
#define Z3D_MPID_EAR 12
|
|
#define Z3D_MPID_SHOULDER 20
|
|
#define Z3D_MPID_CHEST 21
|
|
#define Z3D_MPID_ARM 23
|
|
#define Z3D_MPID_WAIST 24
|
|
#define Z3D_MPID_HAND 30
|
|
#define Z3D_MPID_LEG 40
|
|
#define Z3D_MPID_FOOT 50
|
|
|
|
#define Z3D_PORTION_BUFFER_BANK_SIZE 500 // 버텍스 버퍼 크기는 500단위로 설정됨
|
|
|
|
enum Z3D_MULTIPART_PORTION_TYPE {
|
|
Z3D_MPT_TEXPIECE = 0,
|
|
Z3D_MPT_TEXTURE
|
|
};
|
|
|
|
|
|
struct Z3DVBCacheNode
|
|
{
|
|
long lVertexCount;
|
|
IDirect3DVertexBuffer8* pVB;
|
|
|
|
Z3DVBCacheNode* pNext;
|
|
};
|
|
|
|
struct Z3DIBCacheNode
|
|
{
|
|
long lIndexCount;
|
|
IDirect3DIndexBuffer8* pIB;
|
|
|
|
Z3DIBCacheNode* pNext;
|
|
};
|
|
|
|
|
|
struct STVectorStorage
|
|
{
|
|
vector3 s;
|
|
vector3 t;
|
|
};
|
|
|
|
|
|
|
|
struct Z3DMultipartPortion
|
|
{
|
|
public:
|
|
Z3DMultipartPortion( Z3D_MULTIPART_PORTION_TYPE mpt = Z3D_MPT_TEXPIECE )
|
|
{
|
|
m_lVertexBufferVertexCount = 0;
|
|
|
|
m_pVertexBuffer = NULL;
|
|
m_lVertexCount = 0;
|
|
|
|
for( int i = 0; i < Z3D_LOD_LEVEL; ++i )
|
|
{
|
|
m_alIndexBufferIndexCount[i] = 0;
|
|
|
|
m_apIndexBuffer[i] = NULL;
|
|
m_alIndexCount[i] = NULL;
|
|
}
|
|
|
|
if( Z3D_MPT_TEXPIECE == mpt )
|
|
{
|
|
m_pTexture = new Z3DTexture;
|
|
m_pTexture2 = new Z3DTexture;
|
|
}
|
|
else
|
|
{
|
|
m_pTexture = NULL;
|
|
m_pTexture2 = NULL;
|
|
}
|
|
m_MPT = mpt;
|
|
|
|
m_vec_pMesh.clear();
|
|
|
|
m_pSTVertexBuffer = NULL;
|
|
m_bSTVertexMode = false;
|
|
|
|
m_pSTVectors = NULL;
|
|
}
|
|
|
|
~Z3DMultipartPortion()
|
|
{
|
|
int i;
|
|
|
|
SAFE_RELEASE( m_pSTVertexBuffer );
|
|
// for( i = 0; i < m_vecpSTVectors.size(); ++i )
|
|
// {
|
|
// SAFE_DELETEA( m_vecpSTVectors[i] );
|
|
// }
|
|
SAFE_DELETEA( m_pSTVectors );
|
|
|
|
for( i = 0; i < Z3D_LOD_LEVEL; ++i )
|
|
{
|
|
SAFE_RELEASE( m_apIndexBuffer[i] );
|
|
}
|
|
|
|
SAFE_RELEASE( m_pVertexBuffer );
|
|
|
|
m_vec_pMesh.clear();
|
|
|
|
std::map<int, H3DMeshTag>::iterator it_m;
|
|
for( it_m = m_map_IdMeshTag.begin(); it_m != m_map_IdMeshTag.end(); it_m++ )
|
|
{
|
|
it_m->second.Release();
|
|
}
|
|
|
|
std::map<int, H3DTexPieceTag>::iterator it_t;
|
|
for( it_t = m_map_IdTexPieceTag.begin(); it_t != m_map_IdTexPieceTag.end(); it_t++ )
|
|
{
|
|
it_t->second.Release();
|
|
}
|
|
for( it_t = m_map_IdTexPieceTag2.begin(); it_t != m_map_IdTexPieceTag2.end(); it_t++ )
|
|
{
|
|
it_t->second.Release();
|
|
}
|
|
SAFE_DELETE( m_pTexture );
|
|
SAFE_DELETE( m_pTexture2 );
|
|
|
|
|
|
std::map<int, H3DTextureTag>::iterator it;
|
|
for( it = m_map_IdTextureTag.begin(); it != m_map_IdTextureTag.end(); it++ )
|
|
{
|
|
it->second.Release();
|
|
}
|
|
for( it = m_map_IdTextureTag2.begin(); it != m_map_IdTextureTag2.end(); it++ )
|
|
{
|
|
it->second.Release();
|
|
}
|
|
for( it = m_map_IdSpecTextureTag.begin(); it != m_map_IdSpecTextureTag.end(); it++ )
|
|
{
|
|
it->second.Release();
|
|
}
|
|
}
|
|
|
|
void BuildSTVertex( IDirect3DDevice8* pDevice );
|
|
|
|
void BuildMesh( IDirect3DDevice8* pDevice );
|
|
|
|
bool SetMesh( const int nPartId, H3DMeshTag tagMesh );
|
|
bool DeleteMesh( const int nPartId );
|
|
|
|
bool SetTexPiece( const int nPartId, H3DTexPieceTag tagTexpiece );
|
|
bool SetTexPiece2( const int nPartId, H3DTexPieceTag tagTexpiece );
|
|
bool DeleteTexPiece( const int nPartId );
|
|
|
|
bool BatchOpen();
|
|
bool BatchClose( IDirect3DDevice8* pDevice );
|
|
|
|
bool SetTexture( const int nPartId, H3DTextureTag tagTexture );
|
|
bool SetTexture2( const int nPartId, H3DTextureTag tagTexture );
|
|
bool SetSpecTexture( const int nPartId, H3DTextureTag tagTexture );
|
|
bool DeleteTexture( const int nPartId );
|
|
bool DeleteTexture2( const int nPartId );
|
|
bool DeleteSpecTexture( const int nPartId );
|
|
|
|
static IDirect3DVertexBuffer8* _GetVertexBufferInterface( IDirect3DDevice8* pDevice, long& rlVertexCount );
|
|
static void _ReleaseVertexBufferInterface( IDirect3DVertexBuffer8* pVB );
|
|
|
|
static IDirect3DIndexBuffer8* _GetIndexBufferInterface( long lLODIndex, IDirect3DDevice8* pDevice, long rlIndexCount );
|
|
static void _ReleaseIndexBufferInterface( long lLODIndex, IDirect3DIndexBuffer8* pIB );
|
|
static void _Close();
|
|
|
|
public:
|
|
//std::vector<STVectorStorage*> m_vecpSTVectors;
|
|
STVectorStorage* m_pSTVectors;
|
|
|
|
IDirect3DVertexBuffer8* m_pSTVertexBuffer;
|
|
bool m_bSTVertexMode;
|
|
|
|
long m_lVertexBufferVertexCount;
|
|
long m_alIndexBufferIndexCount[Z3D_LOD_LEVEL];
|
|
|
|
std::vector<Z3DLODMesh*> m_vec_pMesh;
|
|
|
|
std::map<int, H3DMeshTag> m_map_IdMeshTag;
|
|
IDirect3DVertexBuffer8* m_pVertexBuffer;
|
|
long m_lVertexCount;
|
|
|
|
IDirect3DIndexBuffer8* m_apIndexBuffer[Z3D_LOD_LEVEL];
|
|
long m_alIndexCount[Z3D_LOD_LEVEL];
|
|
|
|
std::map<int, H3DTexPieceTag> m_map_IdTexPieceTag;
|
|
std::map<int, H3DTexPieceTag> m_map_IdTexPieceTag2;
|
|
Z3DTexture* m_pTexture;
|
|
Z3DTexture* m_pTexture2;
|
|
|
|
std::map<int, H3DTextureTag> m_map_IdTextureTag;
|
|
std::map<int, H3DTextureTag> m_map_IdTextureTag2;
|
|
std::map<int, H3DTextureTag> m_map_IdSpecTextureTag;
|
|
std::vector<Z3DTexture*> m_vec_pTexture;
|
|
std::vector<Z3DTexture*> m_vec_pTexture2;
|
|
std::vector<Z3DTexture*> m_vec_pSpecTexture;
|
|
|
|
Z3D_MULTIPART_PORTION_TYPE m_MPT;
|
|
|
|
|
|
// vertex buffer 캐시 리스트. SLL 이며 추가는 header, 삭제(오버플로시)는 tail 에서 일어남
|
|
// 검색은 header부터 순차적으로. strategy 는 first match
|
|
static const long ms_lMaxVBCacheCount;
|
|
static long ms_lVBCacheCount;
|
|
static Z3DVBCacheNode* ms_pVBCacheChainHeader;
|
|
|
|
// index buffer 캐시 리스트. SLL 이며 추가는 header, 삭제(오버플로시)는 tail 에서 일어남
|
|
// 검색은 header부터 순차적으로. strategy 는 first match
|
|
// LOD 레벨별로 따로 관리함. (배열 인덱스가 해당 LOD level의 데이터)
|
|
static const long ms_alMaxIBCacheCount[Z3D_LOD_LEVEL];
|
|
static long ms_alIBCacheCount[Z3D_LOD_LEVEL];
|
|
static Z3DIBCacheNode* ms_apIBCacheChainHeader[Z3D_LOD_LEVEL];
|
|
};
|
|
|
|
#endif // !defined(AFX_Z3DMULTIPARTPORTION_H__1B9AE6C4_16F6_11D5_A643_0000E8EB4C69__INCLUDED_)
|