# 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::CLodCharacterManager Class Reference

A Manager used to display CLodCharacter instances. More...

#include <lod_character_manager.h>

List of all members.

render process

void deleteVertexBuffer ()
CVector _ManagerMatrixPos
CMaterial _Material
uint _CurrentVertexId
uint _MaxNumVertices
CVertexBuffer _VBuffer
NLMISC::CRefPtr< IDriver_Driver
NLMISC::CRefPtr< IVertexBufferHard_VBHard
bool _VBHardOk
uint8_VertexData
uint _VertexSize
bool _Rendering
uint _CurrentTriId
std::vector< uint32_Triangles
CMatrix _LightCorrectionMatrix

Instance texturing.

CRGBA * getTextureInstance (CLodCharacterInstance &instance)
CSmartPtr< CTextureBlank_BigTexture
std::vector< uint_FreeIds
CLodCharacterTmpBitmap _TmpBitmaps [256]

Public Methods

 CLodCharacterManager ()
 Constructor. More...

 ~CLodCharacterManager ()
build process
void reset ()
 reset the manager. More...

uint32 createShapeBank ()
 create a Shape Bank. More...

const CLodCharacterShapeBankgetShapeBank (uint32 bankId) const
 get a shape Bank. UseFull for serialisation for example. return NULL if not found. More...

CLodCharacterShapeBankgetShapeBank (uint32 bankId)
 get a shape Bank. UseFull for serialisation for example. return NULL if not found. More...

void deleteShapeBank (uint32 bankId)
 delete a Shape Bank. No-op if bad id. More...

sint32 getShapeIdByName (const std::string &name) const
 Get a shapeId by its name. More...

const CLodCharacterShapegetShape (uint32 shapeId) const
 Get a const ref on a shape. Ptr not valid if shape Banks are modfied. NULL if not found. More...

bool compile ()
 re-compile the shape map. More...

render process
void setMaxVertex (uint32 maxVertex)
 set the max number of vertices the manager can render in one time. More...

uint32 getMaxVertex () const
 see setMaxVertex(). More...

void beginRender (IDriver *driver, const CVector &managerPos)
 Start the rendering process, freeing VBuffer. More...

bool addRenderCharacterKey (CLodCharacterInstance &instance, const CMatrix &worldMatrix, CRGBA ambient, CRGBA diffuse, const CVector &lightDir)
 Add an instance to the render list. More...

void endRender ()
 compile the rendering process, effectively rendering into driver the lods. More...

bool isRendering () const
 tells if we are beetween a beginRender() and a endRender(). More...

void setupNormalCorrectionMatrix (const CMatrix &normalMatrix)
 Setup a correction matrix for Lighting. More...

Instance texturing.
void initInstance (CLodCharacterInstance &instance)
 Init the instance texturing with this manager. A texture space is reserved (if possible), and UVs are generated. More...

void releaseInstance (CLodCharacterInstance &instance)
 Release a lod instance. Free texture space. More...

bool startTextureCompute (CLodCharacterInstance &instance)
 reset the textureSpace. Instance must have been inited (nlassert). return false if no more texture space available. More...

CLodCharacterTmpBitmapgetTmpBitmap (uint8 id)
 get a tmp bitmap for a special slot. caller can fill RGBA texture for the associated material Id in it. More...

void addTextureCompute (CLodCharacterInstance &instance, const CLodCharacterTexture &lodTexture)
 add a texture from an instance. Texture Lookup are made in _TmpBitmaps. More...

void endTextureCompute (CLodCharacterInstance &instance, uint numBmpToReset)
 end and compile. reset/free memory of _TmpBitmaps up to numBmpToReset. 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::vector< CLodCharacterShapeBank * > _ShapeBankArray
 Array of shapeBank. More...

TStrIdMap _ShapeMap
 Map of shape id. More...


Detailed Description

A Manager used to display CLodCharacter instances.

Author:
Lionel Berenguier , Nevrax France
Date:
2002

Definition at line 106 of file lod_character_manager.h.


Member Typedef Documentation

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

Definition at line 236 of file lod_character_manager.h.

Referenced by getShapeIdByName.

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

Definition at line 235 of file lod_character_manager.h.

Referenced by compile.

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

Map name To Id.

Definition at line 234 of file lod_character_manager.h.


Constructor & Destructor Documentation

NL3D::CLodCharacterManager::CLodCharacterManager  
 

Constructor.

Definition at line 68 of file lod_character_manager.cpp.

References _BigTexture, _Driver, _FreeIds, _LightCorrectionMatrix, _Material, _MaxNumVertices, _Rendering, _VBuffer, NL3D_CLOD_BIGTEXT_HEIGHT, NL3D_CLOD_BIGTEXT_WIDTH, NL3D_CLOD_COLOR_OFF, NL3D_CLOD_TEXT_NUM_IDS, NL3D_CLOD_UV_OFF, NL3D_CLOD_VERTEX_FORMAT, nlassert, and NLMISC::Pi.

NL3D::CLodCharacterManager::~CLodCharacterManager  
 

Definition at line 114 of file lod_character_manager.cpp.

References reset.


Member Function Documentation

bool NL3D::CLodCharacterManager::addRenderCharacterKey CLodCharacterInstance   instance,
const CMatrix &    worldMatrix,
CRGBA    ambient,
CRGBA    diffuse,
const CVector &    lightDir
 

Add an instance to the render list.

nlassert if not isRendering() initInstance() must have been called before (nlassert)

Parameters:
instance  the lod instance information (with precomputed color/Uvs)
worldMatrix  is the world matrix, used to display the mesh
ambient  is the ambient used to simulate the lighting on the lod.
diffuse  is the diffuse used to simulate the lighting on the lod.
lightDir  is the diffuse used to simulate the lighting on the lod (should be the bigger light influence) Don't need to be normalized (must do it internally)
Returns:
false if the key can't be added to this pass BECAUSE OF TOO MANY VERTICES reason. If the shapeId or animId are bad id, it return true!! You may call endRender(), then restart a block. Or you may just stop the process if you want.

Definition at line 384 of file lod_character_manager.cpp.

References _CurrentTriId, _CurrentVertexId, _Driver, _LightCorrectionMatrix, _ManagerMatrixPos, _MaxNumVertices, _Triangles, _VertexData, _VertexSize, a00, a01, a02, a10, a20, NL3D::computeLodLighting, getShape, H_AUTO_USE, isRendering, NL3D_CLOD_COLOR_OFF, NL3D_CLOD_UV_OFF, NL3D_CLOD_VERTEX_SIZE, and nlassert.

void NL3D::CLodCharacterManager::addTextureCompute CLodCharacterInstance   instance,
const CLodCharacterTexture   lodTexture
 

add a texture from an instance. Texture Lookup are made in _TmpBitmaps.

Definition at line 779 of file lod_character_manager.cpp.

References _TmpBitmaps, getTextureInstance, NL3D_CLOD_BIGTEXT_WIDTH, NL3D_CLOD_TEXT_HEIGHT, NL3D_CLOD_TEXT_SIZE, NL3D_CLOD_TEXT_WIDTH, nlassert, x, and y.

void NL3D::CLodCharacterManager::beginRender IDriver   driver,
const CVector &    managerPos
 

Start the rendering process, freeing VBuffer.

nlassert if isRendering() NB: VBhard is locked here, so you must call endRender to unlock him (even if 0 meshes are rendered)

Parameters:
managerPos  is to help ZBuffer Precision (see IDriver::setupViewMatrixEx). This vector is removed from all instance worldMatrixes, and a IDriver::setupModelMatrix() will be done with this position. Hence, whatever value you give, the result will be the same. But if you give a value near the camera position, ZBuffer precision will be enhanced.

Definition at line 295 of file lod_character_manager.cpp.

References _CurrentTriId, _CurrentVertexId, _Driver, _ManagerMatrixPos, _MaxNumVertices, _Rendering, _Triangles, _VBHard, _VBHardOk, _VBuffer, _VertexData, _VertexSize, deleteVertexBuffer, H_AUTO_USE, isRendering, NL3D_CLOD_VERTEX_SIZE, and nlassert.

bool NL3D::CLodCharacterManager::compile  
 

re-compile the shape map.

This must be called after changing shape bank list. It return false if same names have been found, but it is still correctly builded.

Definition at line 217 of file lod_character_manager.cpp.

References _ShapeBankArray, _ShapeMap, NLMISC::contReset, ItStrIdMap, and nlwarning.

uint32 NL3D::CLodCharacterManager::createShapeBank  
 

create a Shape Bank.

NB: a vector of ShapeBank is maintained internally, hence, not so many shapeBank should be created at same Time.

Returns:
id of the shape Bank.

Definition at line 139 of file lod_character_manager.cpp.

References _ShapeBankArray.

void NL3D::CLodCharacterManager::deleteShapeBank uint32    bankId
 

delete a Shape Bank. No-op if bad id.

Definition at line 176 of file lod_character_manager.cpp.

References _ShapeBankArray.

void NL3D::CLodCharacterManager::deleteVertexBuffer   [private]
 

Definition at line 273 of file lod_character_manager.cpp.

References _Driver, _VBHard, _VBuffer, and nlassert.

Referenced by beginRender, and reset.

void NL3D::CLodCharacterManager::endRender  
 

compile the rendering process, effectively rendering into driver the lods.

nlassert if not isRendering(). The VBHard is unlocked here.

Definition at line 562 of file lod_character_manager.cpp.

References _CurrentTriId, _CurrentVertexId, _Driver, _ManagerMatrixPos, _Material, _Rendering, _Triangles, _VBHard, _VBuffer, H_AUTO_USE, isRendering, and nlassert.

void NL3D::CLodCharacterManager::endTextureCompute CLodCharacterInstance   instance,
uint    numBmpToReset
 

end and compile. reset/free memory of _TmpBitmaps up to numBmpToReset.

Definition at line 816 of file lod_character_manager.cpp.

References _BigTexture, _TmpBitmaps, getTextureInstance, NL3D_CLOD_BIGTEXT_WIDTH, NL3D_CLOD_DEFAULT_TEXCOLOR, NL3D_CLOD_TEXT_HEIGHT, NL3D_CLOD_TEXT_NLOD_WIDTH, NL3D_CLOD_TEXT_WIDTH, x, and y.

uint32 NL3D::CLodCharacterManager::getMaxVertex   const [inline]
 

see setMaxVertex().

Definition at line 162 of file lod_character_manager.h.

References _MaxNumVertices.

const CLodCharacterShape * NL3D::CLodCharacterManager::getShape uint32    shapeId const
 

Get a const ref on a shape. Ptr not valid if shape Banks are modfied. NULL if not found.

Definition at line 199 of file lod_character_manager.cpp.

References getShapeBank.

Referenced by addRenderCharacterKey, and initInstance.

CLodCharacterShapeBank * NL3D::CLodCharacterManager::getShapeBank uint32    bankId
 

get a shape Bank. UseFull for serialisation for example. return NULL if not found.

Definition at line 167 of file lod_character_manager.cpp.

References _ShapeBankArray.

const CLodCharacterShapeBank * NL3D::CLodCharacterManager::getShapeBank uint32    bankId const
 

get a shape Bank. UseFull for serialisation for example. return NULL if not found.

Definition at line 158 of file lod_character_manager.cpp.

References _ShapeBankArray.

Referenced by getShape.

sint32 NL3D::CLodCharacterManager::getShapeIdByName const std::string &    name const
 

Get a shapeId by its name.

-1 if not found. Call valid only if compile() has been correctly called

Definition at line 189 of file lod_character_manager.cpp.

References _ShapeMap, and CstItStrIdMap.

CRGBA * NL3D::CLodCharacterManager::getTextureInstance CLodCharacterInstance   instance [private]
 

Definition at line 739 of file lod_character_manager.cpp.

References _BigTexture, NL3D_CLOD_BIGTEXT_WIDTH, NL3D_CLOD_TEXT_HEIGHT, NL3D_CLOD_TEXT_NLOD_WIDTH, NL3D_CLOD_TEXT_NUM_IDS, NL3D_CLOD_TEXT_WIDTH, and nlassert.

Referenced by addTextureCompute, endTextureCompute, and startTextureCompute.

CLodCharacterTmpBitmap& NL3D::CLodCharacterManager::getTmpBitmap uint8    id [inline]
 

get a tmp bitmap for a special slot. caller can fill RGBA texture for the associated material Id in it.

Definition at line 222 of file lod_character_manager.h.

References _TmpBitmaps, and id.

void NL3D::CLodCharacterManager::initInstance CLodCharacterInstance   instance
 

Init the instance texturing with this manager. A texture space is reserved (if possible), and UVs are generated.

Definition at line 668 of file lod_character_manager.cpp.

References _FreeIds, getShape, NL3D_CLOD_TEXT_NLOD_HEIGHT, NL3D_CLOD_TEXT_NLOD_WIDTH, NL3D_CLOD_TEXT_NUM_IDS, and nlassert.

bool NL3D::CLodCharacterManager::isRendering   const [inline]
 

tells if we are beetween a beginRender() and a endRender().

Definition at line 198 of file lod_character_manager.h.

References _Rendering.

Referenced by addRenderCharacterKey, beginRender, endRender, and setMaxVertex.

void NL3D::CLodCharacterManager::releaseInstance CLodCharacterInstance   instance
 

Release a lod instance. Free texture space.

Definition at line 721 of file lod_character_manager.cpp.

References _FreeIds, NLMISC::contReset, NL3D_CLOD_TEXT_NUM_IDS, and nlassert.

void NL3D::CLodCharacterManager::reset  
 

reset the manager.

Definition at line 120 of file lod_character_manager.cpp.

References _Driver, _ShapeBankArray, _ShapeMap, NLMISC::contReset, and deleteVertexBuffer.

Referenced by ~CLodCharacterManager.

void NL3D::CLodCharacterManager::setMaxVertex uint32    maxVertex
 

set the max number of vertices the manager can render in one time.

Default is 3000 vertices. nlassert if isRendering()

Definition at line 265 of file lod_character_manager.cpp.

References _MaxNumVertices, isRendering, and nlassert.

void NL3D::CLodCharacterManager::setupNormalCorrectionMatrix const CMatrix &    normalMatrix
 

Setup a correction matrix for Lighting.

Normals are multiplied with this matrix before lighting. This is important in Ryzom because models (and so Lods) are building with eye looking in Y<0. But they are animated with eye looking in X>0. The default setup is hence a matrix wich do a RotZ+=90.

See also:
addRenderCharacterKey

Definition at line 600 of file lod_character_manager.cpp.

References _LightCorrectionMatrix.

bool NL3D::CLodCharacterManager::startTextureCompute CLodCharacterInstance   instance
 

reset the textureSpace. Instance must have been inited (nlassert). return false if no more texture space available.

Definition at line 758 of file lod_character_manager.cpp.

References getTextureInstance, NL3D_CLOD_BIGTEXT_WIDTH, NL3D_CLOD_DEFAULT_TEXCOLOR, NL3D_CLOD_TEXT_HEIGHT, NL3D_CLOD_TEXT_WIDTH, x, and y.


Member Data Documentation

CSmartPtr<CTextureBlank> NL3D::CLodCharacterManager::_BigTexture [private]
 

Definition at line 282 of file lod_character_manager.h.

Referenced by CLodCharacterManager, endTextureCompute, and getTextureInstance.

uint NL3D::CLodCharacterManager::_CurrentTriId [private]
 

Definition at line 267 of file lod_character_manager.h.

Referenced by addRenderCharacterKey, beginRender, and endRender.

uint NL3D::CLodCharacterManager::_CurrentVertexId [private]
 

Definition at line 256 of file lod_character_manager.h.

Referenced by addRenderCharacterKey, beginRender, and endRender.

NLMISC::CRefPtr<IDriver> NL3D::CLodCharacterManager::_Driver [private]
 

Definition at line 259 of file lod_character_manager.h.

Referenced by addRenderCharacterKey, beginRender, CLodCharacterManager, deleteVertexBuffer, endRender, and reset.

std::vector<uint> NL3D::CLodCharacterManager::_FreeIds [private]
 

Definition at line 284 of file lod_character_manager.h.

Referenced by CLodCharacterManager, initInstance, and releaseInstance.

CMatrix NL3D::CLodCharacterManager::_LightCorrectionMatrix [private]
 

Definition at line 271 of file lod_character_manager.h.

Referenced by addRenderCharacterKey, CLodCharacterManager, and setupNormalCorrectionMatrix.

CVector NL3D::CLodCharacterManager::_ManagerMatrixPos [private]
 

Definition at line 251 of file lod_character_manager.h.

Referenced by addRenderCharacterKey, beginRender, and endRender.

CMaterial NL3D::CLodCharacterManager::_Material [private]
 

Definition at line 254 of file lod_character_manager.h.

Referenced by CLodCharacterManager, and endRender.

uint NL3D::CLodCharacterManager::_MaxNumVertices [private]
 

Definition at line 257 of file lod_character_manager.h.

Referenced by addRenderCharacterKey, beginRender, CLodCharacterManager, getMaxVertex, and setMaxVertex.

bool NL3D::CLodCharacterManager::_Rendering [private]
 

Definition at line 264 of file lod_character_manager.h.

Referenced by beginRender, CLodCharacterManager, endRender, and isRendering.

std::vector<CLodCharacterShapeBank*> NL3D::CLodCharacterManager::_ShapeBankArray [private]
 

Array of shapeBank.

Definition at line 242 of file lod_character_manager.h.

Referenced by compile, createShapeBank, deleteShapeBank, getShapeBank, and reset.

TStrIdMap NL3D::CLodCharacterManager::_ShapeMap [private]
 

Map of shape id.

Definition at line 245 of file lod_character_manager.h.

Referenced by compile, getShapeIdByName, and reset.

CLodCharacterTmpBitmap NL3D::CLodCharacterManager::_TmpBitmaps[256] [private]
 

Definition at line 287 of file lod_character_manager.h.

Referenced by addTextureCompute, endTextureCompute, and getTmpBitmap.

std::vector<uint32> NL3D::CLodCharacterManager::_Triangles [private]
 

Definition at line 268 of file lod_character_manager.h.

Referenced by addRenderCharacterKey, beginRender, and endRender.

NLMISC::CRefPtr<IVertexBufferHard> NL3D::CLodCharacterManager::_VBHard [private]
 

Definition at line 260 of file lod_character_manager.h.

Referenced by beginRender, deleteVertexBuffer, and endRender.

bool NL3D::CLodCharacterManager::_VBHardOk [private]
 

Definition at line 261 of file lod_character_manager.h.

Referenced by beginRender.

CVertexBuffer NL3D::CLodCharacterManager::_VBuffer [private]
 

Definition at line 258 of file lod_character_manager.h.

Referenced by beginRender, CLodCharacterManager, deleteVertexBuffer, and endRender.

uint8* NL3D::CLodCharacterManager::_VertexData [private]
 

Definition at line 262 of file lod_character_manager.h.

Referenced by addRenderCharacterKey, and beginRender.

uint NL3D::CLodCharacterManager::_VertexSize [private]
 

Definition at line 263 of file lod_character_manager.h.

Referenced by addRenderCharacterKey, and beginRender.


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