Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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>

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
 

Detailed Description

Definition at line 136 of file ModelDef.h.

Member Typedef Documentation

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

Definition at line 283 of file ModelDef.h.

Member Enumeration Documentation

anonymous enum
Enumerator
FILE_VERSION 

Definition at line 142 of file ModelDef.h.

anonymous enum
Enumerator
FILE_READ_VERSION 

Definition at line 144 of file ModelDef.h.

Constructor & Destructor Documentation

CModelDef::CModelDef ( )

Definition at line 228 of file ModelDef.cpp.

CModelDef::~CModelDef ( )

Definition at line 237 of file ModelDef.cpp.

Member Function Documentation

void CModelDef::BlendBoneMatrices ( CMatrix3D  boneMatrices[])

Blend bone matrices together to fill bone palette.

Definition at line 206 of file ModelDef.cpp.

const SPropPoint * CModelDef::FindPropPoint ( const char *  name) const

Definition at line 251 of file ModelDef.cpp.

size_t* CModelDef::GetBlendIndices ( ) const
inline

Definition at line 184 of file ModelDef.h.

SVertexBlend* CModelDef::GetBlends ( ) const
inline

Definition at line 183 of file ModelDef.h.

CBoneState* CModelDef::GetBones ( ) const
inline

Definition at line 178 of file ModelDef.h.

SModelFace* CModelDef::GetFaces ( ) const
inline

Definition at line 174 of file ModelDef.h.

CMatrix3D* CModelDef::GetInverseBindBoneMatrices ( )
inline

Definition at line 179 of file ModelDef.h.

const VfsPath& CModelDef::GetName ( ) const
inline

Definition at line 257 of file ModelDef.h.

size_t CModelDef::GetNumBlends ( ) const
inline

Definition at line 182 of file ModelDef.h.

size_t CModelDef::GetNumBones ( ) const
inline

Definition at line 177 of file ModelDef.h.

size_t CModelDef::GetNumFaces ( ) const
inline

Definition at line 173 of file ModelDef.h.

size_t CModelDef::GetNumUVsPerVertex ( ) const
inline

Definition at line 170 of file ModelDef.h.

size_t CModelDef::GetNumVertices ( ) const
inline

Definition at line 166 of file ModelDef.h.

CModelDefRPrivate * CModelDef::GetRenderData ( const void *  key) const

Definition at line 465 of file ModelDef.cpp.

SModelVertex* CModelDef::GetVertices ( ) const
inline

Definition at line 167 of file ModelDef.h.

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

Definition at line 261 of file ModelDef.cpp.

CModelDef::NONCOPYABLE ( CModelDef  )
private
void CModelDef::Save ( const VfsPath filename,
const CModelDef mdef 
)
static

Definition at line 423 of file ModelDef.cpp.

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.

Definition at line 456 of file ModelDef.cpp.

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

Definition at line 46 of file ModelDef.cpp.

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

Definition at line 33 of file ModelDef.cpp.

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.)

Definition at line 90 of file ModelDef.cpp.

Member Data Documentation

CBoneState* CModelDef::m_Bones

Definition at line 269 of file ModelDef.h.

CMatrix3D* CModelDef::m_InverseBindBoneMatrices

Definition at line 270 of file ModelDef.h.

VfsPath CModelDef::m_Name
private

Definition at line 279 of file ModelDef.h.

size_t CModelDef::m_NumBlends

Definition at line 272 of file ModelDef.h.

size_t CModelDef::m_NumBones

Definition at line 268 of file ModelDef.h.

size_t CModelDef::m_NumFaces

Definition at line 265 of file ModelDef.h.

size_t CModelDef::m_NumUVsPerVertex

Definition at line 263 of file ModelDef.h.

size_t CModelDef::m_NumVertices

Definition at line 261 of file ModelDef.h.

size_t* CModelDef::m_pBlendIndices

Definition at line 274 of file ModelDef.h.

SVertexBlend* CModelDef::m_pBlends

Definition at line 273 of file ModelDef.h.

SModelFace* CModelDef::m_pFaces

Definition at line 266 of file ModelDef.h.

std::vector<SPropPoint> CModelDef::m_PropPoints

Definition at line 276 of file ModelDef.h.

SModelVertex* CModelDef::m_pVertices

Definition at line 262 of file ModelDef.h.

RenderDataMap CModelDef::m_RenderData
private

Definition at line 284 of file ModelDef.h.


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