# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CLodCharacterShape Class Reference

A very Small Shape with anims encoded as Key Meshes. More...

#include <lod_character_shape.h>

List of all members.

Public Methods

 CLodCharacterShape ()
 Constructor. More...

void buildMesh (const std::string &name, const CLodCharacterShapeBuild &lodBuild)
 build the Mesh base information NB: SkinWeights array tells for each vertex what bone color to use. More...

bool addAnim (const CAnimBuild &animBuild)
 Add an animation. More...

void serial (NLMISC::IStream &f)
 serial this shape. More...

const std::string & getName () const
 Get name of this lod. More...

sint getAnimIdByName (const std::string &name) const
 get the animId from a name. -1 if not found. More...

uint getNumVertices () const
 get the number of vertices of this mesh. More...

uint getNumTriangles () const
 get the number of triangles of this mesh. More...

uint getNumBones () const
 get the number of bones. More...

sint getBoneIdByName (const std::string &name) const
 get a bone id, according to its name. -1 if not found. More...

const uint32getTriangleArray () const
 get a ptr to the triangles indices. More...

const CUV * getUVs () const
 get a ptr on the UVs. More...

const CVector * getNormals () const
 get a ptr to the triangles indices. More...

const CVector3sgetAnimKey (uint animId, TGlobalAnimationTime time, bool wrapMode, CVector &unPackScaleFactor) const
 get a ptr to the vertices of the key according to animId and time. More...

Vertex per Bone coloring
void startBoneColor (std::vector< NLMISC::CRGBAF > &tmpColors) const
 init the process by resize-ing a tmp RGBAF vector of getNumVertices() size, and reset to full black. More...

void addBoneColor (uint boneId, CRGBA color, std::vector< NLMISC::CRGBAF > &tmpColors) const
 Add a bone color influence to tmpColors. More...

void endBoneColor (const std::vector< NLMISC::CRGBAF > &tmpColors, std::vector< NLMISC::CRGBA > &dstColors) const
 Compile boneColor result into a CRGBA vector (resize-ed by the method), averaging with weight stored in A. More...


Private Types

typedef std::map< std::string,
uint32
TStrIdMap
 Map name To Id. More...

typedef TStrIdMap::iterator ItStrIdMap
typedef TStrIdMap::const_iterator CstItStrIdMap

Private Attributes

std::string _Name
uint32 _NumVertices
uint32 _NumTriangles
std::vector< CUV > _UVs
std::vector< CVector > _Normals
std::vector< CBoneInfluence_Bones
 List of bones and vertices they influence. More...

TStrIdMap _BoneMap
std::vector< uint32_TriangleIndices
 numTriangles * 3. More...

std::vector< CAnim_Anims
 List of animation. More...

TStrIdMap _AnimMap


Detailed Description

A very Small Shape with anims encoded as Key Meshes.

Used for Lod of skinned meshes NB: normals are not skinned (for anim size consideration).

Author:
Lionel Berenguier , Nevrax France
Date:
2002

Definition at line 130 of file lod_character_shape.h.


Member Typedef Documentation

typedef TStrIdMap::const_iterator NL3D::CLodCharacterShape::CstItStrIdMap [private]
 

Definition at line 282 of file lod_character_shape.h.

Referenced by getAnimIdByName, and getBoneIdByName.

typedef TStrIdMap::iterator NL3D::CLodCharacterShape::ItStrIdMap [private]
 

Definition at line 281 of file lod_character_shape.h.

typedef std::map<std::string, uint32> NL3D::CLodCharacterShape::TStrIdMap [private]
 

Map name To Id.

Definition at line 280 of file lod_character_shape.h.


Constructor & Destructor Documentation

NL3D::CLodCharacterShape::CLodCharacterShape  
 

Constructor.

Definition at line 329 of file lod_character_shape.cpp.

References _NumTriangles, and _NumVertices.


Member Function Documentation

bool NL3D::CLodCharacterShape::addAnim const CAnimBuild   animBuild
 

Add an animation.

many nlAssert to verify array size etc... return false, if same AnimName exist. NB: the entire animation is compressed to CVector3s internally.

Definition at line 410 of file lod_character_shape.cpp.

References _AnimMap, _Anims, _NumVertices, NLMISC::clamp, getAnimIdByName, nlassert, and v.

void NL3D::CLodCharacterShape::addBoneColor uint    boneId,
CRGBA    color,
std::vector< NLMISC::CRGBAF > &    tmpColors
const
 

Add a bone color influence to tmpColors.

Definition at line 639 of file lod_character_shape.cpp.

References _Bones.

void NL3D::CLodCharacterShape::buildMesh const std::string &    name,
const CLodCharacterShapeBuild   lodBuild
 

build the Mesh base information NB: SkinWeights array tells for each vertex what bone color to use.

Definition at line 336 of file lod_character_shape.cpp.

References _AnimMap, _Anims, _BoneMap, _Bones, _Name, _Normals, _NumTriangles, _NumVertices, _TriangleIndices, _UVs, NLMISC::contReset, NL3D_MESH_SKINNING_MAX_MATRIX, and nlassert.

void NL3D::CLodCharacterShape::endBoneColor const std::vector< NLMISC::CRGBAF > &    tmpColors,
std::vector< NLMISC::CRGBA > &    dstColors
const
 

Compile boneColor result into a CRGBA vector (resize-ed by the method), averaging with weight stored in A.

NB: if a final vertex is not influenced by any BoneColor, then it will receive (128,128,128,0). Hence it will be somewhat transparent (AlphaTest is used to render lod character shapes). This may be interressant to hide some parts if they are not used.

Definition at line 660 of file lod_character_shape.cpp.

References getNumVertices, nlassert, and NL3D::OptFastFloor.

sint NL3D::CLodCharacterShape::getAnimIdByName const std::string &    name const
 

get the animId from a name. -1 if not found.

Definition at line 540 of file lod_character_shape.cpp.

References _AnimMap, and CstItStrIdMap.

Referenced by addAnim.

const CLodCharacterShape::CVector3s * NL3D::CLodCharacterShape::getAnimKey uint    animId,
TGlobalAnimationTime    time,
bool    wrapMode,
CVector &    unPackScaleFactor
const
 

get a ptr to the vertices of the key according to animId and time.

NB: the anim Loop if wrapMode is true

Parameters:
unPackScaleFactor  return value is the scale factor which to multiply
Returns:
NULL if animId is not valid

Definition at line 571 of file lod_character_shape.cpp.

References _Anims, _NumVertices, NLMISC::clamp, sint, and NL3D::TGlobalAnimationTime.

sint NL3D::CLodCharacterShape::getBoneIdByName const std::string &    name const
 

get a bone id, according to its name. -1 if not found.

Definition at line 551 of file lod_character_shape.cpp.

References _BoneMap, and CstItStrIdMap.

const std::string& NL3D::CLodCharacterShape::getName   const [inline]
 

Get name of this lod.

Definition at line 178 of file lod_character_shape.h.

References _Name.

const CVector * NL3D::CLodCharacterShape::getNormals   const
 

get a ptr to the triangles indices.

Definition at line 611 of file lod_character_shape.cpp.

References _Normals, and _NumVertices.

uint NL3D::CLodCharacterShape::getNumBones   const [inline]
 

get the number of bones.

Definition at line 190 of file lod_character_shape.h.

References _Bones.

uint NL3D::CLodCharacterShape::getNumTriangles   const [inline]
 

get the number of triangles of this mesh.

Definition at line 187 of file lod_character_shape.h.

References _NumTriangles.

uint NL3D::CLodCharacterShape::getNumVertices   const [inline]
 

get the number of vertices of this mesh.

Definition at line 184 of file lod_character_shape.h.

References _NumVertices.

Referenced by endBoneColor, and startBoneColor.

const uint32 * NL3D::CLodCharacterShape::getTriangleArray   const
 

get a ptr to the triangles indices.

Definition at line 562 of file lod_character_shape.cpp.

References _TriangleIndices.

const CUV * NL3D::CLodCharacterShape::getUVs   const
 

get a ptr on the UVs.

Definition at line 602 of file lod_character_shape.cpp.

References _NumVertices, and _UVs.

void NL3D::CLodCharacterShape::serial NLMISC::IStream   f
 

serial this shape.

Definition at line 504 of file lod_character_shape.cpp.

References _AnimMap, _Anims, _BoneMap, _Bones, _Name, _Normals, _NumTriangles, _NumVertices, _TriangleIndices, _UVs, NLMISC::IStream::serial, NLMISC::IStream::serialCheck, NLMISC::IStream::serialCont, and NLMISC::IStream::serialVersion.

void NL3D::CLodCharacterShape::startBoneColor std::vector< NLMISC::CRGBAF > &    tmpColors const
 

init the process by resize-ing a tmp RGBAF vector of getNumVertices() size, and reset to full black.

Definition at line 629 of file lod_character_shape.cpp.

References getNumVertices.


Member Data Documentation

TStrIdMap NL3D::CLodCharacterShape::_AnimMap [private]
 

Definition at line 304 of file lod_character_shape.h.

Referenced by addAnim, buildMesh, getAnimIdByName, and serial.

std::vector<CAnim> NL3D::CLodCharacterShape::_Anims [private]
 

List of animation.

Definition at line 301 of file lod_character_shape.h.

Referenced by addAnim, buildMesh, getAnimKey, and serial.

TStrIdMap NL3D::CLodCharacterShape::_BoneMap [private]
 

Definition at line 295 of file lod_character_shape.h.

Referenced by buildMesh, getBoneIdByName, and serial.

std::vector<CBoneInfluence> NL3D::CLodCharacterShape::_Bones [private]
 

List of bones and vertices they influence.

Definition at line 292 of file lod_character_shape.h.

Referenced by addBoneColor, buildMesh, getNumBones, and serial.

std::string NL3D::CLodCharacterShape::_Name [private]
 

Definition at line 285 of file lod_character_shape.h.

Referenced by buildMesh, getName, and serial.

std::vector<CVector> NL3D::CLodCharacterShape::_Normals [private]
 

Definition at line 290 of file lod_character_shape.h.

Referenced by buildMesh, getNormals, and serial.

uint32 NL3D::CLodCharacterShape::_NumTriangles [private]
 

Definition at line 287 of file lod_character_shape.h.

Referenced by buildMesh, CLodCharacterShape, getNumTriangles, and serial.

uint32 NL3D::CLodCharacterShape::_NumVertices [private]
 

Definition at line 286 of file lod_character_shape.h.

Referenced by addAnim, buildMesh, CLodCharacterShape, getAnimKey, getNormals, getNumVertices, getUVs, and serial.

std::vector<uint32> NL3D::CLodCharacterShape::_TriangleIndices [private]
 

numTriangles * 3.

Definition at line 298 of file lod_character_shape.h.

Referenced by buildMesh, getTriangleArray, and serial.

std::vector<CUV> NL3D::CLodCharacterShape::_UVs [private]
 

Definition at line 289 of file lod_character_shape.h.

Referenced by buildMesh, getUVs, and serial.


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