NL3D::CVertexBuffer Class Reference

#include <vertex_buffer.h>

Inheritance diagram for NL3D::CVertexBuffer:

NLMISC::CRefCount

Detailed Description

A vertex buffer to work with the driver

Definition at line 105 of file vertex_buffer.h.

Extended values vertex buffer mgt.

Thoses methods manage the vertex buffer with extended value. This is usable only with OpenGL vertex_program or DX8 vertex shaders.

void addValueEx (TValue valueId, TType type)
void clearValueEx ()
const void * getValueEx (TValue valueId, uint idx=0) const
void * getValueEx (TValue valueId, uint idx=0)
sint getValueOffEx (TValue valueId) const
bool hasValueEx (TValue valueId) const
 Test if the given value is present in the vertex buffer.

void initEx ()
void setValueDouble1Ex (TValue valueId, uint idx, double value)
void setValueDouble2Ex (TValue valueId, uint idx, double x, double y)
void setValueDouble3Ex (TValue valueId, uint idx, const CVectorD &vector)
void setValueDouble3Ex (TValue valueId, uint idx, double x, double y, double z)
void setValueDouble4Ex (TValue valueId, uint idx, double x, double y, double z, double w)
void setValueFloat1Ex (TValue valueId, uint idx, float value)
void setValueFloat2Ex (TValue valueId, uint idx, float x, float y)
void setValueFloat3Ex (TValue valueId, uint idx, const CVector &vector)
void setValueFloat3Ex (TValue valueId, uint idx, float x, float y, float z)
void setValueFloat4Ex (TValue valueId, uint idx, float x, float y, float z, float w)
void setValueShort1Ex (TValue valueId, uint idx, uint16 value)
void setValueShort2Ex (TValue valueId, uint idx, uint16 x, uint16 y)
void setValueShort3Ex (TValue valueId, uint idx, uint16 x, uint16 y, uint16 z)
void setValueShort4Ex (TValue valueId, uint idx, uint16 x, uint16 y, uint16 z, uint16 w)
void setValueUChar4Ex (TValue valueId, uint idx, CRGBA rgba)
TValue getValueIdByNumberEx (uint valueNumber)

UV Routing.

void dumpFormat () const
const uint8getUVRouting () const
void setUVRouting (uint8 uvChannel, uint newUVRouting)
uint16 remapV2Flags (uint32 oldFlags, uint &weightCount)
 Translate old flags.

void serialOldV1Minus (NLMISC::IStream &f, sint ver)
 Old version serialisation. V0 and V1.


[NOHEADER]

uint getTouchFlags () const
void resetTouchFlags ()
CRefPtr< IVBDrvInfosDrvInfos

Public Types

enum  { FirstTexCoordValue = TexCoord0, LastTexCoordValue = TexCoord7 }
enum  {
  PositionFlag = 1<<Position, NormalFlag = 1<<Normal, TexCoord0Flag = 1<<TexCoord0, TexCoord1Flag = 1<<TexCoord1,
  TexCoord2Flag = 1<<TexCoord2, TexCoord3Flag = 1<<TexCoord3, TexCoord4Flag = 1<<TexCoord4, TexCoord5Flag = 1<<TexCoord5,
  TexCoord6Flag = 1<<TexCoord6, TexCoord7Flag = 1<<TexCoord7, PrimaryColorFlag = 1<<PrimaryColor, SecondaryColorFlag = 1<<SecondaryColor,
  WeightFlag = 1<<Weight, PaletteSkinFlag = (1<<PaletteSkin)|(1<<Weight), FogFlag = 1<<Fog, EmptyFlag = 1<<Empty
}
enum  { MaxStage = 8, MaxWeight = 4 }
enum  TType {
  Double1 = 0, Float1, Short1, Double2,
  Float2, Short2, Double3, Float3,
  Short3, Double4, Float4, Short4,
  UChar4, NumType
}
enum  TValue {
  Position = 0, Normal = 1, TexCoord0 = 2, TexCoord1 = 3,
  TexCoord2 = 4, TexCoord3 = 5, TexCoord4 = 6, TexCoord5 = 7,
  TexCoord6 = 8, TexCoord7 = 9, PrimaryColor = 10, SecondaryColor = 11,
  Weight = 12, PaletteSkin = 13, Fog = 14, Empty = 15,
  NumValue = 16
}

Public Member Functions

uint32 capacity ()
 CVertexBuffer (const CVertexBuffer &vb)
 CVertexBuffer (void)
void deleteAllVertices ()
uint32 getNumVertices (void) const
uint8 getNumWeight () const
const sintgetRefCount () const
TType getValueType (uint value) const
const uint8getValueTypePointer () const
uint16 getVertexSize (void) const
CVertexBufferoperator= (const CVertexBuffer &vb)
void reserve (uint32 nVerts)
void serial (NLMISC::IStream &f)
void setNumVertices (uint32 n)
 ~CVertexBuffer (void)
Standard values vertex buffer mgt.
Thoses methods manage the vertex buffer (position, normal, colors and uv) with standard value.

sint getColorOff () const
const void * getColorPointer (uint idx=0) const
void * getColorPointer (uint idx=0)
const void * getNormalCoordPointer (uint idx=0) const
void * getNormalCoordPointer (uint idx=0)
sint getNormalOff () const
uint getNumTexCoordUsed () const
 Returns the number of texture coordinate stages used by this vertex buffer.

sint getPaletteSkinOff () const
const void * getPaletteSkinPointer (uint idx=0) const
void * getPaletteSkinPointer (uint idx=0)
sint getSpecularOff () const
const void * getSpecularPointer (uint idx=0) const
void * getSpecularPointer (uint idx=0)
sint getTexCoordOff (uint8 stage=0) const
const void * getTexCoordPointer (uint idx=0, uint8 stage=0) const
void * getTexCoordPointer (uint idx=0, uint8 stage=0)
const void * getVertexCoordPointer (uint idx=0) const
void * getVertexCoordPointer (uint idx=0)
uint16 getVertexFormat (void) const
sint getWeightOff (sint wgt) const
 NB: it is ensured that WeightOff(i)==WeightOff(0)+i*sizeof(float).

const void * getWeightPointer (uint idx=0, uint8 wgt=0) const
void * getWeightPointer (uint idx=0, uint8 wgt=0)
void setColor (uint idx, CRGBA rgba)
void setNormalCoord (uint idx, const CVector &v)
void setPaletteSkin (uint idx, CPaletteSkin ps)
void setSpecular (uint idx, CRGBA rgba)
void setTexCoord (uint idx, uint8 stage, const CUV &uv)
void setTexCoord (uint idx, uint8 stage, float u, float v)
void setVertexCoord (uint idx, const CVector &v)
void setVertexCoord (uint idx, float x, float y, float z)
bool setVertexFormat (uint32 Flags)
void setWeight (uint idx, uint8 wgt, float w)
Lod VB serialisation.
void serialHeader (NLMISC::IStream &f)
 just read/write the VertexFormat of the VB, number of vertices .... If read, VB is resized to numVertices.

void serialSubset (NLMISC::IStream &f, uint vertexStart, uint vertexEnd)

Data Fields

sint crefs
CPtrInfo * pinfo

Static Public Attributes

const TType DefaultValueType [NumValue]
CPtrInfo NullPtrInfo
const uint NumComponentsType [NumType]
const uint SizeType [NumType]

Private Types

enum  { TouchedVertexFormat = 1, TouchedNumVertices = 2, TouchedAll = 0xFFFF }

Private Attributes

uint32 _Capacity
uint16 _Flags
uint16 _InternalFlags
uint32 _NbVerts
uint16 _Offset [NumValue]
uint8 _Pad
uint8 _Type [NumValue]
uint8 _UVRouting [MaxStage]
uint16 _VertexSize
std::vector< uint8_Verts

Friends

struct CPtrInfo


Member Enumeration Documentation

anonymous enum
 

Misc infos

Enumeration values:
FirstTexCoordValue 
LastTexCoordValue 

Definition at line 136 of file vertex_buffer.h.

00137         {
00138                 FirstTexCoordValue = TexCoord0,
00139                 LastTexCoordValue  = TexCoord7,         
00140         };

anonymous enum
 

Value flags

Enumeration values:
PositionFlag 
NormalFlag 
TexCoord0Flag 
TexCoord1Flag 
TexCoord2Flag 
TexCoord3Flag 
TexCoord4Flag 
TexCoord5Flag 
TexCoord6Flag 
TexCoord7Flag 
PrimaryColorFlag 
SecondaryColorFlag 
WeightFlag 
PaletteSkinFlag 
FogFlag 
EmptyFlag 

Definition at line 145 of file vertex_buffer.h.

00146         {
00147                 PositionFlag            =       1<<Position, 
00148                 NormalFlag                      =       1<<Normal, 
00149                 TexCoord0Flag           =       1<<TexCoord0, 
00150                 TexCoord1Flag           =       1<<TexCoord1, 
00151                 TexCoord2Flag           =       1<<TexCoord2, 
00152                 TexCoord3Flag           =       1<<TexCoord3, 
00153                 TexCoord4Flag           =       1<<TexCoord4, 
00154                 TexCoord5Flag           =       1<<TexCoord5, 
00155                 TexCoord6Flag           =       1<<TexCoord6, 
00156                 TexCoord7Flag           =       1<<TexCoord7,
00157                 PrimaryColorFlag        =       1<<PrimaryColor, 
00158                 SecondaryColorFlag      =       1<<SecondaryColor, 
00159                 WeightFlag                      =       1<<Weight,
00160                 PaletteSkinFlag         =       (1<<PaletteSkin)|(1<<Weight),
00161                 FogFlag                         =       1<<Fog, 
00162                 EmptyFlag                       =       1<<Empty,
00163         };

anonymous enum
 

Some constants

Enumeration values:
MaxStage 
MaxWeight 

Definition at line 191 of file vertex_buffer.h.

00192         {
00193                 // Max count of texture coordinates
00194                 MaxStage = 8,
00195 
00196                 // Max count of skinning weight
00197                 MaxWeight = 4,
00198         };

anonymous enum [private]
 

Internal flags

Enumeration values:
TouchedVertexFormat  Vertex format touched.
TouchedNumVertices  Num vertices touched.
TouchedAll  All touhched.

Definition at line 220 of file vertex_buffer.h.

00221         {
00223                 TouchedVertexFormat             = 1,
00224 
00226                 TouchedNumVertices              = 2,
00227 
00229                 TouchedAll                              = 0xFFFF
00230         };

enum NL3D::CVertexBuffer::TType
 

Value type, there is 13 kind of value type as in DirectX8 and gl_vertex_program used in exteneded mode

Enumeration values:
Double1 
Float1 
Short1 
Double2 
Float2 
Short2 
Double3 
Float3 
Short3 
Double4 
Float4 
Short4 
UChar4 
NumType 

Definition at line 170 of file vertex_buffer.h.

00171         { 
00172                 Double1=0, 
00173                 Float1, 
00174                 Short1, 
00175                 Double2, 
00176                 Float2, 
00177                 Short2, 
00178                 Double3, 
00179                 Float3, 
00180                 Short3,
00181                 Double4, 
00182                 Float4, 
00183                 Short4,
00184                 UChar4,
00185                 NumType
00186         };

enum NL3D::CVertexBuffer::TValue
 

Value ID, there is 16 value id

Enumeration values:
Position 
Normal 
TexCoord0 
TexCoord1 
TexCoord2 
TexCoord3 
TexCoord4 
TexCoord5 
TexCoord6 
TexCoord7 
PrimaryColor 
SecondaryColor 
Weight 
PaletteSkin 
Fog 
Empty 
NumValue 

Definition at line 112 of file vertex_buffer.h.

Referenced by getValueIdByNumberEx(), serialHeader(), serialSubset(), and setVertexFormat().

00113         { 
00114                 Position                =0, 
00115                 Normal                  =1, 
00116                 TexCoord0               =2,
00117                 TexCoord1               =3, 
00118                 TexCoord2               =4,
00119                 TexCoord3               =5, 
00120                 TexCoord4               =6, 
00121                 TexCoord5               =7, 
00122                 TexCoord6               =8, 
00123                 TexCoord7               =9,
00124                 PrimaryColor    =10, 
00125                 SecondaryColor  =11, 
00126                 Weight                  =12,
00127                 PaletteSkin             =13,
00128                 Fog                             =14, 
00129                 Empty                   =15,
00130                 NumValue                =16
00131         };


Constructor & Destructor Documentation

NL3D::CVertexBuffer::CVertexBuffer void   ) 
 

Default constructor. Make an empty vertex buffer. No value, no vertex.

Definition at line 99 of file vertex_buffer.cpp.

References _InternalFlags, _NbVerts, _UVRouting, MaxStage, and uint.

00100 {
00101         _Flags = 0;
00102         _Capacity = 0;
00103         _NbVerts = 0;
00104         _InternalFlags = 0;
00105         _VertexSize = 0;
00106 
00107         // Default routing
00108         uint i; 
00109         for (i=0; i<MaxStage; i++)
00110                 _UVRouting[i] = i;
00111 }

NL3D::CVertexBuffer::CVertexBuffer const CVertexBuffer vb  ) 
 

Copy constructor. Do not copy DrvInfos, copy all infos and set IDRV_VF_TOUCHED_ALL.

Definition at line 115 of file vertex_buffer.cpp.

References _NbVerts, _UVRouting, MaxStage, operator=(), and uint.

00116 {
00117         _Flags = 0;
00118         _Capacity = 0;
00119         _NbVerts = 0;
00120         _VertexSize = 0;
00121         operator=(vb);
00122 
00123         // Default routing
00124         uint i; 
00125         for (i=0; i<MaxStage; i++)
00126                 _UVRouting[i] = i;
00127 }

NL3D::CVertexBuffer::~CVertexBuffer void   ) 
 

Destructor.

Definition at line 131 of file vertex_buffer.cpp.

References DrvInfos, and NLMISC::CRefPtr< IVBDrvInfos >::kill().

00132 {
00133         // Must kill the drv mirror of this VB.
00134         DrvInfos.kill();
00135 }


Member Function Documentation

void NL3D::CVertexBuffer::addValueEx TValue  valueId,
TType  type
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 338 of file vertex_buffer.cpp.

References Fog, nlassert, NumComponentsType, PaletteSkin, PrimaryColor, SecondaryColor, type, uint, and uint8.

Referenced by NL3D::CMeshGeom::build(), NL3D::CMRMBuilder::buildMeshBuildMrm(), serialHeader(), NL3D::CVegetableVBAllocator::setupVBFormat(), NL3D::CLandscapeVBAllocator::setupVBFormatAndVertexProgram(), NL3D::CWaterShape::setupVertexBuffer(), and setVertexFormat().

00339 {
00340         // Reset format flags
00341         _Flags |= 1<<valueId;
00342 
00343         // Set the type
00344         _Type[valueId]=(uint8)type;
00345 
00346         uint numComp = NumComponentsType[type];
00347         // unfortunately, some vertex program implementations don't allow any type for any value
00348         switch (valueId)
00349         {
00350                 case Position:                  nlassert(numComp >= 2); break;
00351                 case Normal:                    nlassert(numComp == 3); break;
00352                 case PrimaryColor:              nlassert(numComp == 4); break;
00353                 case SecondaryColor:    nlassert(numComp == 4); break;
00354                 case Weight:                    nlassert(numComp == 4); break;
00355                 case PaletteSkin:               nlassert(numComp == 4); break;
00356                 case Fog:                               nlassert(numComp == 4); break;          
00357         }
00358 }

uint32 NL3D::CVertexBuffer::capacity  )  [inline]
 

Return the number of vertices reserved.

Definition at line 468 of file vertex_buffer.h.

References uint32.

00468 { return _Capacity; }

void NL3D::CVertexBuffer::clearValueEx  ) 
 

Clear all value in the vertex buffer. After this call, call addValue for each value you want in your vertex buffer then call initEx() to init the vertex buffer.

Definition at line 271 of file vertex_buffer.cpp.

Referenced by NL3D::CMeshGeom::build(), NL3D::CMRMBuilder::buildMeshBuildMrm(), serialHeader(), NL3D::CVegetableVBAllocator::setupVBFormat(), NL3D::CLandscapeVBAllocator::setupVBFormatAndVertexProgram(), NL3D::CWaterShape::setupVertexBuffer(), and setVertexFormat().

00272 {
00273         // Reset format flags
00274         _Flags=0;
00275 }

void NL3D::CVertexBuffer::deleteAllVertices  ) 
 

Reset all the vertices from memory (contReset()), so that capacity() == getNumVertices() == 0.

Definition at line 424 of file vertex_buffer.cpp.

References _InternalFlags, _NbVerts, _Verts, and TouchedNumVertices.

Referenced by NL3D::CVegetableVBAllocator::clear(), and NL3D::CLandscapeVBAllocator::deleteVertexBuffer().

00425 {
00426         // free memory.
00427         contReset(_Verts);
00428         _Capacity= 0;
00429         if(_NbVerts!=0)
00430         {
00431                 _NbVerts=0;
00432                 _InternalFlags |= TouchedNumVertices;
00433         }
00434 }

void NL3D::CVertexBuffer::dumpFormat  )  const
 

Definition at line 280 of file vertex_buffer.cpp.

References Double1, Double2, Double3, Double4, Float1, Float2, Float3, Float4, Fog, nlinfo, NumValue, PaletteSkin, PrimaryColor, SecondaryColor, Short1, Short2, Short3, Short4, TexCoord0, TexCoord1, TexCoord2, TexCoord3, TexCoord4, TexCoord5, TexCoord6, TexCoord7, UChar4, and uint.

00281 {
00282         for(uint k = 0; k < NumValue; ++k)
00283         {
00284                 if (_Flags & (1 << k))
00285                 {
00286                         std::string result = "Component :";
00287                         switch(k)
00288                         {                       
00289                                 case Position:      result += "Position"; break;
00290                                 case Normal:        result += "Normal"; break;
00291                                 case TexCoord0:         result += "TexCoord0"; break;
00292                                 case TexCoord1:         result += "TexCoord1"; break;
00293                                 case TexCoord2:         result += "TexCoord2"; break;
00294                                 case TexCoord3:         result += "TexCoord3"; break;
00295                                 case TexCoord4:         result += "TexCoord4"; break;
00296                                 case TexCoord5:         result += "TexCoord5"; break;
00297                                 case TexCoord6:         result += "TexCoord6"; break;
00298                                 case TexCoord7:         result += "TexCoord7"; break;
00299                                 case PrimaryColor:      result += "PrimaryColor"; break;
00300                                 case SecondaryColor:result += "SecondaryColor"; break;
00301                                 case Weight:            result += "Weight"; break;
00302                                 case PaletteSkin:       result += "PaletteSkin"; break;
00303                                 case Fog:                       result += "Fog"; break;
00304                                 case Empty:                     result += "Empty"; break;
00305                                 case NumValue:          result += "NumValue"; break;
00306                                 default:
00307                                         result += "???";
00308                                 break;
00309                         }
00310                         result += "; type :";
00311                         switch(_Type[k])
00312                         {
00313                                 case Double1:  result +="Double1"; break;
00314                                 case Float1:   result +="Float1";  break;
00315                                 case Short1:   result +="Short1";  break;
00316                                 case Double2:  result +="Double2"; break;
00317                                 case Float2:   result +="Float2";  break;
00318                                 case Short2:   result +="Short2";  break;
00319                                 case Double3:  result +="Double3"; break;
00320                                 case Float3:   result +="Float3";  break;
00321                                 case Short3:   result +="Short3";  break;
00322                                 case Double4:  result +="Double4"; break;
00323                                 case Float4:   result +="Float4";  break;
00324                                 case Short4:   result +="Short4";  break;
00325                                 case UChar4:   result +="UChar4";  break;
00326                                 default:
00327                                         result += "???";
00328                                 break;
00329                         }
00330                         nlinfo(result.c_str());
00331                 }
00332         }
00333 }

sint NL3D::CVertexBuffer::getColorOff  )  const [inline]
 

Definition at line 340 of file vertex_buffer.h.

References nlassert, PrimaryColor, PrimaryColorFlag, and sint.

Referenced by NL3D::CMeshMRMGeom::applyGeomorphWithVBHardPtr(), NL3D::CLodCharacterManager::beginRender(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildVB(), NL3D::CPSTailDot::displayRibbons(), NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSRibbon::displayRibbons(), NL3D::CDriverUser::drawQuads(), NL3D::CCoarseMeshManager::getColorOff(), NL3D::CComputedString::render2DClip(), NL3D::CComputedString::render2DUnProjected(), and NL3D::CFarVertexBufferInfo::setupVertexBuffer().

00340 {nlassert(_Flags & PrimaryColorFlag); return _Offset[PrimaryColor];}

const void * NL3D::CVertexBuffer::getColorPointer uint  idx = 0  )  const
 

Definition at line 580 of file vertex_buffer.cpp.

References _Verts, PrimaryColor, PrimaryColorFlag, uint, and uint8.

00581 {
00582         const uint8*    ptr;
00583 
00584         if ( !(_Flags & PrimaryColorFlag) )
00585         {
00586                 return(NULL);
00587         }
00588         ptr=&(*_Verts.begin());
00589         ptr+=_Offset[PrimaryColor];
00590         ptr+=idx*_VertexSize;
00591         return((void*)ptr);
00592 }

void * NL3D::CVertexBuffer::getColorPointer uint  idx = 0  ) 
 

Definition at line 465 of file vertex_buffer.cpp.

References _Verts, PrimaryColor, PrimaryColorFlag, uint, and uint8.

Referenced by NL3D::CVegetableShape::build(), NL3D::CPSConstraintMesh::computeColors(), NL3D::DrawDot(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CNoise3d::render(), NL3D::CNoise3d::render2passes(), NL3D::CNoise3d::renderGrid(), NL3D::CNoise3d::renderGrid2passes(), serialOldV1Minus(), NL3D::CFarVertexBufferInfo::setupVertexBuffer(), NL3D::CMeshMorpher::update(), NL3D::CMeshMorpher::updateSkinned(), NL3D::CPSShockWave::updateVbColNUVForRender(), and NL3D::CPSQuad::updateVbColNUVForRender().

00466 {
00467         uint8*  ptr;
00468 
00469         if ( !(_Flags & PrimaryColorFlag) )
00470         {
00471                 return(NULL);
00472         }
00473         ptr=&(*_Verts.begin());
00474         ptr+=_Offset[PrimaryColor];
00475         ptr+=idx*_VertexSize;
00476         return((void*)ptr);
00477 }

const void * NL3D::CVertexBuffer::getNormalCoordPointer uint  idx = 0  )  const
 

Definition at line 564 of file vertex_buffer.cpp.

References _Verts, NormalFlag, uint, and uint8.

00565 {
00566         const uint8*    ptr;
00567 
00568         if ( !(_Flags & NormalFlag) )
00569         {
00570                 return(NULL);
00571         }
00572         ptr=&(*_Verts.begin());
00573         ptr+=_Offset[Normal];
00574         ptr+=idx*_VertexSize;
00575         return((void*)ptr);
00576 }

void * NL3D::CVertexBuffer::getNormalCoordPointer uint  idx = 0  ) 
 

Definition at line 449 of file vertex_buffer.cpp.

References _Verts, NormalFlag, uint, and uint8.

Referenced by NL3D::CMeshGeom::applySkin(), NL3D::CMeshGeom::bkupOriginalSkinVertices(), NL3D::CMeshMRMGeom::bkupOriginalSkinVerticesSubset(), NL3D::CVegetableShape::build(), NL3D::CMeshMRMSkinnedGeom::getVertexBuffer(), NL3D::CMeshMRMGeom::restoreOriginalSkinVertices(), NL3D::CMeshGeom::restoreOriginalSkinVertices(), serialOldV1Minus(), and NL3D::CMeshMorpher::update().

00450 {
00451         uint8*  ptr;
00452 
00453         if ( !(_Flags & NormalFlag) )
00454         {
00455                 return(NULL);
00456         }
00457         ptr=&(*_Verts.begin());
00458         ptr+=_Offset[Normal];
00459         ptr+=idx*_VertexSize;
00460         return((void*)ptr);
00461 }

sint NL3D::CVertexBuffer::getNormalOff  )  const [inline]
 

Definition at line 338 of file vertex_buffer.h.

References nlassert, NormalFlag, and sint.

Referenced by NL3D::CVegetableManager::addInstance(), NL3D::CMeshMRMGeom::applyGeomorphWithVBHardPtr(), NL3D::CPSConstraintMeshHelper::drawMeshs(), NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs(), NL3D::CPSConstraintMesh::makePrerotatedVb(), NL3D::CMeshMRMGeom::restoreOriginalSkinPart(), NL3D::CVegetableManager::updateInstanceLighting(), and NL3D::CMeshMorpher::updateRawSkin().

00338 {nlassert(_Flags & NormalFlag); return _Offset[Normal];}

uint NL3D::CVertexBuffer::getNumTexCoordUsed  )  const
 

Returns the number of texture coordinate stages used by this vertex buffer.

Definition at line 976 of file vertex_buffer.cpp.

References MaxStage, sint, TexCoord0Flag, and uint.

Referenced by NL3D::CMeshGeom::applySkin(), NL3D::CMeshGeom::bkupOriginalSkinVertices(), NL3D::CMeshMRMGeom::bkupOriginalSkinVerticesSubset(), NL3D::CMeshMRMGeom::renderSkin(), NL3D::CMeshMRMGeom::restoreOriginalSkinVertices(), NL3D::CMeshGeom::restoreOriginalSkinVertices(), NL3D::CMeshMorpher::update(), and NL3D::CMeshMorpher::updateSkinned().

00977 {       
00978         for (sint k = (MaxStage - 1); k >= 0; --k)
00979         {
00980                 if (_Flags & (TexCoord0Flag << k))  return (uint) (k + 1);
00981         }
00982         return 0;
00983 }

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

Get the number of active vertices.

Definition at line 453 of file vertex_buffer.h.

References _NbVerts, and uint32.

Referenced by NL3D::CDriverGL::activeVertexBuffer(), NL3D::CVegetableManager::addInstance(), NL3D::CMeshMRMGeom::beginMesh(), NL3D::CMeshMRMGeom::bkupOriginalSkinVertices(), NL3D::CMeshGeom::bkupOriginalSkinVertices(), NL3D::CMeshMRMGeom::bkupOriginalSkinVerticesSubset(), NL3D::CVegetableShape::build(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildRdrPassSet(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildVB(), NL3D::CMeshMRMGeom::compileRunTime(), NL3D::CPSConstraintMesh::computeColors(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::CMeshInstance::createShadowMap(), NL3D::CPSConstraintMeshHelper::drawMeshs(), NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs(), NL3D::UShape::getMeshTriangles(), NL3D::CMeshMRMGeom::getVBHeapInfo(), NL3D::CMeshGeom::getVBHeapInfo(), NL3D::CPSRibbon::getVBnPB(), NL3D::CMeshMultiLod::instanciateCoarseMeshSpace(), NL3D::CPSConstraintMesh::makePrerotatedVb(), NL3D::CNoise3d::render(), NL3D::CMeshMRMGeom::render(), NL3D::CComputedString::render2D(), NL3D::CComputedString::render2DClip(), NL3D::CComputedString::render2DUnProjected(), NL3D::CNoise3d::render2passes(), NL3D::CComputedString::render3D(), NL3D::CMeshMultiLod::renderCoarseMesh(), NL3D::CNoise3d::renderGrid(), NL3D::CNoise3d::renderGrid2passes(), NL3D::CVegetableManager::reserveIgAddInstances(), NL3D::CMeshMRMGeom::restoreOriginalSkinVertices(), NL3D::CMeshGeom::restoreOriginalSkinVertices(), NL3D::CVegetableShape::serial(), NL3D::CMeshMultiLodInstance::setPosCoarseMesh(), NL3D::CNearVertexBufferInfo::setupVertexBuffer(), NL3D::CFarVertexBufferInfo::setupVertexBuffer(), NL3D::CVertexBufferInfo::setupVertexBuffer(), NL3D::CMeshMultiLodInstance::setUVCoarseMesh(), NL3D::CLandscapeVBAllocator::synchronizeATIVBHard(), NL3D::CPSConstraintMesh::update(), NL3D::CMeshMorpher::update(), NL3D::CMeshMorpher::updateRawSkin(), NL3D::CMeshMRMGeom::updateRawSkinNormal(), NL3D::CMeshMorpher::updateSkinned(), NL3D::CMeshMRMGeom::updateVertexBufferHard(), and NL3D::CMeshGeom::updateVertexBufferHard().

00453 { return(_NbVerts); }

uint8 NL3D::CVertexBuffer::getNumWeight  )  const
 

Return number of weight value in vertices

Definition at line 987 of file vertex_buffer.cpp.

References Float1, Float2, Float3, Float4, and uint8.

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

00988 {
00989         // Num weight
00990         switch (_Type[Weight])
00991         {
00992         case Float1:
00993                 return 1;
00994         case Float2:
00995                 return 2;
00996         case Float3:
00997                 return 3;
00998         case Float4:
00999                 return 4;
01000         }
01001 
01002         // No weight
01003         return 0;
01004 }

sint NL3D::CVertexBuffer::getPaletteSkinOff  )  const [inline]
 

Definition at line 344 of file vertex_buffer.h.

References nlassert, PaletteSkin, and sint.

00344 {nlassert(_Flags & PaletteSkin); return _Offset[PaletteSkin];}

const void * NL3D::CVertexBuffer::getPaletteSkinPointer uint  idx = 0  )  const
 

Definition at line 644 of file vertex_buffer.cpp.

References _Verts, PaletteSkin, PaletteSkinFlag, uint, and uint8.

00645 {
00646         const uint8*    ptr;
00647 
00648         if ( (_Flags & PaletteSkinFlag) != CVertexBuffer::PaletteSkinFlag )
00649         {
00650                 return(NULL);
00651         }
00652         ptr=&(*_Verts.begin());
00653         ptr+=_Offset[PaletteSkin];
00654         ptr+=idx*_VertexSize;
00655         return((void*)ptr);
00656 }

void * NL3D::CVertexBuffer::getPaletteSkinPointer uint  idx = 0  ) 
 

Definition at line 529 of file vertex_buffer.cpp.

References _Verts, PaletteSkin, PaletteSkinFlag, uint, and uint8.

Referenced by NL3D::CMeshGeom::applySkin(), and serialOldV1Minus().

00530 {
00531         uint8*  ptr;
00532 
00533         if ( (_Flags & PaletteSkinFlag) != CVertexBuffer::PaletteSkinFlag )
00534         {
00535                 return(NULL);
00536         }
00537         ptr=&(*_Verts.begin());
00538         ptr+=_Offset[PaletteSkin];
00539         ptr+=idx*_VertexSize;
00540         return((void*)ptr);
00541 }

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         }

sint NL3D::CVertexBuffer::getSpecularOff  )  const [inline]
 

Definition at line 341 of file vertex_buffer.h.

References nlassert, SecondaryColor, SecondaryColorFlag, and sint.

Referenced by NL3D::CMeshMRMGeom::applyGeomorphWithVBHardPtr().

00341 {nlassert(_Flags & SecondaryColorFlag); return _Offset[SecondaryColor];}

const void * NL3D::CVertexBuffer::getSpecularPointer uint  idx = 0  )  const
 

Definition at line 596 of file vertex_buffer.cpp.

References _Verts, SecondaryColor, SecondaryColorFlag, uint, and uint8.

00597 {
00598         const uint8*    ptr;
00599 
00600         if ( !(_Flags & SecondaryColorFlag) )
00601         {
00602                 return(NULL);
00603         }
00604         ptr=&(*_Verts.begin());
00605         ptr+=_Offset[SecondaryColor];
00606         ptr+=idx*_VertexSize;
00607         return((void*)ptr);
00608 }

void * NL3D::CVertexBuffer::getSpecularPointer uint  idx = 0  ) 
 

Definition at line 481 of file vertex_buffer.cpp.

References _Verts, SecondaryColor, SecondaryColorFlag, uint, and uint8.

Referenced by serialOldV1Minus().

00482 {
00483         uint8*  ptr;
00484 
00485         if ( !(_Flags & SecondaryColorFlag) )
00486         {
00487                 return(NULL);
00488         }
00489         ptr=&(*_Verts.begin());
00490         ptr+=_Offset[SecondaryColor];
00491         ptr+=idx*_VertexSize;
00492         return((void*)ptr);
00493 }

sint NL3D::CVertexBuffer::getTexCoordOff uint8  stage = 0  )  const [inline]
 

Definition at line 339 of file vertex_buffer.h.

References nlassert, sint, TexCoord0, TexCoord0Flag, and uint8.

Referenced by NL3D::CVegetableManager::addInstance(), NL3D::CMeshMRMGeom::applyGeomorphWithVBHardPtr(), NL3D::CLodCharacterManager::beginRender(), NL3D::CDriverUser::drawQuads(), NL3D::CCoarseMeshManager::getUVOff(), NL3D::CComputedString::render2DClip(), NL3D::CComputedString::render2DUnProjected(), NL3D::CNearVertexBufferInfo::setupVertexBuffer(), NL3D::CFarVertexBufferInfo::setupVertexBuffer(), NL3D::CMeshMorpher::updateRawSkin(), and NL3D::CMeshMorpher::updateSkinned().

00339 {nlassert(_Flags & (TexCoord0Flag<<stage)); return _Offset[TexCoord0+stage]; }

const void * NL3D::CVertexBuffer::getTexCoordPointer uint  idx = 0,
uint8  stage = 0
const
 

Definition at line 612 of file vertex_buffer.cpp.

References _Verts, TexCoord0, TexCoord0Flag, uint, and uint8.

00613 {
00614         const uint8*    ptr;
00615 
00616         if ( !(_Flags & (TexCoord0Flag<<stage)) )
00617         {
00618                 return(NULL);
00619         }
00620         ptr=&(*_Verts.begin());
00621         ptr+=_Offset[TexCoord0+stage];
00622         ptr+=idx*_VertexSize;
00623         return((void*)ptr);
00624 }

void * NL3D::CVertexBuffer::getTexCoordPointer uint  idx = 0,
uint8  stage = 0
 

Definition at line 497 of file vertex_buffer.cpp.

References _Verts, TexCoord0, TexCoord0Flag, uint, and uint8.

Referenced by NL3D::CZoneLighter::addTriangles(), NL3D::CMeshGeom::applySkin(), NL3D::CMeshGeom::bkupOriginalSkinVertices(), NL3D::CMeshMRMGeom::bkupOriginalSkinVerticesSubset(), NL3D::CVegetableShape::build(), NL3D::CCloud::dispBill(), NL3D::CCloud::dispXYZ(), NL3D::CCloud::generate(), NL3D::CMeshMRMSkinnedGeom::getVertexBuffer(), NL3D::CCloud::light(), NL3D::CCoarseMeshBuild::remapCoordinates(), NL3D::CNoise3d::render(), NL3D::CNoise3d::render2passes(), NL3D::CNoise3d::renderGrid(), NL3D::CNoise3d::renderGrid2passes(), NL3D::CMeshMRMGeom::restoreOriginalSkinVertices(), NL3D::CMeshGeom::restoreOriginalSkinVertices(), serialOldV1Minus(), NL3D::CNearVertexBufferInfo::setupVertexBuffer(), NL3D::CFarVertexBufferInfo::setupVertexBuffer(), NL3D::CMeshMultiLodInstance::setUVCoarseMesh(), NL3D::CMeshMorpher::update(), NL3D::CMeshMRMGeom::updateRawSkinNormal(), NL3D::CMeshMorpher::updateSkinned(), NL3D::CPSShockWave::updateVbColNUVForRender(), and NL3D::CPSQuad::updateVbColNUVForRender().

00498 {
00499         uint8*  ptr;
00500 
00501         if ( !(_Flags & (TexCoord0Flag<<stage)) )
00502         {
00503                 return(NULL);
00504         }
00505         ptr=&(*_Verts.begin());
00506         ptr+=_Offset[TexCoord0+stage];
00507         ptr+=idx*_VertexSize;
00508         return((void*)ptr);
00509 }

uint NL3D::CVertexBuffer::getTouchFlags  )  const [inline]
 

Definition at line 265 of file vertex_buffer.h.

References _InternalFlags, TouchedAll, and uint.

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

00265 { return _InternalFlags&TouchedAll; }

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

Definition at line 504 of file vertex_buffer.h.

References _UVRouting, and uint8.

Referenced by NL3D::CLandscapeVBAllocator::allocateVertexBuffer(), NL3D::CVegetableVBAllocator::allocateVertexBufferAndFillVBHard(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildVB(), NL3D::CVertexStreamManager::init(), NL3D::CVertexBufferHeap::init(), NL3D::CVertexBufferInfo::setupVertexBuffer(), NL3D::CLandscapeVBAllocator::synchronizeATIVBHard(), NL3D::CMeshMRMGeom::updateVertexBufferHard(), and NL3D::CMeshGeom::updateVertexBufferHard().

00504 { return _UVRouting; }

const void* NL3D::CVertexBuffer::getValueEx TValue  valueId,
uint  idx = 0
const [inline]
 

Get readable value pointer.

Definition at line 436 of file vertex_buffer.h.

References _Verts, getValueOffEx(), nlassert, and uint.

00436 { nlassert (_Flags & (1<<valueId));     return (void*)((&(*_Verts.begin()))+idx*_VertexSize+getValueOffEx (valueId)); };

void* NL3D::CVertexBuffer::getValueEx TValue  valueId,
uint  idx = 0
[inline]
 

Get writable value pointer.

Definition at line 431 of file vertex_buffer.h.

References _Verts, getValueOffEx(), nlassert, and uint.

Referenced by serialSubset(), and NL3D::CVertexBufferInfo::setupVertexBuffer().

00431 { nlassert (_Flags & (1<<valueId));     return (void*)((&(*_Verts.begin()))+idx*_VertexSize+getValueOffEx (valueId)); }

CVertexBuffer::TValue NL3D::CVertexBuffer::getValueIdByNumberEx uint  valueNumber  )  [static]
 

get the corresponding TValue according to the number of vertex attribute wanted (v[0], v[1] ...) Warning!: (TValue)valueNumber != getValueIdByNumberEx(valueNumber).

Parameters:
valueNumber is the value index (0..15) you want to know the valueId.

Definition at line 244 of file vertex_buffer.cpp.

References Fog, PaletteSkin, PrimaryColor, SecondaryColor, TexCoord0, TexCoord1, TexCoord2, TexCoord3, TexCoord4, TexCoord5, TexCoord6, TexCoord7, TValue, and uint.

00245 {
00246         // See NV_vertex_program spec, or driver_opengl_vertex.cpp:: GLVertexAttribIndex.
00247         static  TValue  lut[16]= {
00248                 Position,
00249                 Weight,
00250                 Normal,
00251                 PrimaryColor,
00252                 SecondaryColor,
00253                 Fog,
00254                 PaletteSkin,
00255                 Empty,
00256                 TexCoord0,
00257                 TexCoord1,
00258                 TexCoord2,
00259                 TexCoord3,
00260                 TexCoord4,
00261                 TexCoord5,
00262                 TexCoord6,
00263                 TexCoord7,
00264         };
00265 
00266         return lut[valueNumber];
00267 }

sint NL3D::CVertexBuffer::getValueOffEx TValue  valueId  )  const [inline]
 

Get value offset.

Definition at line 441 of file vertex_buffer.h.

References nlassert, and sint.

Referenced by NL3D::CVegetableManager::addInstance(), getValueEx(), NL3D::CNearVertexBufferInfo::setupVertexBuffer(), NL3D::CFarVertexBufferInfo::setupVertexBuffer(), and NL3D::CVegetableManager::updateInstanceLighting().

00441 { nlassert(_Flags & (1<<valueId)); return _Offset[valueId]; };

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

Return the type of a value

Definition at line 478 of file vertex_buffer.h.

References nlassert, NumValue, uint, and value.

Referenced by NL3D::CMeshMRMGeom::applyGeomorphWithVBHardPtr(), and NL3D::CVertexBufferInfo::setupVertexBuffer().

00478 { nlassert (value<NumValue); return((TType)_Type[value]); }

const uint8* NL3D::CVertexBuffer::getValueTypePointer  )  const [inline]
 

Return the type array

Definition at line 483 of file vertex_buffer.h.

References uint8.

Referenced by NL3D::CLandscapeVBAllocator::allocateVertexBuffer(), NL3D::CVegetableVBAllocator::allocateVertexBufferAndFillVBHard(), NL3D::CVertexStreamManager::init(), NL3D::CVertexBufferHeap::init(), NL3D::CLandscapeVBAllocator::synchronizeATIVBHard(), NL3D::CMeshMRMGeom::updateVertexBufferHard(), and NL3D::CMeshGeom::updateVertexBufferHard().

00483 { return _Type; }

const void * NL3D::CVertexBuffer::getVertexCoordPointer uint  idx = 0  )  const
 

Definition at line 553 of file vertex_buffer.cpp.

References _Verts, uint, and uint8.

00554 {
00555         const uint8*    ptr;
00556 
00557         ptr=&(*_Verts.begin());
00558         ptr+=(idx*_VertexSize);
00559         return((void*)ptr);
00560 }

void * NL3D::CVertexBuffer::getVertexCoordPointer uint  idx = 0  ) 
 

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

  • VertexCoord
  • NormalCoord
  • TexCoord
  • Color
  • Specular
  • Weight
  • PaletteSkin

Definition at line 438 of file vertex_buffer.cpp.

References _Verts, uint, and uint8.

Referenced by NL3D::CVegetableManager::addInstance(), NL3D::CCoarseMeshManager::addMesh(), NL3D::CZoneLighter::addTriangles(), NL3D::CInstanceLighter::addTriangles(), NL3D::CVegetableVBAllocator::allocateVertexBufferAndFillVBHard(), NL3D::CMeshMRMGeom::applyGeomorphWithVBHardPtr(), NL3D::CMeshMRMGeom::applySkin(), NL3D::CMeshGeom::applySkin(), NL3D::CMeshGeom::bkupOriginalSkinVertices(), NL3D::CMeshMRMGeom::bkupOriginalSkinVerticesSubset(), NL3D::CVegetableShape::build(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildVB(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::CMeshInstance::createShadowMap(), NL3D::CCloud::dispBill(), NL3D::CPSTailDot::displayRibbons(), NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSRibbon::displayRibbons(), NL3D::CCloud::dispXYZ(), NL3D::CWaterModel::doSimpleRender(), NL3D::DrawDot(), NL3D::CPSFaceHelper::drawFaces(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSConstraintMeshHelper::drawMeshs(), NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs(), NL3D::CDriverUser::drawQuads(), NL3D::CPSShockWaveHelper::drawShockWave(), NL3D::CCloud::genBill(), NL3D::CCloud::generate(), NL3D::UShape::getMeshTriangles(), NL3D::CMeshMRMSkinnedGeom::getVertexBuffer(), NL3D::CVegetableVBAllocator::getVertexPointer(), NL3D::CVertexBufferHeap::init(), NL3D::CCloud::light(), NL3D::CVertexStreamManager::lock(), NL3D::CPSConstraintMesh::makePrerotatedVb(), NL3D::CSegRemanence::render(), NL3D::CNoise3d::render(), NL3D::CComputedString::render2DClip(), NL3D::CComputedString::render2DUnProjected(), NL3D::CNoise3d::render2passes(), NL3D::CNoise3d::renderGrid(), NL3D::CNoise3d::renderGrid2passes(), NL3D::CCloud::reset(), NL3D::CMeshMRMGeom::restoreOriginalSkinPart(), NL3D::CMeshMRMGeom::restoreOriginalSkinVertices(), NL3D::CMeshGeom::restoreOriginalSkinVertices(), serialOldV1Minus(), NL3D::CMeshMultiLodInstance::setPosCoarseMesh(), NL3D::CNearVertexBufferInfo::setupVertexBuffer(), NL3D::CFarVertexBufferInfo::setupVertexBuffer(), NL3D::CLandscapeVBAllocator::synchronizeATIVBHard(), NL3D::CWaterModel::traverseRender(), NL3D::CMeshMorpher::update(), NL3D::CVegetableManager::updateInstanceLighting(), NL3D::CMeshMorpher::updateRawSkin(), NL3D::CMeshMorpher::updateSkinned(), NL3D::CMeshMRMGeom::updateVertexBufferHard(), and NL3D::CMeshGeom::updateVertexBufferHard().

00439 {
00440         uint8*  ptr;
00441 
00442         ptr=&(*_Verts.begin());
00443         ptr+=(idx*_VertexSize);
00444         return((void*)ptr);
00445 }

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

Return the vertex format used by the vertex buffer.

Return one or several flags between : PositionFlag, WeightFlag, NormalFlag, PrimaryColorFlag, SecondaryColorFlag, FogFlag, TexCoord0Flag, TexCoord1Flag, TexCoord2Flag, TexCoord3Flag, TexCoord4Flag, TexCoord5Flag, TexCoord6Flag, TexCoord7Flag, PaletteSkinFlag

If WeightFlag is specified, 4 float are used to setup the skinning value on 4 bones.

Definition at line 319 of file vertex_buffer.h.

References uint16.

Referenced by NL3D::CDriverGL::activeVertexBuffer(), NL3D::CLandscapeVBAllocator::allocateVertexBuffer(), NL3D::CVegetableVBAllocator::allocateVertexBufferAndFillVBHard(), NL3D::CMeshMRMGeom::applyGeomorphWithVBHardPtr(), NL3D::CMeshMRMGeom::applySkin(), NL3D::CMeshGeom::bkupOriginalSkinVertices(), NL3D::CMeshMRMGeom::bkupOriginalSkinVerticesSubset(), NL3D::CVegetableShape::build(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildVB(), NL3D::CMeshMRMGeom::compileRunTime(), NL3D::CPSConstraintMesh::computeColors(), NL3D::CPSConstraintMeshHelper::drawMeshs(), NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs(), NL3D::CMeshMRMGeom::getVBHeapInfo(), NL3D::CMeshGeom::getVBHeapInfo(), NL3D::CVertexStreamManager::init(), NL3D::CVertexBufferHeap::init(), NL3D::CPSConstraintMesh::makePrerotatedVb(), NL3D::CMeshMRMGeom::profileSceneRender(), NL3D::CMeshGeom::profileSceneRender(), NL3D::CMeshMRMGeom::renderSkin(), NL3D::CMeshMRMGeom::renderSkinGroupGeom(), NL3D::CMeshMRMGeom::restoreOriginalSkinPart(), NL3D::CMeshMRMGeom::restoreOriginalSkinVertices(), NL3D::CMeshGeom::restoreOriginalSkinVertices(), NL3D::CMeshMultiLodInstance::setPosCoarseMesh(), NL3D::CNearVertexBufferInfo::setupVertexBuffer(), NL3D::CFarVertexBufferInfo::setupVertexBuffer(), NL3D::CVertexBufferInfo::setupVertexBuffer(), NL3D::CMeshMultiLodInstance::setUVCoarseMesh(), NL3D::CLandscapeVBAllocator::synchronizeATIVBHard(), NL3D::CPSConstraintMesh::update(), NL3D::CMeshMorpher::update(), NL3D::CMeshMorpher::updateRawSkin(), NL3D::CMeshMorpher::updateSkinned(), NL3D::CMeshMRMGeom::updateVertexBufferHard(), and NL3D::CMeshGeom::updateVertexBufferHard().

00319 { return(_Flags); };

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

Return the size of a vertex

Definition at line 473 of file vertex_buffer.h.

References uint16.

Referenced by NL3D::CCoarseMeshManager::addMesh(), NL3D::CVegetableVBAllocator::allocateVertexBufferAndFillVBHard(), NL3D::CMeshMRMGeom::applyGeomorph(), NL3D::CMeshMRMGeom::applyGeomorphWithVBHardPtr(), NL3D::CMeshMRMGeom::applySkin(), NL3D::CMeshGeom::applySkin(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildVB(), NL3D::CPSConstraintMesh::computeColors(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::CCloud::dispBill(), NL3D::CPSTailDot::displayRibbons(), NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSRibbon::displayRibbons(), NL3D::CCloud::dispXYZ(), NL3D::DrawDot(), NL3D::CPSFaceHelper::drawFaces(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSConstraintMeshHelper::drawMeshs(), NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs(), NL3D::CDriverUser::drawQuads(), NL3D::CPSShockWaveHelper::drawShockWave(), NL3D::CVegetableVBAllocator::flushVertex(), NL3D::CCloud::genBill(), NL3D::CCloud::generate(), NL3D::UShape::getMeshTriangles(), NL3D::CCoarseMeshManager::getVertexSize(), NL3D::CVertexStreamManager::init(), NL3D::CVertexBufferHeap::init(), NL3D::CCloud::light(), NL3D::CPSConstraintMesh::makePrerotatedVb(), NL3D::CSegRemanence::render(), NL3D::CNoise3d::render(), NL3D::CComputedString::render2DClip(), NL3D::CComputedString::render2DUnProjected(), NL3D::CNoise3d::render2passes(), NL3D::CNoise3d::renderGrid(), NL3D::CNoise3d::renderGrid2passes(), NL3D::CCloud::reset(), NL3D::CMeshMRMGeom::restoreOriginalSkinPart(), NL3D::CMeshMultiLodInstance::setPosCoarseMesh(), NL3D::CNearVertexBufferInfo::setupVertexBuffer(), NL3D::CFarVertexBufferInfo::setupVertexBuffer(), NL3D::CVertexBufferInfo::setupVertexBuffer(), NL3D::CMeshMultiLodInstance::setUVCoarseMesh(), NL3D::CVegetableManager::swapIgRdrPassHardMode(), NL3D::CLandscapeVBAllocator::synchronizeATIVBHard(), NL3D::CWaterModel::traverseRender(), NL3D::CMeshMorpher::update(), NL3D::CMeshMorpher::updateRawSkin(), NL3D::CMeshMorpher::updateSkinned(), NL3D::CPSShockWave::updateVbColNUVForRender(), NL3D::CPSQuad::updateVbColNUVForRender(), NL3D::CMeshMRMGeom::updateVertexBufferHard(), and NL3D::CMeshGeom::updateVertexBufferHard().

00473 { return(_VertexSize); }

sint NL3D::CVertexBuffer::getWeightOff sint  wgt  )  const [inline]
 

NB: it is ensured that WeightOff(i)==WeightOff(0)+i*sizeof(float).

Definition at line 343 of file vertex_buffer.h.

References nlassert, sint, and WeightFlag.

00343 {nlassert(_Flags & WeightFlag); return _Offset[Weight]+(wgt*sizeof(float));}

const void * NL3D::CVertexBuffer::getWeightPointer uint  idx = 0,
uint8  wgt = 0
const
 

Definition at line 628 of file vertex_buffer.cpp.

References _Verts, MaxWeight, nlassert, uint, uint8, and WeightFlag.

00629 {
00630         const uint8*    ptr;
00631 
00632         nlassert(wgt<MaxWeight);
00633         if( !(_Flags & WeightFlag))
00634                 return NULL;
00635 
00636         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00637         ptr+=_Offset[Weight]+wgt*sizeof(float);
00638 
00639         return ptr;
00640 }

void * NL3D::CVertexBuffer::getWeightPointer uint  idx = 0,
uint8  wgt = 0
 

Definition at line 513 of file vertex_buffer.cpp.

References _Verts, MaxWeight, nlassert, uint, uint8, and WeightFlag.

Referenced by NL3D::CMeshGeom::applySkin(), and serialOldV1Minus().

00514 {
00515         uint8*  ptr;
00516 
00517         nlassert(wgt<MaxWeight);
00518         if( !(_Flags & WeightFlag))
00519                 return NULL;
00520 
00521         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00522         ptr+=_Offset[Weight]+wgt*sizeof(float);
00523 
00524         return ptr;
00525 }

bool NL3D::CVertexBuffer::hasValueEx TValue  valueId  )  const
 

Test if the given value is present in the vertex buffer.

Definition at line 362 of file vertex_buffer.cpp.

00363 {
00364         return (_Flags & (1 << valueId)) != 0;
00365 }

void NL3D::CVertexBuffer::initEx  ) 
 

Init the vertex buffer in extended mode.

Definition at line 369 of file vertex_buffer.cpp.

References _InternalFlags, _NbVerts, _Verts, NumValue, SizeType, TouchedAll, uint, and value.

Referenced by NL3D::CMeshGeom::build(), NL3D::CMRMBuilder::buildMeshBuildMrm(), serialHeader(), NL3D::CVegetableVBAllocator::setupVBFormat(), NL3D::CLandscapeVBAllocator::setupVBFormatAndVertexProgram(), NL3D::CWaterShape::setupVertexBuffer(), and setVertexFormat().

00370 {
00371         // Reset internal flag
00372         _InternalFlags=TouchedAll;
00373 
00374         // Calc vertex size and set value's offset
00375         _VertexSize=0;
00376         for (uint value=0; value<NumValue; value++)
00377         {
00378                 // Value used ?
00379                 if (_Flags&(1<<value))
00380                 {
00381                         // Set offset
00382                         _Offset[value]=_VertexSize;
00383 
00384                         // New size
00385                         _VertexSize+=SizeType[_Type[value]];
00386                 }
00387         }
00388 
00389         // Reset number of vertices
00390         _NbVerts=0;
00391 
00392         // Compute new capacity
00393         if (_VertexSize)
00394                 _Capacity = _Verts.size()/_VertexSize;
00395         else
00396                 _Capacity = 0;
00397 }

CVertexBuffer & NL3D::CVertexBuffer::operator= const CVertexBuffer vb  ) 
 

Copy operator. Do not copy DrvInfos, copy all infos and set IDRV_VF_TOUCHED_ALL.

Definition at line 139 of file vertex_buffer.cpp.

References _Capacity, _Flags, _InternalFlags, _NbVerts, _Offset, _Type, _UVRouting, _VertexSize, _Verts, MaxStage, NumValue, TouchedAll, uint, and value.

Referenced by CVertexBuffer().

00140 {
00141         // Single value
00142         _VertexSize = vb._VertexSize;
00143         _Flags = vb._Flags;
00144         _InternalFlags = vb._InternalFlags;
00145         _NbVerts = vb._NbVerts;
00146         _Capacity = vb._Capacity;
00147         _Verts = vb._Verts;
00148 
00149         // Arraies
00150         for (uint value=0; value<NumValue; value++)
00151         {
00152                 _Offset[value]= vb._Offset[value];
00153                 _Type[value]= vb._Type[value];
00154         }
00155 
00156         // Copy the routing
00157         uint i;
00158         for (i=0; i<MaxStage; i++)
00159                 _UVRouting[i] = vb._UVRouting[i];
00160 
00161         // Set touch flags
00162         _InternalFlags |= TouchedAll;
00163 
00164         return *this;
00165 }

uint16 NL3D::CVertexBuffer::remapV2Flags uint32  oldFlags,
uint weightCount
[private]
 

Translate old flags.

Definition at line 660 of file vertex_buffer.cpp.

References NormalFlag, PaletteSkinFlag, PositionFlag, PrimaryColorFlag, SecondaryColorFlag, TexCoord0Flag, TexCoord1Flag, TexCoord2Flag, TexCoord3Flag, TexCoord4Flag, TexCoord5Flag, TexCoord6Flag, TexCoord7Flag, uint, uint16, uint32, and WeightFlag.

Referenced by serialHeader(), and serialOldV1Minus().

00661 {
00662         // Old flags
00663         const uint32 OLD_IDRV_VF_XYZ = 0x00000001;
00664         const uint32 OLD_IDRV_VF_W0 = 0x00000002;
00665         const uint32 OLD_IDRV_VF_W1 = 0x00000004;
00666         const uint32 OLD_IDRV_VF_W2 = 0x00000008;
00667         const uint32 OLD_IDRV_VF_W3 = 0x00000010;
00668         const uint32 OLD_IDRV_VF_NORMAL = 0x00000020;
00669         const uint32 OLD_IDRV_VF_COLOR = 0x00000040;
00670         const uint32 OLD_IDRV_VF_SPECULAR = 0x00000080;
00671         const uint32 OLD_IDRV_VF_UV0 = 0x00000100;
00672         const uint32 OLD_IDRV_VF_UV1 = 0x00000200;
00673         const uint32 OLD_IDRV_VF_UV2 = 0x00000400;
00674         const uint32 OLD_IDRV_VF_UV3 = 0x00000800;
00675         const uint32 OLD_IDRV_VF_UV4 = 0x00001000;
00676         const uint32 OLD_IDRV_VF_UV5 = 0x00002000;
00677         const uint32 OLD_IDRV_VF_UV6 = 0x00004000;
00678         const uint32 OLD_IDRV_VF_UV7 = 0x00008000;
00679         const uint32 OLD_IDRV_VF_PALETTE_SKIN = 0x00010000 | OLD_IDRV_VF_W0 | OLD_IDRV_VF_W1 | OLD_IDRV_VF_W2 | OLD_IDRV_VF_W3;
00680 
00681         // Old Flags
00682         uint16 newFlags=0;
00683 
00684         // Number of weight values
00685         weightCount=0;
00686 
00687         // Remap the flags
00688         if (oldFlags&OLD_IDRV_VF_XYZ)
00689                 newFlags|=PositionFlag;
00690         if (oldFlags&OLD_IDRV_VF_NORMAL)
00691                 newFlags|=NormalFlag;
00692         if (oldFlags&OLD_IDRV_VF_COLOR)
00693                 newFlags|=PrimaryColorFlag;
00694         if (oldFlags&OLD_IDRV_VF_SPECULAR)
00695                 newFlags|=SecondaryColorFlag;
00696         if (oldFlags&OLD_IDRV_VF_UV0)
00697                 newFlags|=TexCoord0Flag;
00698         if (oldFlags&OLD_IDRV_VF_UV1)
00699                 newFlags|=TexCoord1Flag;
00700         if (oldFlags&OLD_IDRV_VF_UV2)
00701                 newFlags|=TexCoord2Flag;
00702         if (oldFlags&OLD_IDRV_VF_UV3)
00703                 newFlags|=TexCoord3Flag;
00704         if (oldFlags&OLD_IDRV_VF_UV4)
00705                 newFlags|=TexCoord4Flag;
00706         if (oldFlags&OLD_IDRV_VF_UV5)
00707                 newFlags|=TexCoord5Flag;
00708         if (oldFlags&OLD_IDRV_VF_UV6)
00709                 newFlags|=TexCoord6Flag;
00710         if (oldFlags&OLD_IDRV_VF_UV7)
00711                 newFlags|=TexCoord7Flag;
00712         if (oldFlags&OLD_IDRV_VF_W0)
00713         {
00714                 weightCount=1;
00715                 newFlags|=WeightFlag;
00716         }
00717         if (oldFlags&OLD_IDRV_VF_W1)
00718         {
00719                 weightCount=2;
00720                 newFlags|=WeightFlag;
00721         }
00722         if (oldFlags&OLD_IDRV_VF_W2)
00723         {
00724                 weightCount=3;
00725                 newFlags|=WeightFlag;
00726         }
00727         if (oldFlags&OLD_IDRV_VF_W3)
00728         {
00729                 weightCount=4;
00730                 newFlags|=WeightFlag;
00731         }
00732         if (oldFlags&(OLD_IDRV_VF_PALETTE_SKIN))
00733                 newFlags|=PaletteSkinFlag;
00734 
00735         // Return the new flags
00736         return newFlags;
00737 }

void NL3D::CVertexBuffer::reserve uint32  nVerts  ) 
 

Reserve space for nVerts vertices. You are allowed to write your vertices on this space.

Definition at line 401 of file vertex_buffer.cpp.

References _Verts, and uint32.

Referenced by NL3D::CMeshMRMGeom::build(), NL3D::CMeshGeom::build(), serialHeader(), serialOldV1Minus(), and setNumVertices().

00402 {
00403         _Verts.resize(n*_VertexSize);
00404         _Capacity= n;
00405 }

void NL3D::CVertexBuffer::resetTouchFlags  )  [inline]
 

Definition at line 266 of file vertex_buffer.h.

References _InternalFlags, and TouchedAll.

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

void NL3D::CVertexBuffer::serial NLMISC::IStream f  ) 
 

Definition at line 854 of file vertex_buffer.cpp.

References _NbVerts, serialHeader(), serialOldV1Minus(), serialSubset(), NLMISC::IStream::serialVersion(), and sint.

00855 {
00856         /*
00857         Version 2:
00858                 - cut to use serialHeader() serialSubset().
00859         Version 1:
00860                 - PaletteSkin version.
00861         Version 0:
00862                 - base verison.
00863         */
00864         sint    ver= f.serialVersion(2);
00865 
00866         if (ver<2)
00867         {
00868                 // old serial method
00869                 serialOldV1Minus(f, ver);
00870         }
00871         else
00872         {
00873                 // read write the header of the VBuffer.
00874                 serialHeader(f);
00875 
00876                 // read write the entire subset.
00877                 serialSubset(f, 0, _NbVerts);
00878         }
00879 }

void NL3D::CVertexBuffer::serialHeader NLMISC::IStream f  ) 
 

just read/write the VertexFormat of the VB, number of vertices .... If read, VB is resized to numVertices.

Definition at line 883 of file vertex_buffer.cpp.

References _NbVerts, addValueEx(), clearValueEx(), DefaultValueType, Float1, Float2, Float3, Float4, initEx(), NLMISC::IStream::isReading(), nlassert, NumValue, remapV2Flags(), reserve(), NLMISC::IStream::serial(), NLMISC::IStream::serialVersion(), setNumVertices(), sint, TValue, uint, uint16, and uint32.

Referenced by serial().

00884 {
00885         /*
00886         Version 1:
00887                 - Extended vertex format management.
00888         Version 0:
00889                 - base verison of the header serialisation.
00890         */
00891         sint    ver= f.serialVersion(1);
00892 
00893         // Serial VBuffers format/size.
00894         //=============================
00895 
00896         // Flags
00897         uint16 flags=_Flags;
00898 
00899         if (ver<1)
00900         {
00901                 // Must be reading
00902                 nlassert (f.isReading());
00903 
00904                 // Serial old flags
00905                 uint32 oldFlags;
00906                 f.serial(oldFlags);
00907 
00908                 // Remap flags
00909                 uint weightCount;
00910                 flags=remapV2Flags (oldFlags, weightCount);
00911 
00912                 // Set default value type
00913                 for (uint i=0; i<NumValue; i++)
00914                         _Type[i]=DefaultValueType[i];
00915 
00916                 // weight count ?
00917                 switch (weightCount)
00918                 {
00919                 case 1:
00920                         _Type[Weight]=Float1;
00921                         break;
00922                 case 2:
00923                         _Type[Weight]=Float2;
00924                         break;
00925                 case 3:
00926                         _Type[Weight]=Float3;
00927                         break;
00928                 case 4:
00929                         _Type[Weight]=Float4;
00930                         break;
00931                 }
00932         }
00933         else
00934         {
00935                 // Serial new vertex flags
00936                 f.serial(flags);
00937 
00938                 // Serial type of values
00939                 for (uint i=0; i<NumValue; i++)
00940                         f.serial (_Type[i]);
00941         }
00942 
00943         // Serial nb vertices
00944         uint32 nbVerts=_NbVerts;
00945         f.serial(nbVerts);
00946 
00947         if(f.isReading())
00948         {
00949                 reserve(0);
00950 
00951                 // Init vertex format setup
00952                 clearValueEx ();
00953 
00954                 // Init vertex format
00955                 for (uint i=0; i<NumValue; i++)
00956                 {
00957                         // Setup this value ?
00958                         if (flags&(1<<i))
00959                         {
00960                                 // Add a value
00961                                 addValueEx ((TValue)i, (TType)_Type[i]);
00962                         }
00963                 }
00964 
00965                 // Build final vertex format
00966                 initEx ();
00967 
00968                 // Set num of vertices
00969                 setNumVertices(nbVerts);
00970         }
00971         // All other infos (but _Verts) are computed by initEx() and setNumVertices().
00972 }

void NL3D::CVertexBuffer::serialOldV1Minus NLMISC::IStream f,
sint  ver
[private]
 

Old version serialisation. V0 and V1.

Definition at line 741 of file vertex_buffer.cpp.

References _InternalFlags, _NbVerts, DefaultValueType, Float1, Float2, Float3, Float4, getColorPointer(), getNormalCoordPointer(), getPaletteSkinPointer(), getSpecularPointer(), getTexCoordPointer(), getVertexCoordPointer(), getWeightPointer(), NLMISC::IStream::isReading(), MaxStage, nlassert, NormalFlag, NumValue, PaletteSkinFlag, PositionFlag, PrimaryColorFlag, remapV2Flags(), reserve(), SecondaryColorFlag, NLMISC::IStream::serial(), setNumVertices(), setVertexFormat(), sint, TexCoord0Flag, TouchedAll, uint, uint16, uint32, and w.

Referenced by serial().

00742 {
00743         /*
00744         Version 1:
00745                 - PaletteSkin version.
00746         Version 0:
00747                 - base verison.
00748         */
00749 
00750         // old Flags
00751         uint32 oldFlags;
00752 
00753         // Serial VBuffers format/size.
00754         //=============================
00755         f.serial(oldFlags);
00756 
00757         // Remap the flags
00758         uint weightCount;
00759         uint16 newFlags=remapV2Flags (oldFlags, weightCount);
00760 
00761         // Must be reading
00762         nlassert (f.isReading());
00763 
00764         // Set default value type
00765         uint i;
00766         for (i=0; i<NumValue; i++)
00767                 _Type[i]=DefaultValueType[i];
00768 
00769         uint32 nbVert;  // Read only
00770         f.serial(nbVert);
00771         reserve(0);
00772         setVertexFormat(newFlags);
00773         setNumVertices(nbVert);
00774         // All other infos (but _Verts) are computed by setVertexFormat() and setNumVertices().
00775 
00776         // Weight count ?
00777         switch (weightCount)
00778         {
00779         case 1:
00780                 _Type[Weight]=Float1;
00781                 break;
00782         case 2:
00783                 _Type[Weight]=Float2;
00784                 break;
00785         case 3:
00786                 _Type[Weight]=Float3;
00787                 break;
00788         case 4:
00789                 _Type[Weight]=Float4;
00790                 break;
00791         }
00792 
00793         // Serial VBuffers components.
00794         //============================
00795         for(sint id=0;id<(sint)_NbVerts;id++)
00796         {
00797                 // XYZ.
00798                 if(_Flags & PositionFlag)
00799                 {
00800                         CVector         &vert= *(CVector*)getVertexCoordPointer(id);
00801                         f.serial(vert);
00802                 }
00803                 // Normal
00804                 if(_Flags & NormalFlag)
00805                 {
00806                         CVector         &norm= *(CVector*)getNormalCoordPointer(id);
00807                         f.serial(norm);
00808                 }
00809                 // Uvs.
00810                 for(i=0;i<MaxStage;i++)
00811                 {
00812                         if(_Flags & (TexCoord0Flag<<i))
00813                         {
00814                                 CUV             &uv= *(CUV*)getTexCoordPointer(id, i);
00815                                 f.serial(uv);
00816                         }
00817                 }
00818                 // Color.
00819                 if(_Flags & PrimaryColorFlag)
00820                 {
00821                         CRGBA           &col= *(CRGBA*)getColorPointer(id);
00822                         f.serial(col);
00823                 }
00824                 // Specular.
00825                 if(_Flags & SecondaryColorFlag)
00826                 {
00827                         CRGBA           &col= *(CRGBA*)getSpecularPointer(id);
00828                         f.serial(col);
00829                 }
00830                 // Weights
00831                 for(i=0;i<weightCount;i++)
00832                 {
00833                         // Weight channel available ?
00834                         float   &w= *(float*)getWeightPointer(id, i);
00835                         f.serial(w);
00836                 }
00837                 // CPaletteSkin (version 1+ only).
00838                 if((ver>=1) && ((_Flags & PaletteSkinFlag) == CVertexBuffer::PaletteSkinFlag) )
00839                 {
00840                         CPaletteSkin    &ps= *(CPaletteSkin*)getPaletteSkinPointer(id);
00841                         f.serial(ps);
00842                 }
00843 
00844         }
00845 
00846         // Set touch flags
00847         _InternalFlags = 0;
00848         if(f.isReading())
00849                 _InternalFlags |= TouchedAll;
00850 }

void NL3D::CVertexBuffer::serialSubset NLMISC::IStream f,
uint  vertexStart,
uint  vertexEnd
 

just read/write a subset of the vertex buffer. NB: because a version is serialised by subset, you must read same subset of vertices you have saved. (can't write 0-10, 10-20, and after load 0-5, 5-20).

Definition at line 1008 of file vertex_buffer.cpp.

References _InternalFlags, _NbVerts, _UVRouting, getValueEx(), NLMISC::IStream::isReading(), MaxStage, nlassert, NumValue, NLMISC::IStream::serialBuffer(), NLMISC::IStream::serialVersion(), sint, SizeType, TouchedAll, TValue, uint, uint8, and value.

Referenced by serial(), and NL3D::CMeshMRMGeom::serialLodVertexData().

01009 {
01010         /*
01011         Version 1:
01012                 - weight is 4 float in standard format.
01013         Version 0:
01014                 - base verison of a vbuffer subset serialisation.
01015         */
01016         sint ver = f.serialVersion(2);
01017 
01018 
01019         // Serial VBuffers components.
01020         //============================
01021         nlassert(vertexStart<_NbVerts || _NbVerts==0);
01022         nlassert(vertexEnd<=_NbVerts);
01023         for(uint id=vertexStart; id<vertexEnd; id++)
01024         {
01025                 // For each value
01026                 for (uint value=0; value<NumValue; value++)
01027                 {
01028                         // Value used ?
01029                         if (_Flags&(1<<value))
01030                         {
01031                                 // Get the pointer on it
01032                                 void *ptr=getValueEx ((TValue)value, id);
01033                                 f.serialBuffer ((uint8*)ptr, SizeType[_Type[value]]);
01034                         }
01035                 }
01036         }
01037 
01038         // Serial the UV Routing table
01039         //============================
01040         if (ver>=2)
01041         {
01042                 f.serialBuffer (_UVRouting, sizeof(uint8)*MaxStage);
01043         }
01044         else
01045         {
01046                 // Reset the table
01047                 uint i;
01048                 for (i=0; i<MaxStage; i++)
01049                         _UVRouting[i] = i;
01050         }
01051 
01052         // Set touch flags
01053         if(f.isReading())
01054                 _InternalFlags |= TouchedAll;
01055 }

void NL3D::CVertexBuffer::setColor uint  idx,
CRGBA  rgba
[inline]
 

Definition at line 568 of file vertex_buffer.h.

References _Verts, nlassert, PrimaryColor, PrimaryColorFlag, UChar4, uint, and uint8.

Referenced by NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::CDriverUser::drawLine(), NL3D::CDRU::drawQuad(), NL3D::CDriverUser::drawQuad(), NL3D::CDriverUser::drawTriangle(), NL3D::CMeshGeom::findVBId(), NL3D::CPSFanLight::getVBnIB(), NL3D::CPSTailDot::getVBnPB(), and NL3D::CPSRibbon::getVBnPB().

00569 {
00570         uint8*  ptr;
00571         CRGBA   *pCol;
00572 
00573         nlassert(_Flags & PrimaryColorFlag);
00574         nlassert (_Type[PrimaryColor]==UChar4);
00575 
00576         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00577         ptr+=_Offset[PrimaryColor];
00578         pCol= (CRGBA*)ptr;
00579         *pCol= rgba;
00580 }

void NL3D::CVertexBuffer::setNormalCoord uint  idx,
const CVector v
[inline]
 

Definition at line 554 of file vertex_buffer.h.

References _Verts, Float3, nlassert, NormalFlag, uint, uint8, and v.

Referenced by NL3D::CMRMBuilder::buildMeshBuildMrm(), and NL3D::CMeshGeom::findVBId().

00555 {
00556         uint8*  ptr;
00557 
00558         nlassert (_Flags & NormalFlag);
00559         nlassert (_Type[Normal]==Float3);
00560 
00561         ptr=&_Verts[idx*_VertexSize];
00562         ptr+=_Offset[Normal];
00563         memcpy(ptr, &(v.x), 3*sizeof(float));
00564 }

void NL3D::CVertexBuffer::setNumVertices uint32  n  ) 
 

Set the number of active vertices. It enlarge capacity, if needed.

Definition at line 409 of file vertex_buffer.cpp.

References _InternalFlags, _NbVerts, reserve(), TouchedNumVertices, and uint32.

Referenced by NL3D::CShadowPolyReceiver::allocateVertex(), NL3D::CLandscapeVBAllocator::allocateVertexBuffer(), NL3D::CVegetableVBAllocator::allocateVertexBufferAndFillVBHard(), NL3D::CVegetableShape::build(), NL3D::CMeshMRMGeom::build(), NL3D::CMeshGeom::build(), NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildVB(), NL3D::CCloudScape::CCloudScape(), NL3D::CDriverUser::CDriverUser(), NL3D::CFontManager::computeString(), NL3D::CMeshInstance::createShadowMap(), NL3D::CShadowMapManager::CShadowMapManager(), NL3D::CPSUtil::displayArrow(), NL3D::CPSUtil::displayBBox(), NL3D::CInstanceGroup::displayDebugClusters(), NL3D::CDeform2d::doDeform(), NL3D::CWaterModel::doSimpleRender(), NL3D::CDRU::drawBitmap(), NL3D::CDRU::drawLine(), NL3D::CDRU::drawLinesUnlit(), NL3D::CDRU::drawQuad(), NL3D::CDriverUser::drawQuads(), NL3D::CDRU::drawTriangle(), NL3D::CDRU::drawTrianglesUnlit(), NL3D::CShadowMapManager::fillBlackBorder(), NL3D::CMeshGeom::findVBId(), NL3D::CPSFanLight::getVBnIB(), NL3D::CPSTailDot::getVBnPB(), NL3D::CPSShockWave::getVBnPB(), NL3D::CPSRibbonLookAt::getVBnPB(), NL3D::CPSRibbon::getVBnPB(), NL3D::CMeshMRMSkinnedGeom::getVertexBuffer(), NL3D::CVertexStreamManager::init(), NL3D::CVertexBufferHeap::init(), NL3D::CPSConstraintMesh::initPrerotVB(), NL3D::CPSQuad::initVertexBuffers(), NL3D::CPSDot::initVertexBuffers(), NL3D::CMotionBlur::performMotionBlur(), NL3D::CNoise3d::render(), NL3D::CComputedString::render2DClip(), NL3D::CComputedString::render2DUnProjected(), NL3D::CNoise3d::render2passes(), NL3D::CNoise3d::renderGrid(), NL3D::CNoise3d::renderGrid2passes(), serialHeader(), serialOldV1Minus(), NL3D::CSegRemanenceShape::setupVBnPB(), NL3D::CWaterShape::setupVertexBuffer(), NL3D::CPSGravity::show(), NL3D::CDriverGL::swapBuffers(), and NL3D::CFlareModel::traverseRender().

00410 {
00411         if(_Capacity<n)
00412         {
00413                 reserve(n);
00414         }
00415         if(_NbVerts != n)
00416         {
00417                 _InternalFlags |= TouchedNumVertices;
00418                 _NbVerts=n;
00419         }
00420 }

void NL3D::CVertexBuffer::setPaletteSkin uint  idx,
CPaletteSkin  ps
[inline]
 

Definition at line 653 of file vertex_buffer.h.

References _Verts, nlassert, PaletteSkin, PaletteSkinFlag, UChar4, uint, and uint8.

Referenced by NL3D::CMeshGeom::findVBId().

00654 {
00655         uint8*  ptr;
00656         CPaletteSkin    *pPalSkin;
00657 
00658         nlassert ( (_Flags & PaletteSkinFlag) == CVertexBuffer::PaletteSkinFlag);
00659         nlassert (_Type[PaletteSkin]==UChar4);
00660 
00661         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00662         ptr+=_Offset[PaletteSkin];
00663         pPalSkin= (CPaletteSkin*)ptr;
00664         *pPalSkin= ps;
00665 }

void NL3D::CVertexBuffer::setSpecular uint  idx,
CRGBA  rgba
[inline]
 

Definition at line 584 of file vertex_buffer.h.

References _Verts, nlassert, SecondaryColor, SecondaryColorFlag, UChar4, uint, and uint8.

Referenced by NL3D::CMRMBuilder::buildMeshBuildMrm(), and NL3D::CMeshGeom::findVBId().

00585 {
00586         uint8*  ptr;
00587         CRGBA   *pCol;
00588 
00589         nlassert(_Flags & SecondaryColorFlag);
00590         nlassert (_Type[SecondaryColor]==UChar4);
00591 
00592         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00593         ptr+=_Offset[SecondaryColor];
00594         pCol= (CRGBA*)ptr;
00595         *pCol= rgba;
00596 }

void NL3D::CVertexBuffer::setTexCoord uint  idx,
uint8  stage,
const CUV uv
[inline]
 

Definition at line 619 of file vertex_buffer.h.

References _Verts, Float2, MaxStage, nlassert, TexCoord0, TexCoord0Flag, uint, and uint8.

00620 {
00621         uint8*  ptr;
00622         CUV*    ptruv;
00623 
00624         nlassert(stage<MaxStage);
00625         nlassert(_Flags & (TexCoord0Flag<<stage));
00626         nlassert (_Type[TexCoord0+stage]==Float2);
00627 
00628         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00629         ptr+=_Offset[TexCoord0+stage];
00630         ptruv=(CUV*)ptr;
00631         *ptruv=uv;
00632 }

void NL3D::CVertexBuffer::setTexCoord uint  idx,
uint8  stage,
float  u,
float  v
[inline]
 

Definition at line 600 of file vertex_buffer.h.

References _Verts, Float2, MaxStage, nlassert, TexCoord0, TexCoord0Flag, uint, uint8, and v.

Referenced by NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::CFontManager::computeString(), NL3D::CCloud::disp(), NL3D::CDeform2d::doDeform(), NL3D::CDRU::drawBitmap(), NL3D::CDriverUser::drawLine(), NL3D::CDriverUser::drawQuad(), NL3D::CDriverUser::drawTriangle(), NL3D::CDRU::drawTrianglesUnlit(), NL3D::CMeshGeom::findVBId(), NL3D::CPSFanLight::getVBnIB(), NL3D::CPSTailDot::getVBnPB(), NL3D::CPSShockWave::getVBnPB(), NL3D::CPSRibbonLookAt::getVBnPB(), NL3D::CPSRibbon::getVBnPB(), NL3D::CMotionBlur::performMotionBlur(), NL3D::CShadowMapManager::setBlurQuadFakeGaussian(), NL3D::SetupQuadVBTexCoords(), NL3D::CSegRemanenceShape::setupVBnPB(), and NL3D::CFlareModel::traverseRender().

00601 {
00602         uint8*  ptr;
00603         float*  ptrf;
00604 
00605         nlassert(stage<MaxStage);
00606         nlassert(_Flags & (TexCoord0Flag<<stage));
00607         nlassert (_Type[TexCoord0+stage]==Float2);
00608 
00609         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00610         ptr+=_Offset[TexCoord0+stage];
00611         ptrf=(float*)ptr;
00612         *ptrf=u;
00613         ptrf++;
00614         *ptrf=v;
00615 }

void NL3D::CVertexBuffer::setUVRouting uint8  uvChannel,
uint  newUVRouting
[inline]
 

Definition at line 505 of file vertex_buffer.h.

References _UVRouting, uint, and uint8.

Referenced by NL3D::CMeshGeom::build(), NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildVB(), and NL3D::CVertexStreamManager::init().

00505 { _UVRouting[uvChannel] = newUVRouting; }

void NL3D::CVertexBuffer::setValueDouble1Ex TValue  valueId,
uint  idx,
double  value
[inline]
 

Setup values. nlassert are raised if wrong value type is setuped.

Definition at line 669 of file vertex_buffer.h.

References _Verts, Double1, Double2, Double3, Double4, nlassert, NumValue, uint, uint8, and value.

00670 {
00671         uint8*  ptr;
00672         double* ptrd;
00673 
00674         nlassert(valueId<NumValue);
00675         nlassert(_Flags & (1<<(uint)valueId));
00676         nlassert((_Type[valueId]==Double4)||(_Type[valueId]==Double3)||(_Type[valueId]==Double2)||(_Type[valueId]==Double1));
00677 
00678         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00679         ptr+=_Offset[valueId];
00680         ptrd=(double*)ptr;
00681         *ptrd=value;
00682 }

void NL3D::CVertexBuffer::setValueDouble2Ex TValue  valueId,
uint  idx,
double  x,
double  y
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 686 of file vertex_buffer.h.

References _Verts, Double2, Double3, Double4, nlassert, NumValue, uint, uint8, x, and y.

00687 {
00688         uint8*  ptr;
00689         double* ptrd;
00690 
00691         nlassert(valueId<NumValue);
00692         nlassert(_Flags & (1<<(uint)valueId));
00693         nlassert((_Type[valueId]==Double4)||(_Type[valueId]==Double3)||(_Type[valueId]==Double2));
00694 
00695         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00696         ptr+=_Offset[valueId];
00697         ptrd=(double*)ptr;
00698         ptrd[0]=x;
00699         ptrd[1]=y;
00700 }

void NL3D::CVertexBuffer::setValueDouble3Ex TValue  valueId,
uint  idx,
const CVectorD vector
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 723 of file vertex_buffer.h.

References _Verts, Double3, Double4, nlassert, NumValue, uint, and uint8.

00724 {
00725         uint8*  ptr;
00726         double* ptrd;
00727 
00728         nlassert(valueId<NumValue);
00729         nlassert(_Flags & (1<<(uint)valueId));
00730         nlassert((_Type[valueId]==Double4)||(_Type[valueId]==Double3));
00731 
00732         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00733         ptr+=_Offset[valueId];
00734         ptrd=(double*)ptr;
00735         memcpy (ptrd, &vector, sizeof(double)*3);
00736 }

void NL3D::CVertexBuffer::setValueDouble3Ex TValue  valueId,
uint  idx,
double  x,
double  y,
double  z
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 704 of file vertex_buffer.h.

References _Verts, Double3, Double4, nlassert, NumValue, uint, uint8, x, y, and z.

00705 {
00706         uint8*  ptr;
00707         double* ptrd;
00708 
00709         nlassert(valueId<NumValue);
00710         nlassert(_Flags & (1<<(uint)valueId));
00711         nlassert((_Type[valueId]==Double4)||(_Type[valueId]==Double3));
00712 
00713         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00714         ptr+=_Offset[valueId];
00715         ptrd=(double*)ptr;
00716         ptrd[0]=x;
00717         ptrd[1]=y;
00718         ptrd[2]=z;
00719 }

void NL3D::CVertexBuffer::setValueDouble4Ex TValue  valueId,
uint  idx,
double  x,
double  y,
double  z,
double  w
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 740 of file vertex_buffer.h.

References _Verts, Double4, nlassert, NumValue, uint, uint8, w, x, y, and z.

00741 {
00742         uint8*  ptr;
00743         double* ptrd;
00744 
00745         nlassert(valueId<NumValue);
00746         nlassert(_Flags & (1<<(uint)valueId));
00747         nlassert(_Type[valueId]==Double4);
00748 
00749         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00750         ptr+=_Offset[valueId];
00751         ptrd=(double*)ptr;
00752         ptrd[0]=x;
00753         ptrd[1]=y;
00754         ptrd[2]=z;
00755         ptrd[3]=w;
00756 }

void NL3D::CVertexBuffer::setValueFloat1Ex TValue  valueId,
uint  idx,
float  value
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 760 of file vertex_buffer.h.

References _Verts, Float1, Float2, Float3, Float4, nlassert, NumValue, uint, uint8, and value.

00761 {
00762         uint8*  ptr;
00763         float*  ptrf;
00764 
00765         nlassert(valueId<NumValue);
00766         nlassert(_Flags & (1<<(uint)valueId));
00767         nlassert((_Type[valueId]==Float4)||(_Type[valueId]==Float3)||(_Type[valueId]==Float2)||(_Type[valueId]==Float1));
00768 
00769         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00770         ptr+=_Offset[valueId];
00771         ptrf=(float*)ptr;
00772         *ptrf=value;
00773 }

void NL3D::CVertexBuffer::setValueFloat2Ex TValue  valueId,
uint  idx,
float  x,
float  y
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 777 of file vertex_buffer.h.

References _Verts, Float2, Float3, Float4, nlassert, NumValue, uint, uint8, x, and y.

Referenced by NL3D::DrawPoly2D().

00778 {
00779         uint8*  ptr;
00780         float*  ptrf;
00781 
00782         nlassert(valueId<NumValue);
00783         nlassert(_Flags & (1<<(uint)valueId));
00784         nlassert((_Type[valueId]==Float4)||(_Type[valueId]==Float3)||(_Type[valueId]==Float2));
00785 
00786         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00787         ptr+=_Offset[valueId];
00788         ptrf=(float*)ptr;
00789         ptrf[0]=x;
00790         ptrf[1]=y;
00791 }

void NL3D::CVertexBuffer::setValueFloat3Ex TValue  valueId,
uint  idx,
const CVector vector
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 814 of file vertex_buffer.h.

References _Verts, Float3, Float4, nlassert, NumValue, uint, and uint8.

00815 {
00816         uint8*  ptr;
00817         float*  ptrf;
00818 
00819         nlassert(valueId<NumValue);
00820         nlassert(_Flags & (1<<(uint)valueId));
00821         nlassert((_Type[valueId]==Float4)||(_Type[valueId]==Float3));
00822 
00823         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00824         ptr+=_Offset[valueId];
00825         ptrf=(float*)ptr;
00826         memcpy (ptrf, &vector, sizeof(float)*3);
00827 }

void NL3D::CVertexBuffer::setValueFloat3Ex TValue  valueId,
uint  idx,
float  x,
float  y,
float  z
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 795 of file vertex_buffer.h.

References _Verts, Float3, Float4, nlassert, NumValue, uint, uint8, x, y, and z.

Referenced by NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::DrawPoly2D(), and NL3D::CMeshGeom::findVBId().

00796 {
00797         uint8*  ptr;
00798         float*  ptrf;
00799 
00800         nlassert(valueId<NumValue);
00801         nlassert(_Flags & (1<<(uint)valueId));
00802         nlassert((_Type[valueId]==Float4)||(_Type[valueId]==Float3));
00803 
00804         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00805         ptr+=_Offset[valueId];
00806         ptrf=(float*)ptr;
00807         ptrf[0]=x;
00808         ptrf[1]=y;
00809         ptrf[2]=z;
00810 }

void NL3D::CVertexBuffer::setValueFloat4Ex TValue  valueId,
uint  idx,
float  x,
float  y,
float  z,
float  w
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 831 of file vertex_buffer.h.

References _Verts, Float4, nlassert, NumValue, uint, uint8, w, x, y, and z.

00832 {
00833         uint8*  ptr;
00834         float*  ptrf;
00835 
00836         nlassert(valueId<NumValue);
00837         nlassert(_Flags & (1<<(uint)valueId));
00838         nlassert(_Type[valueId]==Float4);
00839 
00840         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00841         ptr+=_Offset[valueId];
00842         ptrf=(float*)ptr;
00843         ptrf[0]=x;
00844         ptrf[1]=y;
00845         ptrf[2]=z;
00846         ptrf[3]=w;
00847 }

void NL3D::CVertexBuffer::setValueShort1Ex TValue  valueId,
uint  idx,
uint16  value
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 851 of file vertex_buffer.h.

References _Verts, nlassert, NumValue, Short1, Short2, Short3, Short4, uint, uint16, uint8, and value.

00852 {
00853         uint8*  ptr;
00854         uint16* ptri;
00855 
00856         nlassert(valueId<NumValue);
00857         nlassert(_Flags & (1<<(uint)valueId));
00858         nlassert((_Type[valueId]==Short4)||(_Type[valueId]==Short3)||(_Type[valueId]==Short2)||(_Type[valueId]==Short1));
00859 
00860         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00861         ptr+=_Offset[valueId];
00862         ptri=(uint16*)ptr;
00863         *ptri=value;
00864 }

void NL3D::CVertexBuffer::setValueShort2Ex TValue  valueId,
uint  idx,
uint16  x,
uint16  y
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 868 of file vertex_buffer.h.

References _Verts, nlassert, NumValue, Short2, Short3, Short4, uint, uint16, uint8, x, and y.

00869 {
00870         uint8*  ptr;
00871         uint16* ptri;
00872 
00873         nlassert(valueId<NumValue);
00874         nlassert(_Flags & (1<<(uint)valueId));
00875         nlassert((_Type[valueId]==Short4)||(_Type[valueId]==Short3)||(_Type[valueId]==Short2));
00876 
00877         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00878         ptr+=_Offset[valueId];
00879         ptri=(uint16*)ptr;
00880         ptri[0]=x;
00881         ptri[1]=y;
00882 }

void NL3D::CVertexBuffer::setValueShort3Ex TValue  valueId,
uint  idx,
uint16  x,
uint16  y,
uint16  z
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 886 of file vertex_buffer.h.

References _Verts, nlassert, NumValue, Short3, Short4, uint, uint16, uint8, x, y, and z.

00887 {
00888         uint8*  ptr;
00889         uint16* ptri;
00890 
00891         nlassert(valueId<NumValue);
00892         nlassert(_Flags & (1<<(uint)valueId));
00893         nlassert((_Type[valueId]==Short4)||(_Type[valueId]==Short3));
00894 
00895         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00896         ptr+=_Offset[valueId];
00897         ptri=(uint16*)ptr;
00898         ptri[0]=x;
00899         ptri[1]=y;
00900         ptri[2]=z;
00901 }

void NL3D::CVertexBuffer::setValueShort4Ex TValue  valueId,
uint  idx,
uint16  x,
uint16  y,
uint16  z,
uint16  w
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 905 of file vertex_buffer.h.

References _Verts, nlassert, NumValue, Short4, uint, uint16, uint8, w, x, y, and z.

00906 {
00907         uint8*  ptr;
00908         uint16* ptri;
00909 
00910         nlassert(valueId<NumValue);
00911         nlassert(_Flags & (1<<(uint)valueId));
00912         nlassert(_Type[valueId]==Short4);
00913 
00914         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00915         ptr+=_Offset[valueId];
00916         ptri=(uint16*)ptr;
00917         ptri[0]=x;
00918         ptri[1]=y;
00919         ptri[2]=z;
00920         ptri[3]=w;
00921 }

void NL3D::CVertexBuffer::setValueUChar4Ex TValue  valueId,
uint  idx,
CRGBA  rgba
[inline]
 

Add a value in the vertex buffer. After this call, call initEx() to init the vertex buffer.

Parameters:
valueId is the value id to setup.
type is the type used for this value.

Definition at line 925 of file vertex_buffer.h.

References _Verts, nlassert, NumValue, UChar4, uint, and uint8.

00926 {
00927         uint8*  ptr;
00928         CRGBA*  ptrr;
00929 
00930         nlassert(valueId<NumValue);
00931         nlassert(_Flags & (1<<(uint)valueId));
00932         nlassert(_Type[valueId]==UChar4);
00933 
00934         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00935         ptr+=_Offset[valueId];
00936         ptrr=(CRGBA*)ptr;
00937         *ptrr=rgba;
00938 }

void NL3D::CVertexBuffer::setVertexCoord uint  idx,
const CVector v
[inline]
 

Definition at line 541 of file vertex_buffer.h.

References _Verts, Float3, nlassert, PositionFlag, uint, uint8, and v.

00542 {
00543         uint8*  ptr;
00544 
00545         nlassert (_Flags & PositionFlag);
00546         nlassert (_Type[Position]==Float3);
00547 
00548         ptr=&_Verts[idx*_VertexSize];
00549         memcpy(ptr, &(v.x), 3*sizeof(float));
00550 }

void NL3D::CVertexBuffer::setVertexCoord uint  idx,
float  x,
float  y,
float  z
[inline]
 

Definition at line 524 of file vertex_buffer.h.

References _Verts, Float3, nlassert, PositionFlag, uint, x, y, and z.

Referenced by NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::CFontManager::computeString(), NL3D::CMeshInstance::createShadowMap(), NL3D::CCloud::disp(), NL3D::CPSUtil::displayArrow(), NL3D::CPSUtil::displayBBox(), NL3D::CInstanceGroup::displayDebugClusters(), NL3D::CDeform2d::doDeform(), NL3D::CDRU::drawBitmap(), NL3D::CDRU::drawLine(), NL3D::CDriverUser::drawLine(), NL3D::CDRU::drawLinesUnlit(), NL3D::CDRU::drawQuad(), NL3D::CDriverUser::drawQuad(), NL3D::CDRU::drawTriangle(), NL3D::CDriverUser::drawTriangle(), NL3D::CDRU::drawTrianglesUnlit(), NL3D::CMeshGeom::findVBId(), NL3D::CMotionBlur::performMotionBlur(), NL3D::CShadowPolyReceiver::render(), NL3D::CShadowMapManager::setBlackQuad(), NL3D::CShadowMapManager::setBlurQuadFakeGaussian(), NL3D::CPSGravity::show(), and NL3D::CFlareModel::traverseRender().

00525 {
00526         float*  ptr;
00527 
00528         nlassert (_Flags & PositionFlag);
00529         nlassert (_Type[Position]==Float3);
00530 
00531         ptr=(float*)(&_Verts[idx*_VertexSize]);
00532         *ptr=x;
00533         ptr++;
00534         *ptr=y;
00535         ptr++;
00536         *ptr=z;
00537 }

bool NL3D::CVertexBuffer::setVertexFormat uint32  Flags  ) 
 

Setup the vertex format using standard values. Do it before any other standard methods.

Use one or several flag between : PositionFlag, WeightFlag, NormalFlag, PrimaryColorFlag, SecondaryColorFlag, FogFlag, TexCoord0Flag, TexCoord1Flag, TexCoord2Flag, TexCoord3Flag, TexCoord4Flag, TexCoord5Flag, TexCoord6Flag, TexCoord7Flag, PaletteSkinFlag

If WeightFlag is specified, 4 float are used to setup the skinning value on 4 bones.

Definition at line 169 of file vertex_buffer.cpp.

References addValueEx(), clearValueEx(), Float1, Float2, Float3, Float4, Fog, FogFlag, initEx(), MaxStage, NormalFlag, PaletteSkin, PaletteSkinFlag, PositionFlag, PrimaryColor, PrimaryColorFlag, SecondaryColor, SecondaryColorFlag, TexCoord0, TexCoord0Flag, TValue, UChar4, uint, uint32, and WeightFlag.

Referenced by NL3D::CLodCharacterManager::beginRender(), NL3D::CVegetableShape::build(), NL3D::CMeshGeom::build(), NL3D::CMRMBuilder::buildMeshBuildMrm(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildVB(), NL3D::CCloudScape::CCloudScape(), NL3D::CComputedString::CComputedString(), NL3D::CDriverUser::CDriverUser(), NL3D::CMeshInstance::createShadowMap(), NL3D::CRenderStringBuffer::CRenderStringBuffer(), NL3D::CShadowMapManager::CShadowMapManager(), NL3D::CShadowPolyReceiver::CShadowPolyReceiver(), NL3D::CPSUtil::displayArrow(), NL3D::CPSUtil::displayBBox(), NL3D::CInstanceGroup::displayDebugClusters(), NL3D::CDeform2d::doDeform(), NL3D::CWaterModel::doSimpleRender(), NL3D::CDRU::drawBitmap(), NL3D::CDRU::drawLine(), NL3D::CDRU::drawLinesUnlit(), NL3D::CDRU::drawQuad(), NL3D::CDRU::drawTriangle(), NL3D::CDRU::drawTrianglesUnlit(), NL3D::CPSFanLight::getVBnIB(), NL3D::CPSTailDot::getVBnPB(), NL3D::CPSShockWave::getVBnPB(), NL3D::CPSRibbonLookAt::getVBnPB(), NL3D::CPSRibbon::getVBnPB(), NL3D::CMeshMRMSkinnedGeom::getVertexBuffer(), NL3D::CVertexStreamManager::init(), NL3D::CVertexBufferHeap::init(), NL3D::CNoise3d::init(), NL3D::CPSConstraintMesh::initPrerotVB(), NL3D::CPSQuad::initVertexBuffers(), NL3D::CPSDot::initVertexBuffers(), NL3D::CMotionBlur::performMotionBlur(), serialOldV1Minus(), NL3D::CLandscapeVBAllocator::setupVBFormatAndVertexProgram(), NL3D::CSegRemanenceShape::setupVBnPB(), NL3D::CPSGravity::show(), NL3D::CDriverGL::swapBuffers(), and NL3D::CFlareModel::traverseRender().

00170 {
00171         uint    i;
00172 
00173         // Clear extended values 
00174         clearValueEx ();
00175 
00176         // Position ?
00177         if (flags & PositionFlag)
00178         {
00179                 // Add a standard position value
00180                 addValueEx (Position, Float3);
00181         }
00182 
00183         // Normal ?
00184         if (flags & NormalFlag)
00185         {
00186                 // Add a standard normal value
00187                 addValueEx (Normal, Float3);
00188         }
00189 
00190         // For each uv values
00191         for(i=0 ; i<MaxStage ; i++)
00192         {
00193                 // UV ?
00194                 if (flags & (TexCoord0Flag<<i))
00195                 {
00196                         // Add a standard uv value
00197                         addValueEx ((TValue)(TexCoord0+i), Float2);
00198                 }
00199         }
00200 
00201         // Fog ?
00202         if (flags & FogFlag)
00203         {
00204                 // Add a standard primary color value
00205                 addValueEx (Fog, Float1);
00206         }
00207 
00208         // Primary color ?
00209         if (flags & PrimaryColorFlag)
00210         {
00211                 // Add a standard primary color value
00212                 addValueEx (PrimaryColor, UChar4);
00213         }
00214 
00215         // Secondary color ?
00216         if (flags & SecondaryColorFlag)
00217         {
00218                 // Add a standard primary color value
00219                 addValueEx (SecondaryColor, UChar4);
00220         }
00221 
00222         // Weight ?
00223         if (flags & WeightFlag)
00224         {
00225                 // Add a standard primary color value
00226                 addValueEx (Weight, Float4);
00227         }
00228 
00229         // Palette skin ?
00230         if ((flags & PaletteSkinFlag)==CVertexBuffer::PaletteSkinFlag)
00231         {
00232                 // Add a standard primary color value
00233                 addValueEx (PaletteSkin, UChar4);
00234         }
00235 
00236         // Compute the vertex buffer
00237         initEx ();
00238 
00239         return (true);
00240 }

void NL3D::CVertexBuffer::setWeight uint  idx,
uint8  wgt,
float  w
[inline]
 

Definition at line 637 of file vertex_buffer.h.

References _Verts, MaxWeight, nlassert, uint, uint8, w, and WeightFlag.

Referenced by NL3D::CMeshGeom::findVBId().

00638 {
00639         uint8*  ptr;
00640         float*  ptrf;
00641 
00642         nlassert(wgt<MaxWeight);
00643         nlassert(_Flags & (WeightFlag));
00644 
00645         ptr=(uint8*)(&_Verts[idx*_VertexSize]);
00646         ptr+=_Offset[Weight]+sizeof(float)*wgt;
00647         ptrf=(float*)ptr;
00648         *ptrf=w;
00649 }


Friends And Related Function Documentation

friend struct CPtrInfo [friend, inherited]
 

Definition at line 67 of file smart_ptr.h.


Field Documentation

uint32 NL3D::CVertexBuffer::_Capacity [private]
 

Definition at line 249 of file vertex_buffer.h.

Referenced by operator=().

uint16 NL3D::CVertexBuffer::_Flags [private]
 

Definition at line 240 of file vertex_buffer.h.

Referenced by operator=().

uint16 NL3D::CVertexBuffer::_InternalFlags [private]
 

Definition at line 243 of file vertex_buffer.h.

Referenced by CVertexBuffer(), deleteAllVertices(), getTouchFlags(), initEx(), operator=(), resetTouchFlags(), serialOldV1Minus(), serialSubset(), and setNumVertices().

uint32 NL3D::CVertexBuffer::_NbVerts [private]
 

Definition at line 246 of file vertex_buffer.h.

Referenced by CVertexBuffer(), deleteAllVertices(), getNumVertices(), initEx(), operator=(), serial(), serialHeader(), serialOldV1Minus(), serialSubset(), and setNumVertices().

uint16 NL3D::CVertexBuffer::_Offset[NumValue] [private]
 

Definition at line 255 of file vertex_buffer.h.

Referenced by operator=().

uint8 NL3D::CVertexBuffer::_Pad [private]
 

Definition at line 234 of file vertex_buffer.h.

uint8 NL3D::CVertexBuffer::_Type[NumValue] [private]
 

Definition at line 233 of file vertex_buffer.h.

Referenced by operator=().

uint8 NL3D::CVertexBuffer::_UVRouting[MaxStage] [private]
 

Definition at line 258 of file vertex_buffer.h.

Referenced by CVertexBuffer(), getUVRouting(), operator=(), serialSubset(), and setUVRouting().

uint16 NL3D::CVertexBuffer::_VertexSize [private]
 

Definition at line 237 of file vertex_buffer.h.

Referenced by operator=().

std::vector<uint8> NL3D::CVertexBuffer::_Verts [private]
 

Definition at line 252 of file vertex_buffer.h.

Referenced by deleteAllVertices(), getColorPointer(), getNormalCoordPointer(), getPaletteSkinPointer(), getSpecularPointer(), getTexCoordPointer(), getValueEx(), getVertexCoordPointer(), getWeightPointer(), initEx(), operator=(), reserve(), setColor(), setNormalCoord(), setPaletteSkin(), setSpecular(), setTexCoord(), setValueDouble1Ex(), setValueDouble2Ex(), setValueDouble3Ex(), setValueDouble4Ex(), setValueFloat1Ex(), setValueFloat2Ex(), setValueFloat3Ex(), setValueFloat4Ex(), setValueShort1Ex(), setValueShort2Ex(), setValueShort3Ex(), setValueShort4Ex(), setValueUChar4Ex(), setVertexCoord(), and setWeight().

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().

const CVertexBuffer::TType NL3D::CVertexBuffer::DefaultValueType [static]
 

Initial value:

{
        Float3,         
        Float3,         
        Float2,         
        Float2,         
        Float2,         
        Float2,         
        Float2,         
        Float2,         
        Float2,         
        Float2,         
        UChar4,         
        UChar4,         
        Float4,         
        UChar4,         
        Float1,         
        Float1,         
}
Static array with the standard type of each value

Definition at line 77 of file vertex_buffer.cpp.

Referenced by serialHeader(), and serialOldV1Minus().

CRefPtr<IVBDrvInfos> NL3D::CVertexBuffer::DrvInfos
 

Definition at line 264 of file vertex_buffer.h.

Referenced by NL3D::CDriverGL::setupVertexBuffer(), and ~CVertexBuffer().

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

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

const uint NL3D::CVertexBuffer::NumComponentsType [static]
 

Initial value:

{
        1,
        1,
        1,
        2,
        2,
        2,
        3,
        3,
        3,
        4,
        4,
        4,
        4
}
Static array with the number of component of each value type

Definition at line 57 of file vertex_buffer.cpp.

Referenced by addValueEx().

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

Definition at line 80 of file smart_ptr.h.

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

const uint NL3D::CVertexBuffer::SizeType [static]
 

Initial value:

{
        1*sizeof(double),
        1*sizeof(float),
        1*sizeof(short),
        2*sizeof(double),
        2*sizeof(float),
        2*sizeof(short),
        3*sizeof(double),
        3*sizeof(float),
        3*sizeof(short),
        4*sizeof(double),
        4*sizeof(float),
        4*sizeof(short),
        4*sizeof(char),
}
Static array with the size in byte of each value type

Definition at line 39 of file vertex_buffer.cpp.

Referenced by initEx(), and serialSubset().


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