Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray3D::cModelX Class Reference

#include <cModelX.h>

Inheritance diagram for Gray3D::cModelX:
Gray3D::cXResourceFile Gray::cRefBase IUnknown Gray3D::cModelXLoader

Public Member Functions

 cModelX (const FILECHAR_t *pszFileName)
 
virtual ~cModelX ()
 
virtual HRESULT LoadMeshHierarchy (const FILECHAR_t *pstrMeshXFilePath, IDirect3DDevice9 *pd3dDevice)
 
virtual HRESULT DeleteDeviceObjects ()
 
HRESULT FrameMove (float fElapsedTime)
 
cModelXFrameget_FrameRoot () const
 
ModelX_FrameMask_t get_TotalFlags () const
 
void UpdateXHeader ()
 
const cBounds3f & get_BBox ()
 
const cSpherefget_BSphere ()
 
int ComputeBoundingBox (cBounds3f &bres)
 
int ComputeBoundingSphere (cSpheref &bsphere)
 
cModelXFrameFindFrame (const ATOMCHAR_t *pszFrameName) const
 
void DestroyFrameX (cModelXFrame *pFrame)
 
STDMETHOD() CreateFrame (const char *pszName, _D3DXFRAME **ppNewFrame)
 ID3DXAllocateHierarchy. More...
 
STDMETHOD() CreateMeshContainer (const char *pszName, const _D3DXMESHDATA *pMeshData, const _D3DXMATERIAL *pMaterials, const _D3DXEFFECTINSTANCE *pEffectInstances, DWORD NumMaterials, const DWORD *pAdjacency, ID3DXSkinInfo *, _D3DXMESHCONTAINER **ppNewMeshCont)
 
STDMETHOD() DestroyFrame (_D3DXFRAME *pFrameToFree)
 
STDMETHOD() DestroyMeshContainer (_D3DXMESHCONTAINER *pMeshContBase)
 
STDMETHOD() LoadTopLevelData (ID3DXFileData *pData)
 ID3DXLoadUserData. More...
 
STDMETHOD() LoadFrameChildData (_D3DXFRAME *pF, ID3DXFileData *pData)
 
STDMETHOD() LoadMeshChildData (_D3DXMESHCONTAINER *pMC, ID3DXFileData *pData)
 
 UNITTEST_FRIEND (cModelX)
 
- Public Member Functions inherited from Gray3D::cXResourceFile
 cXResourceFile (const FILECHAR_t *pszFileName)
 
virtual ~cXResourceFile ()
 
cStringF get_FilePath () const
 
void put_FilePath (const FILECHAR_t *pszFileName)
 
 STDMETHOD_ (cString, get_Name)() const
 
cStringF get_FullPath () const
 
cStringF MakePeerPath (const FILECHAR_t *pszName) const
 
virtual bool isResourceLoaded () const noexcept
 
void put_LoadedState (HRESULT hResLoad)
 
virtual HRESULT LoadResource ()
 
- Public Member Functions inherited from Gray::cRefBase
 cRefBase (int iRefCount=0) noexcept
 
virtual ~cRefBase ()
 
int get_RefCount () const noexcept
 
HASHCODE_t get_HashCode () const noexcept
 
 STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept
 
virtual void onFinalRelease ()
 
bool isValidObj () const noexcept
 
 STDMETHOD_ (ULONG, AddRef)(void) override
 
 STDMETHOD_ (ULONG, Release)(void) override
 
STDMETHOD() QueryInterface (const IID &riid, void __RPC_FAR *__RPC_FAR *ppvObject) override
 
void IncRefCount ()
 
void DecRefCount ()
 
bool isStaticConstruct () const noexcept
 
void StaticConstruct ()
 
void StaticDestruct ()
 
bool isDestructing () noexcept
 
void SetDestructing ()
 

Public Attributes

cModelXHeader m_ModelXHeader
 
cModelXFramem_pFrameRoot
 created by CreateFrame() (a list) More...
 

Static Public Attributes

static const char * k_szFrameNames [ModelX_FrameName_QTY+1]
 

Protected Attributes

bool m_bXHeaderValid
 m_ModelXHeader is valid ? read or computed. More...
 
ModelX_FrameMask_t m_uTotalFlags
 m_uFrameFlags | m_uChildrenFlags for all frames More...
 
- Protected Attributes inherited from Gray3D::cXResourceFile
HRESULT m_hResLoad
 0=loaded OK, <0 = it failed to load for some reason! OLE_E_BLANK = have not yet tried to load. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Gray3D::cXResourceFile
static HRESULT GRAYCALL OnFAIL (HRESULT hRes)
 static. so we can trap all errors here. More...
 
- Static Protected Attributes inherited from Gray3D::cXResourceFile
static cStringF s_sFileLoading
 name of file loading for debug. More...
 

Detailed Description

Define a possibly complex hierarchy of Mesh/Model parts. i.e. collections of meshes to make up a single model.

Note
This is NOT an (animated,morphed) instance of a model. just a definition of it.
  1. May have a list of animations attached.
  2. frames may be named to allow attachment points to the model.

Constructor & Destructor Documentation

◆ cModelX()

Gray3D::cModelX::cModelX ( const FILECHAR_t pszFileName)

◆ ~cModelX()

Gray3D::cModelX::~cModelX ( )
virtual

Member Function Documentation

◆ ComputeBoundingBox()

int Gray3D::cModelX::ComputeBoundingBox ( cBounds3f &  bres)

we also use this function to know how many vertex are in here

Returns
total vertices

◆ ComputeBoundingSphere()

int Gray3D::cModelX::ComputeBoundingSphere ( cSpheref bsphere)

cSphereWork we also use this function to know how many vertex are in here

Returns
total vertices

◆ CreateFrame()

HRESULT Gray3D::cModelX::CreateFrame ( const char *  pszName,
_D3DXFRAME **  ppNewFrame 
)

ID3DXAllocateHierarchy.

◆ CreateMeshContainer()

HRESULT Gray3D::cModelX::CreateMeshContainer ( const char *  pszName,
const _D3DXMESHDATA pMeshData,
const _D3DXMATERIAL pMaterials,
const _D3DXEFFECTINSTANCE pEffectInstances,
DWORD  NumMaterials,
const DWORD *  pAdjacency,
ID3DXSkinInfo *  ,
_D3DXMESHCONTAINER **  ppNewMeshCont 
)

◆ DeleteDeviceObjects()

HRESULT Gray3D::cModelX::DeleteDeviceObjects ( )
virtual

◆ DestroyFrame()

HRESULT Gray3D::cModelX::DestroyFrame ( _D3DXFRAME pFrameToFree)

◆ DestroyFrameX()

void Gray3D::cModelX::DestroyFrameX ( cModelXFrame pFrame)

traverse and destroy children.

◆ DestroyMeshContainer()

HRESULT Gray3D::cModelX::DestroyMeshContainer ( _D3DXMESHCONTAINER pMeshContBase)

◆ FindFrame()

cModelXFrame * Gray3D::cModelX::FindFrame ( const ATOMCHAR_t pszFrameName) const

◆ FrameMove()

HRESULT Gray3D::cModelX::FrameMove ( float  fElapsedTime)

Called once per frame per instance, the call is the entry point for animating the scene. Shared for multi instances!! so will have to be called for each instance at render time.

Note
m_pAnimController is only created if the model can animate.

◆ get_BBox()

const cBounds3f& Gray3D::cModelX::get_BBox ( )
inline

◆ get_BSphere()

const cSpheref& Gray3D::cModelX::get_BSphere ( )
inline

◆ get_FrameRoot()

cModelXFrame* Gray3D::cModelX::get_FrameRoot ( ) const
inline
Note
the root can have siblings.

◆ get_TotalFlags()

ModelX_FrameMask_t Gray3D::cModelX::get_TotalFlags ( ) const
inline

◆ LoadFrameChildData()

STDMETHOD() Gray3D::cModelX::LoadFrameChildData ( _D3DXFRAME pF,
ID3DXFileData *  pData 
)
inline

◆ LoadMeshChildData()

STDMETHOD() Gray3D::cModelX::LoadMeshChildData ( _D3DXMESHCONTAINER pMC,
ID3DXFileData *  pData 
)
inline

◆ LoadMeshHierarchy()

HRESULT Gray3D::cModelX::LoadMeshHierarchy ( const FILECHAR_t pstrMeshXFilePath,
IDirect3DDevice9 *  pd3dDevice 
)
virtual

This creates all device-dependent managed objects, such as managed textures and managed vertex buffers. Called from InitDeviceObjects() MAKE_D3DHRESULT(905) = 0x88760389 = file not found.

◆ LoadTopLevelData()

HRESULT Gray3D::cModelX::LoadTopLevelData ( ID3DXFileData *  pData)

ID3DXLoadUserData.

◆ UNITTEST_FRIEND()

Gray3D::cModelX::UNITTEST_FRIEND ( cModelX  )

◆ UpdateXHeader()

void Gray3D::cModelX::UpdateXHeader ( )
inline

Member Data Documentation

◆ k_szFrameNames

const char * Gray3D::cModelX::k_szFrameNames
static
Initial value:
=
{
#define cModelXFrameName(a,b,c)
nullptr,
}

◆ m_bXHeaderValid

bool Gray3D::cModelX::m_bXHeaderValid
protected

m_ModelXHeader is valid ? read or computed.

◆ m_ModelXHeader

cModelXHeader Gray3D::cModelX::m_ModelXHeader

for new (compiled) formats

◆ m_pFrameRoot

cModelXFrame* Gray3D::cModelX::m_pFrameRoot

created by CreateFrame() (a list)

Note
Remember the m_pFrameRoot can have siblings!! thats weird but we should support it.

◆ m_uTotalFlags

ModelX_FrameMask_t Gray3D::cModelX::m_uTotalFlags
protected

m_uFrameFlags | m_uChildrenFlags for all frames


The documentation for this class was generated from the following files: