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

A VB allocator (landscape like). More...

#include <vegetablevb_allocator.h>

List of all members.

VB mgt .

void deleteVertexBufferHard ()
 delete only the Vertexbuffer hard. More...

void allocateVertexBufferAndFillVBHard (uint32 numVertices)
void setupVBFormat ()
CVertexBuffer _VB
NLMISC::CRefPtr< IDriver_Driver
bool _VBHardOk
NLMISC::CRefPtr< IVertexBufferHard_VBHard
bool _BufferLocked
uint8_AGPBufferPtr
uint _MaxVertexInBufferHard
 Maximum vertices in BufferHard allowed for this VBAllocator. More...


Public Types

enum  TVBType { VBTypeLighted = 0, VBTypeUnlit, VBTypeCount }

Public Methods

 CVegetableVBAllocator ()
 Constructor. More...

 ~CVegetableVBAllocator ()
void init (TVBType vbType, uint maxVertexInBufferHard)
 init the VB allocator, with the good type. More...

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

void clear ()
Allocation.
bool exceedMaxVertexInBufferHard (uint numAddVerts) const
 if I add numAddVerts vertices, will it overide _MaxVertexInBufferHard ?? More...

uint getNumUserVerticesAllocated () const
 return number of vertices allocated with allocateVertex() (NB: do not return the actual number of vertices allocated in VBuffer, but the number of vertices asked to be allocated). More...

uint allocateVertex ()
 Allocate free vertices in VB. More...

void deleteVertex (uint vid)
 Delete free vertices in VB. (AGP or RAM). More...

Buffer access.
void * getVertexPointer (uint i)
 get the software VB pointer to the ith index. valid only beetween 2 allocateVertex(). More...

const CVertexBuffergetSoftwareVertexBuffer () const
void flushVertex (uint i)
 If VBHard ok, copy the vertex in AGP. Warning: buffer must be locked! More...

void lockBuffer ()
 if any, lock the AGP buffer. More...

void unlockBuffer ()
 if any, unlock the AGP buffer. More...

bool bufferLocked () const
void activate ()
 activate the VB or the VBHard in Driver setuped. More...


Private Attributes

TVBType _Type
std::vector< uint_VertexFreeMemory
std::vector< CVertexInfo_VertexInfos
uint _NumVerticesAllocated


Detailed Description

A VB allocator (landscape like).

Big difference is that here, we do not really matter about reallocation because both software and hardware VB are present. Also, VertexProgram MUST be supported by driver here. NB: unlike Landscape VBAllocator, the VertexProgram is not managed by this class.

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 58 of file vegetablevb_allocator.h.


Member Enumeration Documentation

enum NL3D::CVegetableVBAllocator::TVBType
 

Enumeration values:
VBTypeLighted 
VBTypeUnlit 
VBTypeCount 

Definition at line 62 of file vegetablevb_allocator.h.


Constructor & Destructor Documentation

NL3D::CVegetableVBAllocator::CVegetableVBAllocator  
 

Constructor.

Definition at line 55 of file vegetablevb_allocator.cpp.

References _AGPBufferPtr, _BufferLocked, _MaxVertexInBufferHard, _NumVerticesAllocated, _Type, _VBHardOk, _VertexFreeMemory, NL3D_VEGETABLE_VERTEX_FREE_MEMORY_RESERVE, and VBTypeUnlit.

NL3D::CVegetableVBAllocator::~CVegetableVBAllocator  
 

Definition at line 83 of file vegetablevb_allocator.cpp.

References clear.


Member Function Documentation

void NL3D::CVegetableVBAllocator::activate  
 

activate the VB or the VBHard in Driver setuped.

nlassert if driver is NULL or if buffer is locked.

Definition at line 266 of file vegetablevb_allocator.cpp.

References _BufferLocked, _Driver, _VB, _VBHard, and nlassert.

uint NL3D::CVegetableVBAllocator::allocateVertex  
 

Allocate free vertices in VB.

(RAM and AGP if possible). work with locked or unlocked buffer. if VBHard reallocation occurs, VB is unlocked, destroyed, reallocated, and refilled.

Definition at line 185 of file vegetablevb_allocator.cpp.

References _MaxVertexInBufferHard, _NumVerticesAllocated, _VertexFreeMemory, _VertexInfos, allocateVertexBufferAndFillVBHard, id, NL3D_VEGETABLE_VERTEX_ALLOCATE_SECURITY, NL3D_VEGETABLE_VERTEX_ALLOCATE_START, and nlassert.

void NL3D::CVegetableVBAllocator::allocateVertexBufferAndFillVBHard uint32    numVertices [private]
 

Definition at line 306 of file vegetablevb_allocator.cpp.

References _AGPBufferPtr, _Driver, _MaxVertexInBufferHard, _VB, _VBHard, _VBHardOk, bufferLocked, lockBuffer, nlassert, and unlockBuffer.

Referenced by allocateVertex, and updateDriver.

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

Definition at line 120 of file vegetablevb_allocator.h.

References _BufferLocked.

Referenced by allocateVertexBufferAndFillVBHard.

void NL3D::CVegetableVBAllocator::clear  
 

Definition at line 126 of file vegetablevb_allocator.cpp.

References _Driver, _NumVerticesAllocated, _VB, _VBHardOk, _VertexFreeMemory, and deleteVertexBufferHard.

Referenced by ~CVegetableVBAllocator.

void NL3D::CVegetableVBAllocator::deleteVertex uint    vid
 

Delete free vertices in VB. (AGP or RAM).

Definition at line 234 of file vegetablevb_allocator.cpp.

References _NumVerticesAllocated, _VertexFreeMemory, _VertexInfos, and nlassert.

void NL3D::CVegetableVBAllocator::deleteVertexBufferHard   [private]
 

delete only the Vertexbuffer hard.

Definition at line 287 of file vegetablevb_allocator.cpp.

References _Driver, _VBHard, nlassert, and unlockBuffer.

Referenced by clear, and updateDriver.

bool NL3D::CVegetableVBAllocator::exceedMaxVertexInBufferHard uint    numAddVerts const
 

if I add numAddVerts vertices, will it overide _MaxVertexInBufferHard ??

Definition at line 178 of file vegetablevb_allocator.cpp.

References _MaxVertexInBufferHard, and getNumUserVerticesAllocated.

void NL3D::CVegetableVBAllocator::flushVertex uint    i
 

If VBHard ok, copy the vertex in AGP. Warning: buffer must be locked!

Definition at line 253 of file vegetablevb_allocator.cpp.

References _AGPBufferPtr, _BufferLocked, _VB, _VBHard, getVertexPointer, nlassert, and src.

uint NL3D::CVegetableVBAllocator::getNumUserVerticesAllocated   const
 

return number of vertices allocated with allocateVertex() (NB: do not return the actual number of vertices allocated in VBuffer, but the number of vertices asked to be allocated).

Definition at line 171 of file vegetablevb_allocator.cpp.

References _NumVerticesAllocated, and _VertexFreeMemory.

Referenced by exceedMaxVertexInBufferHard.

const CVertexBuffer& NL3D::CVegetableVBAllocator::getSoftwareVertexBuffer   const [inline]
 

Definition at line 112 of file vegetablevb_allocator.h.

References _VB.

void * NL3D::CVegetableVBAllocator::getVertexPointer uint    i
 

get the software VB pointer to the ith index. valid only beetween 2 allocateVertex().

Definition at line 247 of file vegetablevb_allocator.cpp.

References _VB.

Referenced by flushVertex.

void NL3D::CVegetableVBAllocator::init TVBType    vbType,
uint    maxVertexInBufferHard
 

init the VB allocator, with the good type.

must do it first. maxVertexInBufferHard is the maximum vertex allowed to reside in AGP mem. if More are allocated, then VBHard is disabled, and replaced with software VB (slower!), for ever.

Definition at line 72 of file vegetablevb_allocator.cpp.

References _MaxVertexInBufferHard, _Type, setupVBFormat, and type.

void NL3D::CVegetableVBAllocator::lockBuffer  
 

if any, lock the AGP buffer.

Definition at line 144 of file vegetablevb_allocator.cpp.

References _AGPBufferPtr, _BufferLocked, _VBHard, and unlockBuffer.

Referenced by allocateVertexBufferAndFillVBHard.

void NL3D::CVegetableVBAllocator::setupVBFormat   [private]
 

Definition at line 359 of file vegetablevb_allocator.cpp.

References _Type, _VB, NL3D_VEGETABLE_VPPOS_BENDINFO, NL3D_VEGETABLE_VPPOS_CENTER, NL3D_VEGETABLE_VPPOS_COLOR0, NL3D_VEGETABLE_VPPOS_COLOR1, NL3D_VEGETABLE_VPPOS_NORMAL, NL3D_VEGETABLE_VPPOS_POS, NL3D_VEGETABLE_VPPOS_TEX0, and VBTypeLighted.

Referenced by init.

void NL3D::CVegetableVBAllocator::unlockBuffer  
 

if any, unlock the AGP buffer.

Definition at line 158 of file vegetablevb_allocator.cpp.

References _AGPBufferPtr, _BufferLocked, and _VBHard.

Referenced by allocateVertexBufferAndFillVBHard, deleteVertexBufferHard, and lockBuffer.

void NL3D::CVegetableVBAllocator::updateDriver IDriver   driver
 

setup driver, and test for possible VBHard reallocation.

if reallocation, refill the VBHard to do anytime you're not sure of change of the driver/vbHard state.

Parameters:
driver  must not be NULL.

Definition at line 89 of file vegetablevb_allocator.cpp.

References _BufferLocked, _Driver, _MaxVertexInBufferHard, _NumVerticesAllocated, _VBHard, _VBHardOk, allocateVertexBufferAndFillVBHard, deleteVertexBufferHard, and nlassert.


Member Data Documentation

uint8* NL3D::CVegetableVBAllocator::_AGPBufferPtr [private]
 

Definition at line 158 of file vegetablevb_allocator.h.

Referenced by allocateVertexBufferAndFillVBHard, CVegetableVBAllocator, flushVertex, lockBuffer, and unlockBuffer.

bool NL3D::CVegetableVBAllocator::_BufferLocked [private]
 

Definition at line 157 of file vegetablevb_allocator.h.

Referenced by activate, bufferLocked, CVegetableVBAllocator, flushVertex, lockBuffer, unlockBuffer, and updateDriver.

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

Definition at line 153 of file vegetablevb_allocator.h.

Referenced by activate, allocateVertexBufferAndFillVBHard, clear, deleteVertexBufferHard, and updateDriver.

uint NL3D::CVegetableVBAllocator::_MaxVertexInBufferHard [private]
 

Maximum vertices in BufferHard allowed for this VBAllocator.

Definition at line 160 of file vegetablevb_allocator.h.

Referenced by allocateVertex, allocateVertexBufferAndFillVBHard, CVegetableVBAllocator, exceedMaxVertexInBufferHard, init, and updateDriver.

uint NL3D::CVegetableVBAllocator::_NumVerticesAllocated [private]
 

Definition at line 143 of file vegetablevb_allocator.h.

Referenced by allocateVertex, clear, CVegetableVBAllocator, deleteVertex, getNumUserVerticesAllocated, and updateDriver.

TVBType NL3D::CVegetableVBAllocator::_Type [private]
 

Definition at line 138 of file vegetablevb_allocator.h.

Referenced by CVegetableVBAllocator, init, and setupVBFormat.

CVertexBuffer NL3D::CVegetableVBAllocator::_VB [private]
 

Definition at line 150 of file vegetablevb_allocator.h.

Referenced by activate, allocateVertexBufferAndFillVBHard, clear, flushVertex, getSoftwareVertexBuffer, getVertexPointer, and setupVBFormat.

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

Definition at line 156 of file vegetablevb_allocator.h.

Referenced by activate, allocateVertexBufferAndFillVBHard, deleteVertexBufferHard, flushVertex, lockBuffer, unlockBuffer, and updateDriver.

bool NL3D::CVegetableVBAllocator::_VBHardOk [private]
 

Definition at line 155 of file vegetablevb_allocator.h.

Referenced by allocateVertexBufferAndFillVBHard, clear, CVegetableVBAllocator, and updateDriver.

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

Definition at line 141 of file vegetablevb_allocator.h.

Referenced by allocateVertex, clear, CVegetableVBAllocator, deleteVertex, and getNumUserVerticesAllocated.

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

Definition at line 142 of file vegetablevb_allocator.h.

Referenced by allocateVertex, and deleteVertex.


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