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

A class used to render instances sorted by MeshGeom first, then per material, where possible. More...

#include <mesh_block_manager.h>

List of all members.

Public Methods

 CMeshBlockManager ()
 Constructor. More...

 ~CMeshBlockManager ()
void addInstance (IMeshGeom *meshGeom, CMeshBaseInstance *inst, float polygonCount)
 Add an instance of a MeshGeom to render. More...

void flush (IDriver *drv, CScene *scene, CRenderTrav *renderTrav)
 Flush the manager and effectively render. More...

VBHeap part.
void releaseVBHeaps ()
 release all Heaps => clear memory of meshs registered. More...

bool addVBHeap (IDriver *drv, uint vertexFormat, uint maxVertices)
 Add a Heap for a given vertexFormat. More...

void freeMeshVBHeap (IMeshGeom *mesh)
 Called by ~IMeshGeom(). More...


Private Types

typedef std::map< uint, uintTVBHeapMap
 Heap Map from vertexFormat to VBHeap Id. NB: do not contains 0th. More...


Private Methods

void allocateMeshVBHeap (IMeshGeom *mesh)
 Try to allocate a MeshGeom into a specific Heap. More...

void render (IMeshGeom *meshGeom, std::vector< CInstanceInfo > &rdrInstances)

Private Attributes

TVBHeapMap _VBHeapMap
std::vector< CVBHeapBlock * > _VBHeapBlocks
 List of Heaps. More...

CMeshGeomRenderContext _RenderCtx


Detailed Description

A class used to render instances sorted by MeshGeom first, then per material, where possible.

This allow optimisation because less renderState swapping are needed. WARNING: if you add MeshGeom to 2 different CMeshBlockManager at same times, it won't work, and will certainly crashes (not checked/assert).

NB VBHeap part works, even if no User interface use it. It don't give greate performance Add, but will may be used.

Author:
Lionel Berenguier , Nevrax France
Date:
2002

Definition at line 56 of file mesh_block_manager.h.


Member Typedef Documentation

typedef std::map<uint, uint> NL3D::CMeshBlockManager::TVBHeapMap [private]
 

Heap Map from vertexFormat to VBHeap Id. NB: do not contains 0th.

Definition at line 122 of file mesh_block_manager.h.


Constructor & Destructor Documentation

NL3D::CMeshBlockManager::CMeshBlockManager  
 

Constructor.

Definition at line 44 of file mesh_block_manager.cpp.

References _RenderCtx, and _VBHeapBlocks.

NL3D::CMeshBlockManager::~CMeshBlockManager  
 

Definition at line 59 of file mesh_block_manager.cpp.

References _VBHeapBlocks, and releaseVBHeaps.


Member Function Documentation

void NL3D::CMeshBlockManager::addInstance IMeshGeom   meshGeom,
CMeshBaseInstance   inst,
float    polygonCount
 

Add an instance of a MeshGeom to render.

Only CMeshBaseInstance can be added. For now, only CMeshGeom and CMeshMRMGeom are known to work.

Definition at line 69 of file mesh_block_manager.cpp.

References _VBHeapBlocks, allocateMeshVBHeap, and NL3D_MBM_VBHEAP_HEAP_MASK.

bool NL3D::CMeshBlockManager::addVBHeap IDriver   drv,
uint    vertexFormat,
uint    maxVertices
 

Add a Heap for a given vertexFormat.

Any meshGeom added with addInstance() which has this vertex Format may fit in this heap. return false and fail if the heap can't be allocated or if the heap with same vertexFormat still exist.

Definition at line 374 of file mesh_block_manager.cpp.

References _VBHeapBlocks, and _VBHeapMap.

void NL3D::CMeshBlockManager::allocateMeshVBHeap IMeshGeom   mesh [private]
 

Try to allocate a MeshGeom into a specific Heap.

Definition at line 256 of file mesh_block_manager.cpp.

References _VBHeapBlocks, _VBHeapMap, and NL3D_MBM_VBHEAP_MESH_SHIFT.

Referenced by addInstance.

void NL3D::CMeshBlockManager::flush IDriver   drv,
CScene   scene,
CRenderTrav   renderTrav
 

Flush the manager and effectively render.

Definition at line 114 of file mesh_block_manager.cpp.

References _RenderCtx, _VBHeapBlocks, H_AUTO, nlassert, and render.

void NL3D::CMeshBlockManager::freeMeshVBHeap IMeshGeom   mesh
 

Called by ~IMeshGeom().

Definition at line 315 of file mesh_block_manager.cpp.

References _VBHeapBlocks, NL3D_MBM_VBHEAP_HEAP_MASK, NL3D_MBM_VBHEAP_MESH_MASK, NL3D_MBM_VBHEAP_MESH_SHIFT, and nlassert.

Referenced by releaseVBHeaps.

void NL3D::CMeshBlockManager::releaseVBHeaps  
 

release all Heaps => clear memory of meshs registered.

Definition at line 340 of file mesh_block_manager.cpp.

References _VBHeapBlocks, _VBHeapMap, NLMISC::contReset, freeMeshVBHeap, and nlassert.

Referenced by ~CMeshBlockManager.

void NL3D::CMeshBlockManager::render IMeshGeom   meshGeom,
std::vector< CInstanceInfo > &    rdrInstances
[private]
 

Definition at line 179 of file mesh_block_manager.cpp.

References _RenderCtx.

Referenced by flush.


Member Data Documentation

CMeshGeomRenderContext NL3D::CMeshBlockManager::_RenderCtx [private]
 

Definition at line 137 of file mesh_block_manager.h.

Referenced by CMeshBlockManager, flush, and render.

std::vector<CVBHeapBlock*> NL3D::CMeshBlockManager::_VBHeapBlocks [private]
 

List of Heaps.

NB: 0th heap is special: contains all meshs which can't fit in any VBHeap.

Definition at line 128 of file mesh_block_manager.h.

Referenced by addInstance, addVBHeap, allocateMeshVBHeap, CMeshBlockManager, flush, freeMeshVBHeap, releaseVBHeaps, and ~CMeshBlockManager.

TVBHeapMap NL3D::CMeshBlockManager::_VBHeapMap [private]
 

Definition at line 123 of file mesh_block_manager.h.

Referenced by addVBHeap, allocateMeshVBHeap, and releaseVBHeaps.


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