Pyrogenesis  trunk
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
CModelDef Class Reference

#include <ModelDef.h>

Collaboration diagram for CModelDef:
Collaboration graph
[legend]

Public Types

enum  { FILE_VERSION = 3 }
 
enum  { FILE_READ_VERSION = 1 }
 

Public Member Functions

 CModelDef ()
 
 ~CModelDef ()
 
size_t GetNumVertices () const
 
SModelVertexGetVertices () const
 
size_t GetNumUVsPerVertex () const
 
size_t GetNumFaces () const
 
SModelFaceGetFaces () const
 
size_t GetNumBones () const
 
CBoneStateGetBones () const
 
CMatrix3DGetInverseBindBoneMatrices ()
 
size_t GetNumBlends () const
 
SVertexBlendGetBlends () const
 
size_t * GetBlendIndices () const
 
const SPropPointFindPropPoint (const char *name) const
 
void BlendBoneMatrices (CMatrix3D boneMatrices[])
 Blend bone matrices together to fill bone palette. More...
 
void SetRenderData (const void *key, CModelDefRPrivate *data)
 Register renderer private data. More...
 
CModelDefRPrivateGetRenderData (const void *key) const
 
const VfsPathGetName () const
 

Static Public Member Functions

static void Save (const VfsPath &filename, const CModelDef *mdef)
 
static CModelDefLoad (const VfsPath &filename, const VfsPath &name)
 Loads a PMD file. More...
 
static CVector3D SkinPoint (const SModelVertex &vtx, const CMatrix3D newPoseMatrices[])
 Transform the given vertex's position from the bind pose into the new pose. More...
 
static CVector3D SkinNormal (const SModelVertex &vtx, const CMatrix3D newPoseMatrices[])
 Transform the given vertex's normal from the bind pose into the new pose. More...
 
static void SkinPointsAndNormals (size_t numVertices, const VertexArrayIterator< CVector3D > &Position, const VertexArrayIterator< CVector3D > &Normal, const SModelVertex *vertices, const size_t *blendIndices, const CMatrix3D newPoseMatrices[])
 Transform vertices' positions and normals. More...
 

Public Attributes

size_t m_NumVertices
 
SModelVertexm_pVertices
 
size_t m_NumUVsPerVertex
 
size_t m_NumFaces
 
SModelFacem_pFaces
 
size_t m_NumBones
 
CBoneStatem_Bones
 
CMatrix3Dm_InverseBindBoneMatrices
 
size_t m_NumBlends
 
SVertexBlendm_pBlends
 
size_t * m_pBlendIndices
 
std::vector< SPropPointm_PropPoints
 

Private Types

typedef std::map< const void *, CModelDefRPrivate * > RenderDataMap
 

Private Member Functions

 NONCOPYABLE (CModelDef)
 

Private Attributes

VfsPath m_Name
 
RenderDataMap m_RenderData
 

Member Typedef Documentation

typedef std::map<const void*, CModelDefRPrivate*> CModelDef::RenderDataMap
private

Member Enumeration Documentation

anonymous enum
Enumerator
FILE_VERSION 
anonymous enum
Enumerator
FILE_READ_VERSION 

Constructor & Destructor Documentation

CModelDef::CModelDef ( )
CModelDef::~CModelDef ( )

Member Function Documentation

void CModelDef::BlendBoneMatrices ( CMatrix3D  boneMatrices[])

Blend bone matrices together to fill bone palette.

const SPropPoint * CModelDef::FindPropPoint ( const char *  name) const
size_t* CModelDef::GetBlendIndices ( ) const
inline
SVertexBlend* CModelDef::GetBlends ( ) const
inline
CBoneState* CModelDef::GetBones ( ) const
inline
SModelFace* CModelDef::GetFaces ( ) const
inline
CMatrix3D* CModelDef::GetInverseBindBoneMatrices ( )
inline
const VfsPath& CModelDef::GetName ( ) const
inline
size_t CModelDef::GetNumBlends ( ) const
inline
size_t CModelDef::GetNumBones ( ) const
inline
size_t CModelDef::GetNumFaces ( ) const
inline
size_t CModelDef::GetNumUVsPerVertex ( ) const
inline
size_t CModelDef::GetNumVertices ( ) const
inline
CModelDefRPrivate * CModelDef::GetRenderData ( const void *  key) const
SModelVertex* CModelDef::GetVertices ( ) const
inline
CModelDef * CModelDef::Load ( const VfsPath filename,
const VfsPath name 
)
static

Loads a PMD file.

Parameters
filenameVFS path of .pmd file to load
namearbitrary name to give the model for debugging purposes (usually pathname)
Returns
the model - always non-NULL
Exceptions
PSERROR_Fileif it can't load the model
CModelDef::NONCOPYABLE ( CModelDef  )
private
void CModelDef::Save ( const VfsPath filename,
const CModelDef mdef 
)
static
void CModelDef::SetRenderData ( const void *  key,
CModelDefRPrivate data 
)

Register renderer private data.

Use the key to distinguish between private data used by different render paths. The private data will be managed by this CModelDef object: It will be deleted when CModelDef is destructed or when private data is registered using the same key.

Parameters
keyThe opaque key that is used to identify the caller. The given private data can be retrieved by passing key to GetRenderData.
dataThe private data.

postconditions : data is bound to the lifetime of this CModelDef object.

CVector3D CModelDef::SkinNormal ( const SModelVertex vtx,
const CMatrix3D  newPoseMatrices[] 
)
static

Transform the given vertex's normal from the bind pose into the new pose.

Returns
new world-space vertex normal
CVector3D CModelDef::SkinPoint ( const SModelVertex vtx,
const CMatrix3D  newPoseMatrices[] 
)
static

Transform the given vertex's position from the bind pose into the new pose.

Returns
new world-space vertex coordinates
void CModelDef::SkinPointsAndNormals ( size_t  numVertices,
const VertexArrayIterator< CVector3D > &  Position,
const VertexArrayIterator< CVector3D > &  Normal,
const SModelVertex vertices,
const size_t *  blendIndices,
const CMatrix3D  newPoseMatrices[] 
)
static

Transform vertices' positions and normals.

(This is equivalent to looping over SkinPoint and SkinNormal, but slightly more efficient.)

Member Data Documentation

CBoneState* CModelDef::m_Bones
CMatrix3D* CModelDef::m_InverseBindBoneMatrices
VfsPath CModelDef::m_Name
private
size_t CModelDef::m_NumBlends
size_t CModelDef::m_NumBones
size_t CModelDef::m_NumFaces
size_t CModelDef::m_NumUVsPerVertex
size_t CModelDef::m_NumVertices
size_t* CModelDef::m_pBlendIndices
SVertexBlend* CModelDef::m_pBlends
SModelFace* CModelDef::m_pFaces
std::vector<SPropPoint> CModelDef::m_PropPoints
SModelVertex* CModelDef::m_pVertices
RenderDataMap CModelDef::m_RenderData
private

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