AllocateHierarchy.h
资源名称:Direct3D.rar [点击查看]
上传用户:junlon
上传日期:2022-01-05
资源大小:39075k
文件大小:3k
源码类别:
DirextX编程
开发平台:
Visual C++
- //--------------------------------------------------------------------------------------
- // 头文件: AllocateHierarchy.h , 作者:曾凡喜
- //
- // 该头文件实现了D3DXFRAME_DERIVED结构体,D3DXMESHCONTAINER_DERIVED结构体,CAllocateHierarchy类
- //
- // 分别派生自D3DXFRAME结构体,D3DXMESHCONTAINER结构体,ID3DXAllocateHierarchy虚基类
- //
- // 版权归作者所有,未经允许不得利用源代码进行任何商业活动
- //
- // 完成时间:2008-05-03
- //--------------------------------------------------------------------------------------
- #ifndef __AllocateHierarchy_H__
- #define __AllocateHierarchy_H__
- #include "zfxd3dUtility.h"
- //-----------------------------------------------------------------------------
- // 继承自DXDXFRAME结构的结构
- //-----------------------------------------------------------------------------
- struct D3DXFRAME_DERIVED: public D3DXFRAME
- {
- D3DXMATRIXA16 CombinedTransformationMatrix;//组合变换矩阵
- };
- //-----------------------------------------------------------------------------
- // 继承自D3DXMESHCONTAINER结构的结构
- //-----------------------------------------------------------------------------
- struct D3DXMESHCONTAINER_DERIVED: public D3DXMESHCONTAINER
- {
- LPDIRECT3DTEXTURE9* ppTextures; //纹理数组
- LPD3DXMESH pOrigMesh; //原始网格
- DWORD NumInfl; //每个顶点最多受多少骨骼的影响
- DWORD NumAttributeGroups; //属性组数量,即子网格数量
- LPD3DXBUFFER pBoneCombinationBuf; //骨骼结合表
- D3DXMATRIX** ppBoneMatrixPtrs; //存放骨骼的组合变换矩阵
- D3DXMATRIX* pBoneOffsetMatrices; //存放骨骼的初始变换矩阵
- DWORD NumPaletteEntries; //骨骼数量上限
- bool UseSoftwareVP; //标识是否使用软件顶点处理
- };
- //-----------------------------------------------------------------------------
- // 该类用来从.X文件加载框架层次和网格模型数据,继承自ID3DXAllocateHierarchy接口。
- // 该类的CreateFrame()和CreateMeshContainer()函数在D3DXLoadMeshHierarchyFromX()函数执行时
- // 由框架自动执行,无需显式调用。
- // 同理,DestroyFrame()和DestroyMeshContainer()在D3DXFrameDestroy函数执行时由框架自动执行,
- // 无需显式调用。
- //-----------------------------------------------------------------------------
- class CAllocateHierarchy: public ID3DXAllocateHierarchy
- {
- private:
- HRESULT GenerateSkinnedMesh(D3DXMESHCONTAINER_DERIVED *pMeshContainer, LPDIRECT3DDEVICE9 pd3dDevice);
- // 拷贝字符串
- HRESULT AllocateName( LPCSTR Name, LPSTR *pNewName );
- public:
- STDMETHOD(CreateFrame)(THIS_ LPCSTR Name, LPD3DXFRAME *ppNewFrame);
- STDMETHOD(CreateMeshContainer)( THIS_ LPCSTR Name,
- CONST D3DXMESHDATA* pMeshData,
- CONST D3DXMATERIAL* pMaterials,
- CONST D3DXEFFECTINSTANCE* pEffectInstances,
- DWORD NumMaterials,
- CONST DWORD * pAdjacency,
- LPD3DXSKININFO pSkinInfo,
- LPD3DXMESHCONTAINER *ppNewMeshContainer);
- STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree);
- STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER pMeshContainerBase);
- };
- #endif //__AllocateHierarchy_H__