NL3D::IVertexBufferHard Class Reference

#include <vertex_buffer_hard.h>

Inheritance diagram for NL3D::IVertexBufferHard:

NLMISC::CRefCount NL3D::IVertexBufferHardGL NL3D::CVertexBufferHardGLATI NL3D::CVertexBufferHardGLMapObjectATI NL3D::CVertexBufferHardGLNVidia

Detailed Description

This a vertex buffer created by Driver. His pointer may be allocated on AGP Ram or VRAM. see CVertexBuffer, because it use the same flags for vertex format. IVertexBufferHard are created / deleted by IDriver.
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 46 of file vertex_buffer_hard.h.

Public Member Functions

const sintgetRefCount () const

Data Fields

sint crefs
CPtrInfo * pinfo

Static Public Attributes

CPtrInfo NullPtrInfo

Protected Member Functions

void initFormat (uint16 vertexFormat, const uint8 *typeArray, uint32 numVertices, const uint8 *uvRouting)
 IVertexBufferHard ()
 Constructor: build good offfsets / size.

virtual ~IVertexBufferHard ()

Protected Attributes

uint16 _Flags
uint16 _InternalFlags
std::string _Name
uint32 _NbVerts
uint16 _Offset [CVertexBuffer::NumValue]
uint8 _Pad
uint8 _Type [CVertexBuffer::NumValue]
uint8 _UVRouting [CVertexBuffer::MaxStage]
uint16 _VertexSize

Friends

struct CPtrInfo


Constructor & Destructor Documentation

NL3D::IVertexBufferHard::IVertexBufferHard  )  [inline, protected]
 

Constructor: build good offfsets / size.

Definition at line 149 of file vertex_buffer_hard.h.

00149 {}

virtual NL3D::IVertexBufferHard::~IVertexBufferHard  )  [inline, protected, virtual]
 

Definition at line 150 of file vertex_buffer_hard.h.

00150 {}


Member Function Documentation

const std::string& NL3D::IVertexBufferHard::getName void   )  const [inline]
 

Definition at line 120 of file vertex_buffer_hard.h.

Referenced by NL3D::CDriverGL::profileVBHardAllocation().

00120 {return _Name;}

uint32 NL3D::IVertexBufferHard::getNumVertices void   )  const [inline]
 

Definition at line 54 of file vertex_buffer_hard.h.

References uint32.

Referenced by NL3D::CDriverGL::activeVertexBufferHard(), NL3D::CVertexArrayRangeMapObjectATI::createVBHardGL(), NL3D::CVertexArrayRangeATI::createVBHardGL(), NL3D::CVertexArrayRangeNVidia::createVBHardGL(), NL3D::CDriverGL::profileVBHardAllocation(), NL3D::CNearVertexBufferInfo::setupVertexBufferHard(), NL3D::CFarVertexBufferInfo::setupVertexBufferHard(), NL3D::CVertexBufferInfo::setupVertexBufferHard(), and NL3D::CVertexBufferHardGLATI::unlock().

00054 {return(_NbVerts);}

uint8 NL3D::IVertexBufferHard::getNumWeight  )  const
 

Definition at line 76 of file vertex_buffer_hard.cpp.

References uint8.

Referenced by NL3D::CVertexBufferInfo::setupVertexBufferHard().

00077 {
00078         // Num weight
00079         switch (_Type[CVertexBuffer::Weight])
00080         {
00081         case CVertexBuffer::Float1:
00082                 return 1;
00083         case CVertexBuffer::Float2:
00084                 return 2;
00085         case CVertexBuffer::Float3:
00086                 return 3;
00087         case CVertexBuffer::Float4:
00088                 return 4;
00089         }
00090 
00091         // No weight
00092         return 0;
00093 }

const sint& NLMISC::CRefCount::getRefCount  )  const [inline, inherited]
 

Definition at line 70 of file smart_ptr.h.

References NLMISC::CRefCount::crefs, and sint.

00071         {
00072                 return  crefs;
00073         }

const uint8* NL3D::IVertexBufferHard::getUVRouting  )  const [inline]
 

Definition at line 57 of file vertex_buffer_hard.h.

References uint8.

Referenced by NL3D::CVertexBufferInfo::setupVertexBufferHard().

00057 { return _UVRouting; }

sint NL3D::IVertexBufferHard::getValueOff uint  value  )  const [inline]
 

NB: the order of those methods follow the order in memory of the elements:

  • VertexCoord
  • NormalCoord
  • TexCoord
  • Color
  • Specular
  • Weight
  • PaletteSkin NB: same order as in CVertexBuffer.

Definition at line 82 of file vertex_buffer_hard.h.

References nlassert, sint, uint, and value.

Referenced by NL3D::CVertexBufferHardGLMapObjectATI::getATIValueOffset(), NL3D::CVertexBufferHardGLATI::getATIValueOffset(), NL3D::CVertexBufferHardGLNVidia::getNVidiaValueEx(), NL3D::CNearVertexBufferInfo::setupVertexBufferHard(), and NL3D::CFarVertexBufferInfo::setupVertexBufferHard().

00082 {nlassert(_Flags & (1<<value)); return _Offset[value];}

CVertexBuffer::TType NL3D::IVertexBufferHard::getValueType uint  value  )  const [inline]
 

Definition at line 55 of file vertex_buffer_hard.h.

References nlassert, uint, and value.

Referenced by NL3D::CVertexBufferInfo::setupVertexBufferHard().

00055 { nlassert (value<CVertexBuffer::NumValue); return((CVertexBuffer::TType)_Type[value]); }

uint16 NL3D::IVertexBufferHard::getVertexFormat void   )  const [inline]
 

Definition at line 52 of file vertex_buffer_hard.h.

References uint16.

Referenced by NL3D::CDriverGL::activeVertexBufferHard(), NL3D::CNearVertexBufferInfo::setupVertexBufferHard(), NL3D::CFarVertexBufferInfo::setupVertexBufferHard(), and NL3D::CVertexBufferInfo::setupVertexBufferHard().

00052 { return(_Flags); }

uint16 NL3D::IVertexBufferHard::getVertexSize void   )  const [inline]
 

Definition at line 53 of file vertex_buffer_hard.h.

References uint16.

Referenced by NL3D::CMeshMRMGeom::applyGeomorph(), NL3D::CVertexArrayRangeMapObjectATI::createVBHardGL(), NL3D::CVertexArrayRangeATI::createVBHardGL(), NL3D::CVertexArrayRangeNVidia::createVBHardGL(), NL3D::CDriverGL::profileVBHardAllocation(), NL3D::CNearVertexBufferInfo::setupVertexBufferHard(), NL3D::CFarVertexBufferInfo::setupVertexBufferHard(), NL3D::CVertexBufferInfo::setupVertexBufferHard(), and NL3D::CVertexBufferHardGLATI::unlock().

00053 {return(_VertexSize);}

void NL3D::IVertexBufferHard::initFormat uint16  vertexFormat,
const uint8 typeArray,
uint32  numVertices,
const uint8 uvRouting
[protected]
 

Reimplemented in NL3D::IVertexBufferHardGL.

Definition at line 36 of file vertex_buffer_hard.cpp.

References uint, uint16, uint32, uint8, and value.

00037 {
00038         // _NbVerts.
00039         _NbVerts= numVertices;
00040 
00041         // Compute format: flags / offsets, for each component.
00042         _VertexSize=0;
00043         _Flags=0;
00044 
00045         // For each values
00046         for (uint value=0; value<CVertexBuffer::NumValue; value++)
00047         {
00048                 // Flag for this value
00049                 uint flag=1<<value;
00050 
00051                 // Value used ?
00052                 if (vertexFormat & flag)
00053                 {
00054                         // Use it
00055                         _Flags|=flag;
00056 
00057                         // Value offset
00058                         _Offset[value]=_VertexSize;
00059 
00060                         // New vertex size
00061                         _VertexSize+=CVertexBuffer::SizeType[typeArray[value]];
00062 
00063                         // Setup the type
00064                         _Type[value]=typeArray[value];
00065                 }
00066         }
00067 
00068         // For each UV channel
00069         uint i;
00070         for (i=0; i<CVertexBuffer::MaxStage; i++)
00071                 _UVRouting[i] = uvRouting ? uvRouting[i] : i;
00072 }

virtual void* NL3D::IVertexBufferHard::lock  )  [pure virtual]
 

Lock the entire VertexBuffer. The returned buffer is a write only buffer. (undefined result if you read it). Write note:

  • for VRAM VertexBufferHard, you should write only one time, to init.
  • for AGP VertexBufferHard, you should write sequentially to take full advantage of the write combiners.
    Returns:
    the adress of the vertex 0. Use getVertexSize(), get*Off() ... to access any part of this VertexBuffer.

Implemented in NL3D::CVertexBufferHardGLNVidia, NL3D::CVertexBufferHardGLATI, and NL3D::CVertexBufferHardGLMapObjectATI.

Referenced by NL3D::CMeshMRMGeom::applyGeomorph(), NL3D::CDriverGL::deleteVertexBufferHard(), NL3D::CDriverGL::resetVertexArrayRange(), NL3D::CMeshMorpher::update(), and NL3D::CMeshMorpher::updateSkinned().

virtual void NL3D::IVertexBufferHard::lockHintStatic bool  staticLock  )  [pure virtual]
 

Indicate what kind of lock to be done on this VertexBuffer (whatever AGP or VRAM buffer) User should set to true if the VBHard is static: nevers change or very rarely. NVidia OpenGL implementation: "Static lock" are slower, but no fences are inserted after a render with this VVBHard, hence, no slowdown because 1/ of fence overhead insertion 2/ of NVidia swapBuffers() and fence issues on GeForce2 cards. Default is false

Implemented in NL3D::CVertexBufferHardGLNVidia, NL3D::CVertexBufferHardGLATI, and NL3D::CVertexBufferHardGLMapObjectATI.

void NL3D::IVertexBufferHard::setName const std::string &  name  ) 
 

Definition at line 96 of file vertex_buffer_hard.cpp.

00097 {
00098         _Name= name;
00099 }

virtual void NL3D::IVertexBufferHard::unlock uint  startVert,
uint  endVert
[pure virtual]
 

Same as unlock() but give hints to driver on vertices that have changed. Used by ATI-OpenGL drivers. NB: driver may still ignore this information, and so take into acount all vertices

Parameters:
startVert the fisrt vertex to update
endVert the last vertex (not included) to update => numVertices= vertEnd-vertBegin. Hence unlock() as the same effect as unlock(0, getNumVertices());

Implemented in NL3D::CVertexBufferHardGLNVidia, NL3D::CVertexBufferHardGLATI, and NL3D::CVertexBufferHardGLMapObjectATI.

virtual void NL3D::IVertexBufferHard::unlock  )  [pure virtual]
 

UnLock the VertexBuffer so the Gfx card can now use it.

Implemented in NL3D::CVertexBufferHardGLNVidia, NL3D::CVertexBufferHardGLATI, and NL3D::CVertexBufferHardGLMapObjectATI.

Referenced by NL3D::CMeshMRMGeom::applyGeomorph(), NL3D::CDriverGL::deleteVertexBufferHard(), NL3D::CDriverGL::resetVertexArrayRange(), NL3D::CMeshMorpher::update(), and NL3D::CMeshMorpher::updateSkinned().


Friends And Related Function Documentation

friend struct CPtrInfo [friend, inherited]
 

Definition at line 67 of file smart_ptr.h.


Field Documentation

uint16 NL3D::IVertexBufferHard::_Flags [protected]
 

Definition at line 134 of file vertex_buffer_hard.h.

uint16 NL3D::IVertexBufferHard::_InternalFlags [protected]
 

Definition at line 137 of file vertex_buffer_hard.h.

std::string NL3D::IVertexBufferHard::_Name [protected]
 

Definition at line 146 of file vertex_buffer_hard.h.

uint32 NL3D::IVertexBufferHard::_NbVerts [protected]
 

Definition at line 140 of file vertex_buffer_hard.h.

uint16 NL3D::IVertexBufferHard::_Offset[CVertexBuffer::NumValue] [protected]
 

Definition at line 143 of file vertex_buffer_hard.h.

uint8 NL3D::IVertexBufferHard::_Pad [protected]
 

Definition at line 128 of file vertex_buffer_hard.h.

uint8 NL3D::IVertexBufferHard::_Type[CVertexBuffer::NumValue] [protected]
 

Definition at line 127 of file vertex_buffer_hard.h.

uint8 NL3D::IVertexBufferHard::_UVRouting[CVertexBuffer::MaxStage] [protected]
 

Definition at line 153 of file vertex_buffer_hard.h.

uint16 NL3D::IVertexBufferHard::_VertexSize [protected]
 

Definition at line 131 of file vertex_buffer_hard.h.

sint NLMISC::CRefCount::crefs [mutable, inherited]
 

Definition at line 79 of file smart_ptr.h.

Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount().

CRefCount::CPtrInfo NLMISC::CRefCount::NullPtrInfo [static, inherited]
 

Referenced by NLMISC::CRefCount::CRefCount().

CPtrInfo* NLMISC::CRefCount::pinfo [mutable, inherited]
 

Definition at line 80 of file smart_ptr.h.

Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 08:41:36 2004 for NeL by doxygen 1.3.6