Pyrogenesis trunk
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static 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
 
const std::vector< CVector2D > & GetUVCoordinates () 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 GetMaxBounds (CSkeletonAnimDef *anim, bool loop, CBoundingBoxAligned &result)
 
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...
 

Public Attributes

size_t m_NumVertices
 
SModelVertexm_pVertices
 
std::vector< CVector2Dm_UVCoordinates
 
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
 

Static Public Attributes

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

Private Types

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

Private Member Functions

 NONCOPYABLE (CModelDef)
 

Private Attributes

VfsPath m_Name
 
std::unordered_map< u32, CBoundingBoxAlignedm_MaxBoundsPerAnimDef
 
RenderDataMap m_RenderData
 

Member Typedef Documentation

◆ RenderDataMap

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

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
FILE_VERSION 

◆ anonymous enum

anonymous enum
Enumerator
FILE_READ_VERSION 

Constructor & Destructor Documentation

◆ CModelDef()

CModelDef::CModelDef ( )

◆ ~CModelDef()

CModelDef::~CModelDef ( )

Member Function Documentation

◆ BlendBoneMatrices()

void CModelDef::BlendBoneMatrices ( CMatrix3D  boneMatrices[])

Blend bone matrices together to fill bone palette.

◆ FindPropPoint()

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

◆ GetBlendIndices()

size_t * CModelDef::GetBlendIndices ( ) const
inline

◆ GetBlends()

SVertexBlend * CModelDef::GetBlends ( ) const
inline

◆ GetBones()

CBoneState * CModelDef::GetBones ( ) const
inline

◆ GetFaces()

SModelFace * CModelDef::GetFaces ( ) const
inline

◆ GetInverseBindBoneMatrices()

CMatrix3D * CModelDef::GetInverseBindBoneMatrices ( )
inline

◆ GetMaxBounds()

void CModelDef::GetMaxBounds ( CSkeletonAnimDef anim,
bool  loop,
CBoundingBoxAligned result 
)
Parameters
animmay be null

◆ GetName()

const VfsPath & CModelDef::GetName ( ) const
inline

◆ GetNumBlends()

size_t CModelDef::GetNumBlends ( ) const
inline

◆ GetNumBones()

size_t CModelDef::GetNumBones ( ) const
inline

◆ GetNumFaces()

size_t CModelDef::GetNumFaces ( ) const
inline

◆ GetNumUVsPerVertex()

size_t CModelDef::GetNumUVsPerVertex ( ) const
inline

◆ GetNumVertices()

size_t CModelDef::GetNumVertices ( ) const
inline

◆ GetRenderData()

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

◆ GetUVCoordinates()

const std::vector< CVector2D > & CModelDef::GetUVCoordinates ( ) const
inline

◆ GetVertices()

SModelVertex * CModelDef::GetVertices ( ) const
inline

◆ Load()

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

◆ NONCOPYABLE()

CModelDef::NONCOPYABLE ( CModelDef  )
private

◆ Save()

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

◆ SetRenderData()

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.

◆ SkinNormal()

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

◆ SkinPoint()

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

Member Data Documentation

◆ m_Bones

CBoneState* CModelDef::m_Bones

◆ m_InverseBindBoneMatrices

CMatrix3D* CModelDef::m_InverseBindBoneMatrices

◆ m_MaxBoundsPerAnimDef

std::unordered_map<u32, CBoundingBoxAligned> CModelDef::m_MaxBoundsPerAnimDef
private

◆ m_Name

VfsPath CModelDef::m_Name
private

◆ m_NumBlends

size_t CModelDef::m_NumBlends

◆ m_NumBones

size_t CModelDef::m_NumBones

◆ m_NumFaces

size_t CModelDef::m_NumFaces

◆ m_NumUVsPerVertex

size_t CModelDef::m_NumUVsPerVertex

◆ m_NumVertices

size_t CModelDef::m_NumVertices

◆ m_pBlendIndices

size_t* CModelDef::m_pBlendIndices

◆ m_pBlends

SVertexBlend* CModelDef::m_pBlends

◆ m_pFaces

SModelFace* CModelDef::m_pFaces

◆ m_PropPoints

std::vector<SPropPoint> CModelDef::m_PropPoints

◆ m_pVertices

SModelVertex* CModelDef::m_pVertices

◆ m_RenderData

RenderDataMap CModelDef::m_RenderData
private

◆ m_UVCoordinates

std::vector<CVector2D> CModelDef::m_UVCoordinates

◆ SkinPointsAndNormals

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


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