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

A class to easily allocate vertices for Landscape Far / Tile faces. More...

#include <landscapevb_allocator.h>

List of all members.

Vertex Program mgt .

enum  { MaxVertexProgram = 2 }
void deleteVertexProgram ()
void setupVBFormatAndVertexProgram (bool withVertexProgram)
CVertexProgram_VertexProgram [MaxVertexProgram]

VB mgt .

void deleteVertexBuffer ()
void allocateVertexBuffer (uint32 numVertices)
NLMISC::CRefPtr< IDriver_Driver
bool _VBHardOk
CVertexBuffer _VB
NLMISC::CRefPtr< IVertexBufferHard_VBHard
bool _BufferLocked

Public Types

enum  TType { Far0, Far1, Tile }

Public Methods

 CLandscapeVBAllocator (TType type)
 Constructor. More...

 ~CLandscapeVBAllocator ()
void updateDriver (IDriver *driver)
 setup driver, and test for possible VBHard reallocation. More...

void clear ()
Allocation.
bool reallocationOccurs () const
void resetReallocation ()
uint allocateVertex ()
void deleteVertex (uint vid)
Buffer access.
void lockBuffer (CFarVertexBufferInfo &farVB)
 lock buffers Hard (if any). More...

void lockBuffer (CNearVertexBufferInfo &tileVB)
void unlockBuffer ()
bool bufferLocked () const
void synchronizeATIVBHard ()
 only if ATI VBHard is enabled intenally. Copy the entire VBuffer to _ATIVBHard. This last is used in activate(). More...

void activate (uint vpId)
 activate the VB or the VBHard in Driver setuped. More...


Private Types


Private Attributes

TType _Type
bool _ReallocationOccur
std::vector< uint_VertexFreeMemory
std::vector< CVertexInfo_VertexInfos
uint _NumVerticesAllocated
Special ATI VBHard mgt.
bool _ATIVBHardOk
NLMISC::CRefPtr< IVertexBufferHard_ATIVBHard


Detailed Description

A class to easily allocate vertices for Landscape Far / Tile faces.

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 60 of file landscapevb_allocator.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
MaxVertexProgram 

Definition at line 170 of file landscapevb_allocator.h.

enum NL3D::CLandscapeVBAllocator::TType
 

Enumeration values:
Far0 
Far1 
Tile 

Definition at line 64 of file landscapevb_allocator.h.


Constructor & Destructor Documentation

NL3D::CLandscapeVBAllocator::CLandscapeVBAllocator TType    type
 

Constructor.

Definition at line 56 of file landscapevb_allocator.cpp.

References _ATIVBHardOk, _BufferLocked, _NumVerticesAllocated, _ReallocationOccur, _Type, _VBHardOk, _VertexFreeMemory, _VertexProgram, MaxVertexProgram, NL3D_VERTEX_FREE_MEMORY_RESERVE, and type.

NL3D::CLandscapeVBAllocator::~CLandscapeVBAllocator  
 

Definition at line 72 of file landscapevb_allocator.cpp.

References clear.


Member Function Documentation

void NL3D::CLandscapeVBAllocator::activate uint    vpId
 

activate the VB or the VBHard in Driver setuped.

nlassert if driver is NULL or if buffer is locked. If vertexProgram possible, activate the vertexProgram too. Give a vertexProgram Id to activate. Always 0, but 1 For tile Lightmap Pass.

Definition at line 309 of file landscapevb_allocator.cpp.

References _ATIVBHard, _BufferLocked, _Driver, _VB, _VBHard, _VertexProgram, nlassert, and nlverify.

uint NL3D::CLandscapeVBAllocator::allocateVertex  
 

Definition at line 151 of file landscapevb_allocator.cpp.

References _NumVerticesAllocated, _VertexFreeMemory, _VertexInfos, allocateVertexBuffer, id, NL3D_LANDSCAPE_VERTEX_ALLOCATE_SECURITY, NL3D_LANDSCAPE_VERTEX_ALLOCATE_START, and nlassert.

void NL3D::CLandscapeVBAllocator::allocateVertexBuffer uint32    numVertices [private]
 

Definition at line 367 of file landscapevb_allocator.cpp.

References _Driver, _ReallocationOccur, _VB, _VBHard, _VBHardOk, NL3D_VERTEX_MAX_VERTEX_VBHARD, nlassert, and unlockBuffer.

Referenced by allocateVertex, and updateDriver.

bool NL3D::CLandscapeVBAllocator::bufferLocked   const [inline]
 

Definition at line 110 of file landscapevb_allocator.h.

References _BufferLocked.

void NL3D::CLandscapeVBAllocator::clear  
 

Definition at line 113 of file landscapevb_allocator.cpp.

References _ATIVBHardOk, _Driver, _NumVerticesAllocated, _ReallocationOccur, _VBHardOk, _VertexFreeMemory, deleteVertexBuffer, and deleteVertexProgram.

Referenced by ~CLandscapeVBAllocator.

void NL3D::CLandscapeVBAllocator::deleteVertex uint    vid
 

Definition at line 194 of file landscapevb_allocator.cpp.

References _NumVerticesAllocated, _VertexFreeMemory, _VertexInfos, and nlassert.

void NL3D::CLandscapeVBAllocator::deleteVertexBuffer   [private]
 

Definition at line 334 of file landscapevb_allocator.cpp.

References _ATIVBHard, _Driver, _VB, _VBHard, nlassert, and unlockBuffer.

Referenced by clear, and updateDriver.

void NL3D::CLandscapeVBAllocator::deleteVertexProgram   [private]
 

Definition at line 642 of file landscapevb_allocator.cpp.

References _VertexProgram, and MaxVertexProgram.

Referenced by clear, and updateDriver.

void NL3D::CLandscapeVBAllocator::lockBuffer CNearVertexBufferInfo   tileVB
 

Definition at line 227 of file landscapevb_allocator.cpp.

References _BufferLocked, _Type, _VB, _VBHard, _VertexProgram, data, nlassert, Tile, and unlockBuffer.

void NL3D::CLandscapeVBAllocator::lockBuffer CFarVertexBufferInfo   farVB
 

lock buffers Hard (if any).

"slow call", so batch them. nlassert good TType. return is the VB info. NB: if the buffer is locked while a reallocation occurs, then the buffer is unlocked.

Definition at line 208 of file landscapevb_allocator.cpp.

References _BufferLocked, _Type, _VB, _VBHard, _VertexProgram, data, Far0, Far1, nlassert, and unlockBuffer.

bool NL3D::CLandscapeVBAllocator::reallocationOccurs   const [inline]
 

Definition at line 91 of file landscapevb_allocator.h.

References _ReallocationOccur.

void NL3D::CLandscapeVBAllocator::resetReallocation  
 

Definition at line 135 of file landscapevb_allocator.cpp.

References _ReallocationOccur.

void NL3D::CLandscapeVBAllocator::setupVBFormatAndVertexProgram bool    withVertexProgram [private]
 

Definition at line 656 of file landscapevb_allocator.cpp.

References _Type, _VB, _VertexProgram, Far0, Far1, NL3D_LANDSCAPE_VPPOS_ALPHAINFO, NL3D_LANDSCAPE_VPPOS_DELTAPOS, NL3D_LANDSCAPE_VPPOS_GEOMINFO, NL3D_LANDSCAPE_VPPOS_STARTPOS, NL3D_LANDSCAPE_VPPOS_TEX0, NL3D_LANDSCAPE_VPPOS_TEX1, NL3D_LANDSCAPE_VPPOS_TEX2, NL3D::NL3D_LandscapeCommonStartProgram, NL3D::NL3D_LandscapeFar0EndProgram, NL3D::NL3D_LandscapeFar1EndProgram, NL3D::NL3D_LandscapeTileEndProgram, and NL3D::NL3D_LandscapeTileLightMapEndProgram.

Referenced by updateDriver.

void NL3D::CLandscapeVBAllocator::synchronizeATIVBHard  
 

only if ATI VBHard is enabled intenally. Copy the entire VBuffer to _ATIVBHard. This last is used in activate().

Definition at line 257 of file landscapevb_allocator.cpp.

References _ATIVBHard, _ATIVBHardOk, _Driver, _VB, NL3D_VERTEX_MAX_VERTEX_VBHARD, and nlassert.

void NL3D::CLandscapeVBAllocator::unlockBuffer  
 

Definition at line 246 of file landscapevb_allocator.cpp.

References _BufferLocked, and _VBHard.

Referenced by allocateVertexBuffer, deleteVertexBuffer, and lockBuffer.

void NL3D::CLandscapeVBAllocator::updateDriver IDriver   driver
 

setup driver, and test for possible VBHard reallocation.

if the VBhard/Driver has been deleted externally, Vertices are lost. The vertex buffer is reallocated and reallocationOccurs() return true (see reallocationOccurs()). to do anytime you're not sure of change of the driver/vbHard state.

Note: the vertexProgram is created/changed here, according to driver, and TType.

Parameters:
driver  must not be NULL.

Definition at line 79 of file landscapevb_allocator.cpp.

References _ATIVBHardOk, _Driver, _NumVerticesAllocated, _VBHard, _VBHardOk, allocateVertexBuffer, deleteVertexBuffer, deleteVertexProgram, nlassert, and setupVBFormatAndVertexProgram.


Member Data Documentation

NLMISC::CRefPtr<IVertexBufferHard> NL3D::CLandscapeVBAllocator::_ATIVBHard [private]
 

Definition at line 164 of file landscapevb_allocator.h.

Referenced by activate, deleteVertexBuffer, and synchronizeATIVBHard.

bool NL3D::CLandscapeVBAllocator::_ATIVBHardOk [private]
 

Definition at line 163 of file landscapevb_allocator.h.

Referenced by CLandscapeVBAllocator, clear, synchronizeATIVBHard, and updateDriver.

bool NL3D::CLandscapeVBAllocator::_BufferLocked [private]
 

Definition at line 151 of file landscapevb_allocator.h.

Referenced by activate, bufferLocked, CLandscapeVBAllocator, lockBuffer, and unlockBuffer.

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

Definition at line 146 of file landscapevb_allocator.h.

Referenced by activate, allocateVertexBuffer, clear, deleteVertexBuffer, synchronizeATIVBHard, and updateDriver.

uint NL3D::CLandscapeVBAllocator::_NumVerticesAllocated [private]
 

Definition at line 139 of file landscapevb_allocator.h.

Referenced by allocateVertex, CLandscapeVBAllocator, clear, deleteVertex, and updateDriver.

bool NL3D::CLandscapeVBAllocator::_ReallocationOccur [private]
 

Definition at line 135 of file landscapevb_allocator.h.

Referenced by allocateVertexBuffer, CLandscapeVBAllocator, clear, reallocationOccurs, and resetReallocation.

TType NL3D::CLandscapeVBAllocator::_Type [private]
 

Definition at line 133 of file landscapevb_allocator.h.

Referenced by CLandscapeVBAllocator, lockBuffer, and setupVBFormatAndVertexProgram.

CVertexBuffer NL3D::CLandscapeVBAllocator::_VB [private]
 

Definition at line 149 of file landscapevb_allocator.h.

Referenced by activate, allocateVertexBuffer, deleteVertexBuffer, lockBuffer, setupVBFormatAndVertexProgram, and synchronizeATIVBHard.

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

Definition at line 150 of file landscapevb_allocator.h.

Referenced by activate, allocateVertexBuffer, deleteVertexBuffer, lockBuffer, unlockBuffer, and updateDriver.

bool NL3D::CLandscapeVBAllocator::_VBHardOk [private]
 

Definition at line 148 of file landscapevb_allocator.h.

Referenced by allocateVertexBuffer, CLandscapeVBAllocator, clear, and updateDriver.

std::vector<uint> NL3D::CLandscapeVBAllocator::_VertexFreeMemory [private]
 

Definition at line 137 of file landscapevb_allocator.h.

Referenced by allocateVertex, CLandscapeVBAllocator, clear, and deleteVertex.

std::vector<CVertexInfo> NL3D::CLandscapeVBAllocator::_VertexInfos [private]
 

Definition at line 138 of file landscapevb_allocator.h.

Referenced by allocateVertex, and deleteVertex.

CVertexProgram* NL3D::CLandscapeVBAllocator::_VertexProgram[MaxVertexProgram] [private]
 

Definition at line 172 of file landscapevb_allocator.h.

Referenced by activate, CLandscapeVBAllocator, deleteVertexProgram, lockBuffer, and setupVBFormatAndVertexProgram.


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