197 lines
5.0 KiB
C++
197 lines
5.0 KiB
C++
|
|
#pragma once
|
|
|
|
#include "KObject.h"
|
|
#include "KPrimitiveMesh.h"
|
|
#include "KPrimitiveFXParticle.h"
|
|
#include "K3DBound.h"
|
|
#include "krenderobject.h"
|
|
|
|
class KViewportObject;
|
|
class K3DRenderDeviceDX;
|
|
|
|
/// "GETBONEINFO"
|
|
class KMsgGET_BONEINFO : public KArg
|
|
{
|
|
public:
|
|
KMsgGET_BONEINFO() : nBoneCount(0), dwMinTime(0), dwMaxTime(0) {}
|
|
|
|
int nBoneCount;
|
|
DWORD dwMinTime;
|
|
DWORD dwMaxTime;
|
|
};
|
|
|
|
/// "GETBONENAMELIST"
|
|
class KMsgGET_BONENAMELIST : public KArg
|
|
{
|
|
public:
|
|
KMsgGET_BONENAMELIST() {}
|
|
|
|
std::vector<const char*> vBoneNameList;
|
|
std::vector<K3DMatrix*> vBoneMatrixList;
|
|
};
|
|
|
|
/// "GETBONEMATRIX"
|
|
class KMsgGET_BONEMATRIX : public KArg
|
|
{
|
|
public:
|
|
KMsgGET_BONEMATRIX() : strBoneName(NULL), pBoneMat(NULL), nBoneMatIndex(-1) {}
|
|
|
|
const char * strBoneName; ///< 찾을 본 이름
|
|
K3DMatrix * pBoneMat; ///< 찾은 Matrix
|
|
int nBoneMatIndex; ///< 찾은 Matrix Index
|
|
};
|
|
|
|
/// "GETBONEMATRIX2"
|
|
class KMsgGET_BONEMATRIX2 : public KArg
|
|
{
|
|
public:
|
|
KMsgGET_BONEMATRIX2() : pBoneMat(NULL), nDetailIndex(0) {}
|
|
K3DMatrix * pBoneMat; ///< 찾은 Matrix
|
|
int nDetailIndex; ///< 찾을 Detail Matrix Index, 머리, 가슴, 허리, 왼손, 오른손 만 가능
|
|
};
|
|
|
|
/// "GETBONEMATRIX3"
|
|
class KMsgGET_BONEMATRIX3 : public KArg
|
|
{
|
|
public:
|
|
KMsgGET_BONEMATRIX3() : pBoneMat(NULL), nBoneIndex(-1) {}
|
|
K3DMatrix * pBoneMat; ///< 찾은 Matrix
|
|
int nBoneIndex; ///< 찾을 Bone Index
|
|
};
|
|
|
|
/** "SETBONEINIT"
|
|
"SETBONEBLEND" */
|
|
class KMsgGET_SETBONEBLEND : public KArg
|
|
{
|
|
public:
|
|
KMsgGET_SETBONEBLEND() : bUseBlend(true) {}
|
|
bool bUseBlend;
|
|
};
|
|
|
|
/** "SETCACHETM"
|
|
"GETCACHETM" */
|
|
class KMsgGET_GETCACHETM : public KArg
|
|
{
|
|
public:
|
|
KMsgGET_GETCACHETM() : bUseBlend(false), pCacheAniData(NULL), nCount(0) {}
|
|
bool bUseBlend;
|
|
BONE_ANI_DATA* pCacheAniData;
|
|
int nCount; ///< TM 수
|
|
};
|
|
|
|
/// "GETVERSION"
|
|
class KMsgGET_GETVERSION : public KArg
|
|
{
|
|
public:
|
|
KMsgGET_GETVERSION() : dwVersion( ( DWORD ) -1 ) {}
|
|
DWORD dwVersion;
|
|
};
|
|
|
|
|
|
|
|
class K3DBone;
|
|
/// Bone 추가
|
|
class KBoneSeqObject : public KSeqObject
|
|
{
|
|
public:
|
|
KBoneSeqObject();
|
|
~KBoneSeqObject();
|
|
|
|
virtual void Reset();
|
|
void SetRes( K3DBoneResource *bone );
|
|
void SetRes10( K3DBoneResource *bone );
|
|
void SetRes11( K3DBoneResource *bone );
|
|
virtual void Render( KViewportObject *viewport, DWORD flag = RENDEREFX_NONE, const K3DMatrix * pAttachMat = NULL );
|
|
virtual KSeqObject* Clone();
|
|
virtual void realizeTime();
|
|
|
|
virtual void SetDeform( KSeqObject * pMeshSeq );
|
|
virtual void SetAttach( int nAttachIndex, KSeqObject * pMeshSeq );
|
|
virtual void SetAttachEffectPos( int nEffectPosIndex, KSeqObject * pMeshSeq );
|
|
virtual void SetAttachEffectBone( int nBoneIndex, KSeqObject * pMeshSeq );
|
|
virtual void *Perform( KID id, KArg& msg );
|
|
|
|
const char * GetResourceName();
|
|
|
|
/// Bone의 숫자 == bone matrix의 숫자
|
|
int GetBoneCount();
|
|
|
|
/// 머리, 가슴, 허리, 왼손, 오른손 얻는거~
|
|
K3DMatrix * GetBoneMatrix( int nDetail );
|
|
|
|
|
|
inline K3DMatrix * GetBoneCacheTM() { return m_pBoneCacheTM; }
|
|
DWORD GetPreviouseBoneCacheTime() const { return m_dwPrevBoneCacheTime; }
|
|
|
|
/// resource의 bone name으로부터 직접 억세스
|
|
K3DMatrix * const GetBoneMatrixByName(char *boneName);
|
|
|
|
K3DMatrix * GetBoneBaseTM();
|
|
|
|
inline K3DBone * GetBone( char * pBoneName, int &index )
|
|
{
|
|
if( m_spResBone )
|
|
return m_spResBone->GetBone( pBoneName, index );
|
|
else
|
|
return NULL;
|
|
}
|
|
|
|
/// Game 지원~
|
|
float GetHeadZ();
|
|
void GetHandLeft( K3DVector & pos );
|
|
void GetHandRight( K3DVector & pos );
|
|
|
|
/// 좌우
|
|
void SetViewVectorX( float x, float y, float z );
|
|
/// 상하
|
|
void SetViewVectorZ( float x, float y, float z );
|
|
/// 몸통
|
|
void SetBodyVector( float x, float y ) ;
|
|
|
|
static void SetRenderBone( bool bIsRender ) { m_bIsBoneDraw = bIsRender; }
|
|
static void SetRenderAxis( bool bIsRender ) { m_bIsAxisDraw = bIsRender; }
|
|
|
|
static void ToggleRenderBone() { m_bIsBoneDraw = !m_bIsBoneDraw; }
|
|
static void ToggleRenderAxis() { m_bIsAxisDraw = !m_bIsAxisDraw; }
|
|
|
|
protected:
|
|
static bool m_bIsBoneDraw;
|
|
static bool m_bIsAxisDraw;
|
|
|
|
|
|
K3DMatrix m_matLocal;
|
|
K3DMatrix m_matResult;
|
|
K3DBoneResourceSPtr m_spResBone;
|
|
KWireUtilPrimitive m_prWire;
|
|
KWireUtilPrimitive m_prAxisWire;
|
|
|
|
K3DVector m_ViewVectorX; ///< 좌우
|
|
K3DVector m_ViewVectorZ; ///< 상하
|
|
K3DVector m_BodyVector ; ///< 몸통
|
|
|
|
int m_nBoneCnt;
|
|
K3DMatrix * m_pBoneCacheTM;
|
|
|
|
BONE_ANI_DATA* m_pBoneCacheAniData;
|
|
BONE_ANI_DATA* m_pPrevBoneCacheAniData;
|
|
|
|
DWORD m_dwPrevBoneCacheTime; ///< m_pPrevBoneCacheTM이 realize된 시간
|
|
// Note : m_pBoneCacheTM이 realize된 시간은 m_dwRealizedTime
|
|
|
|
bool m_bValidPrevBoneCache;
|
|
|
|
//캐쉬 때문에 만들어 놓은건데... 더 좋은 방법은 없나? 서치 없고 바로 나오는거...
|
|
K3DMatrix * m_pMatHead;
|
|
K3DMatrix * m_pMatNeck;
|
|
K3DMatrix * m_pMatBody1;
|
|
K3DMatrix * m_pMatBody2;
|
|
K3DMatrix * m_pMatPelvis;
|
|
K3DMatrix * m_pMatLeftHand;
|
|
K3DMatrix * m_pMatRightHand;
|
|
K3DMatrix * m_pMatLeftFoot;
|
|
K3DMatrix * m_pMatRightFoot;
|
|
K3DMatrix * m_pMatLeftFist;
|
|
K3DMatrix * m_pMatRightFist;
|
|
};
|