# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CVertexBuffer Class Reference

A vertex buffer to work with the driver. More...

#include <vertex_buffer.h>

Inheritance diagram for NL3D::CVertexBuffer:

NLMISC::CRefCount List of all members.

[NOHEADER]

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

This is usable only with OpenGL vertex_program or DX8 vertex shaders.

void clearValueEx ()
 Clear all value in the vertex buffer. More...

void addValueEx (TValue valueId, TType type)
 Add a value in the vertex buffer. More...

bool hasValueEx (TValue valueId) const
 Test if the given value is present in the vertex buffer. More...

void initEx ()
 Init the vertex buffer in extended mode. More...

void setValueDouble1Ex (TValue valueId, uint idx, double value)
 Setup values. More...

void setValueDouble2Ex (TValue valueId, uint idx, double x, double y)
void setValueDouble3Ex (TValue valueId, uint idx, double x, double y, double z)
void setValueDouble3Ex (TValue valueId, uint idx, const CVectorD &vector)
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, float x, float y, float z)
void setValueFloat3Ex (TValue valueId, uint idx, const CVector &vector)
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)
void * getValueEx (TValue valueId, uint idx=0)
 Get writable value pointer. More...

const void * getValueEx (TValue valueId, uint idx=0) const
 Get readable value pointer. More...

sint getValueOffEx (TValue valueId) const
 Get value offset. More...

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


Public Types

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
}
 Value ID, there is 16 value id. More...

enum  { FirstTexCoordValue = TexCoord0, LastTexCoordValue = TexCoord7 }
 Misc infos. More...

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
}
 Value flags. More...

enum  TType {
  Double1 = 0, Float1, Short1, Double2,
  Float2, Short2, Double3, Float3,
  Short3, Double4, Float4, Short4,
  UChar4, NumType
}
 Value type, there is 13 kind of value type as in DirectX8 and gl_vertex_program used in exteneded mode. More...

enum  { MaxStage = 8, MaxWeight = 4 }
 Some constants. More...


Public Methods

 CVertexBuffer (void)
 Default constructor. More...

 CVertexBuffer (const CVertexBuffer &vb)
 Copy constructor. More...

 ~CVertexBuffer (void)
 Destructor. More...

CVertexBuffer & operator= (const CVertexBuffer &vb)
 Copy operator. More...

void setNumVertices (uint32 n)
 Set the number of active vertices. More...

uint32 getNumVertices (void) const
 Get the number of active vertices. More...

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

void reserve (uint32 nVerts)
 Reserve space for nVerts vertices. More...

uint32 capacity ()
 Return the number of vertices reserved. More...

uint16 getVertexSize (void) const
 Return the size of a vertex. More...

TType getValueType (uint value) const
 Return the type of a value. More...

const uint8getValueTypePointer () const
 Return the type array. More...

uint8 getNumWeight () const
 Return number of weight value in vertices. More...

void serial (NLMISC::IStream &f)
Thoses methods manage the vertex buffer (position, normal, colors and uv) with standard value.
bool setVertexFormat (uint32 Flags)
 Setup the vertex format using standard values. More...

uint16 getVertexFormat (void) const
 Return the vertex format used by the vertex buffer. More...

uint getNumTexCoordUsed () const
 Returns the number of texture coordinate stages used by this vertex buffer. More...

void setVertexCoord (uint idx, float x, float y, float z)
void setVertexCoord (uint idx, const CVector &v)
void setNormalCoord (uint idx, const CVector &v)
void setTexCoord (uint idx, uint8 stage, float u, float v)
void setTexCoord (uint idx, uint8 stage, const CUV &uv)
void setColor (uint idx, CRGBA rgba)
void setSpecular (uint idx, CRGBA rgba)
void setWeight (uint idx, uint8 wgt, float w)
void setPaletteSkin (uint idx, CPaletteSkin ps)
sint getNormalOff () const
sint getTexCoordOff (uint8 stage=0) const
sint getColorOff () const
sint getSpecularOff () const
sint getWeightOff (sint wgt) const
 NB: it is ensured that WeightOff(i)==WeightOff(0)+i*sizeof(float). More...

sint getPaletteSkinOff () const
void * 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. More...

void * getNormalCoordPointer (uint idx=0)
void * getTexCoordPointer (uint idx=0, uint8 stage=0)
void * getColorPointer (uint idx=0)
void * getSpecularPointer (uint idx=0)
void * getWeightPointer (uint idx=0, uint8 wgt=0)
void * getPaletteSkinPointer (uint idx=0)
const void * getVertexCoordPointer (uint idx=0) const
const void * getNormalCoordPointer (uint idx=0) const
const void * getTexCoordPointer (uint idx=0, uint8 stage=0) const
const void * getColorPointer (uint idx=0) const
const void * getSpecularPointer (uint idx=0) const
const void * getWeightPointer (uint idx=0, uint8 wgt=0) const
const void * getPaletteSkinPointer (uint idx=0) const
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. More...

void serialSubset (NLMISC::IStream &f, uint vertexStart, uint vertexEnd)
 just read/write a subset of the vertex buffer. More...


Static Public Attributes

const uint SizeType [NumType]
 Static array with the size in byte of each value type. More...

const TType DefaultValueType [NumValue]
 Static array with the standard type of each value. More...

const uint NumComponentsType [NumType]
 Static array with the number of component of each value type. More...


Private Types

enum  { TouchedVertexFormat = 1, TouchedNumVertices = 2, TouchedAll = 0xFFFF }
 Internal flags. More...


Private Methods

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

uint16 remapV2Flags (uint32 oldFlags, uint &weightCount)
 Translate old flags. More...


Private Attributes

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

Detailed Description

A vertex buffer to work with the driver.

Definition at line 105 of file vertex_buffer.h.


Member Enumeration Documentation

anonymous enum
 

Misc infos.

Enumeration values:
FirstTexCoordValue 
LastTexCoordValue 

Definition at line 136 of file vertex_buffer.h.

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.

anonymous enum
 

Some constants.

Enumeration values:
MaxStage 
MaxWeight 

Definition at line 191 of file vertex_buffer.h.

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.

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.

Referenced by getValueType, and serialHeader.

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 getValueEx, getValueIdByNumberEx, getValueOffEx, serialHeader, serialSubset, and setVertexFormat.


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 _Capacity, _Flags, _InternalFlags, _NbVerts, and _VertexSize.

NL3D::CVertexBuffer::CVertexBuffer const CVertexBuffer &    vb
 

Copy constructor.

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

Definition at line 110 of file vertex_buffer.cpp.

References _Capacity, _Flags, _NbVerts, _VertexSize, and operator=.

NL3D::CVertexBuffer::~CVertexBuffer void   
 

Destructor.

Definition at line 121 of file vertex_buffer.cpp.

References DrvInfos.


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 264 of file vertex_buffer.cpp.

References _Flags, _Type, Fog, nlassert, Normal, NumComponentsType, PaletteSkin, Position, PrimaryColor, SecondaryColor, type, and Weight.

Referenced by serialHeader, and setVertexFormat.

uint32 NL3D::CVertexBuffer::capacity   [inline]
 

Return the number of vertices reserved.

Definition at line 464 of file vertex_buffer.h.

References _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 256 of file vertex_buffer.cpp.

References _Flags.

Referenced by serialHeader, and setVertexFormat.

void NL3D::CVertexBuffer::deleteAllVertices  
 

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

Definition at line 350 of file vertex_buffer.cpp.

References _Capacity, _InternalFlags, _NbVerts, _Verts, NLMISC::contReset, and TouchedNumVertices.

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

Definition at line 336 of file vertex_buffer.h.

References _Flags, _Offset, nlassert, PrimaryColor, and PrimaryColorFlag.

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

Definition at line 506 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, PrimaryColor, and PrimaryColorFlag.

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

Definition at line 391 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, PrimaryColor, and PrimaryColorFlag.

Referenced by NL3D::CNoise3d::render, NL3D::CNoise3d::render2passes, NL3D::CNoise3d::renderGrid, NL3D::CNoise3d::renderGrid2passes, and serialOldV1Minus.

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

Definition at line 490 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, Normal, and NormalFlag.

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

Definition at line 375 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, Normal, and NormalFlag.

Referenced by serialOldV1Minus.

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

Definition at line 334 of file vertex_buffer.h.

References _Flags, _Offset, nlassert, Normal, and NormalFlag.

uint NL3D::CVertexBuffer::getNumTexCoordUsed   const
 

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

Definition at line 902 of file vertex_buffer.cpp.

References _Flags, MaxStage, and TexCoord0Flag.

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

Get the number of active vertices.

Definition at line 449 of file vertex_buffer.h.

Referenced by NL3D::CNoise3d::render, NL3D::CNoise3d::render2passes, NL3D::CNoise3d::renderGrid, and NL3D::CNoise3d::renderGrid2passes.

uint8 NL3D::CVertexBuffer::getNumWeight   const
 

Return number of weight value in vertices.

Definition at line 913 of file vertex_buffer.cpp.

References _Type, Float1, Float2, Float3, Float4, and Weight.

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

Definition at line 340 of file vertex_buffer.h.

References _Flags, _Offset, nlassert, and PaletteSkin.

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

Definition at line 570 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, PaletteSkin, and PaletteSkinFlag.

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

Definition at line 455 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, PaletteSkin, and PaletteSkinFlag.

Referenced by serialOldV1Minus.

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

Definition at line 337 of file vertex_buffer.h.

References _Flags, _Offset, nlassert, SecondaryColor, and SecondaryColorFlag.

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

Definition at line 522 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, SecondaryColor, and SecondaryColorFlag.

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

Definition at line 407 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, SecondaryColor, and SecondaryColorFlag.

Referenced by serialOldV1Minus.

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

Definition at line 335 of file vertex_buffer.h.

References _Flags, _Offset, nlassert, TexCoord0, and TexCoord0Flag.

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

Definition at line 538 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, TexCoord0, and TexCoord0Flag.

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

Definition at line 423 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, TexCoord0, and TexCoord0Flag.

Referenced by NL3D::CNoise3d::render, NL3D::CNoise3d::render2passes, NL3D::CNoise3d::renderGrid, NL3D::CNoise3d::renderGrid2passes, and serialOldV1Minus.

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

Definition at line 261 of file vertex_buffer.h.

References _InternalFlags, and TouchedAll.

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

Get readable value pointer.

Definition at line 432 of file vertex_buffer.h.

References _Flags, _VertexSize, _Verts, getValueOffEx, nlassert, and TValue.

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

Get writable value pointer.

Definition at line 427 of file vertex_buffer.h.

References _Flags, _VertexSize, _Verts, getValueOffEx, nlassert, and TValue.

Referenced by serialSubset.

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 229 of file vertex_buffer.cpp.

References Empty, Fog, Normal, PaletteSkin, Position, PrimaryColor, SecondaryColor, TexCoord0, TexCoord1, TexCoord2, TexCoord3, TexCoord4, TexCoord5, TexCoord6, TexCoord7, TValue, and Weight.

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

Get value offset.

Definition at line 437 of file vertex_buffer.h.

References _Flags, _Offset, nlassert, and TValue.

Referenced by getValueEx.

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

Return the type of a value.

Definition at line 474 of file vertex_buffer.h.

References _Type, nlassert, NumValue, TType, and value.

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

Return the type array.

Definition at line 479 of file vertex_buffer.h.

References _Type.

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

Definition at line 479 of file vertex_buffer.cpp.

References _VertexSize, and _Verts.

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 364 of file vertex_buffer.cpp.

References _VertexSize, and _Verts.

Referenced by NL3D::CNoise3d::render, NL3D::CNoise3d::render2passes, NL3D::CNoise3d::renderGrid, NL3D::CNoise3d::renderGrid2passes, and serialOldV1Minus.

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 315 of file vertex_buffer.h.

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

Return the size of a vertex.

Definition at line 469 of file vertex_buffer.h.

Referenced by NL3D::CNoise3d::render, NL3D::CNoise3d::render2passes, NL3D::CNoise3d::renderGrid, and NL3D::CNoise3d::renderGrid2passes.

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

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

Definition at line 339 of file vertex_buffer.h.

References _Flags, _Offset, nlassert, Weight, and WeightFlag.

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

Definition at line 554 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, MaxWeight, nlassert, Weight, and WeightFlag.

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

Definition at line 439 of file vertex_buffer.cpp.

References _Flags, _Offset, _VertexSize, _Verts, MaxWeight, nlassert, Weight, and WeightFlag.

Referenced by serialOldV1Minus.

bool NL3D::CVertexBuffer::hasValueEx TValue    valueId const
 

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

Definition at line 288 of file vertex_buffer.cpp.

References _Flags.

void NL3D::CVertexBuffer::initEx  
 

Init the vertex buffer in extended mode.

Definition at line 295 of file vertex_buffer.cpp.

References _Capacity, _Flags, _InternalFlags, _NbVerts, _Offset, _Type, _VertexSize, _Verts, NumValue, SizeType, TouchedAll, and value.

Referenced by serialHeader, and setVertexFormat.

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 129 of file vertex_buffer.cpp.

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

Referenced by CVertexBuffer.

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

Translate old flags.

Definition at line 586 of file vertex_buffer.cpp.

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

Referenced by serialHeader, and serialOldV1Minus.

void NL3D::CVertexBuffer::reserve uint32    nVerts
 

Reserve space for nVerts vertices.

You are allowed to write your vertices on this space.

Definition at line 327 of file vertex_buffer.cpp.

References _Capacity, _VertexSize, and _Verts.

Referenced by serialHeader, serialOldV1Minus, and setNumVertices.

void NL3D::CVertexBuffer::resetTouchFlags   [inline]
 

Definition at line 262 of file vertex_buffer.h.

References _InternalFlags, and TouchedAll.

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

Definition at line 780 of file vertex_buffer.cpp.

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

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 809 of file vertex_buffer.cpp.

References _Flags, _NbVerts, _Type, addValueEx, clearValueEx, DefaultValueType, Float1, Float2, Float3, Float4, initEx, NLMISC::IStream::isReading, nlassert, NumValue, remapV2Flags, reserve, NLMISC::IStream::serial, NLMISC::IStream::serialVersion, setNumVertices, TType, TValue, and Weight.

Referenced by serial.

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

Old version serialisation. V0 and V1.

Definition at line 667 of file vertex_buffer.cpp.

References _Flags, _InternalFlags, _NbVerts, _Type, DefaultValueType, Float1, Float2, Float3, Float4, getColorPointer, getNormalCoordPointer, getPaletteSkinPointer, getSpecularPointer, getTexCoordPointer, getVertexCoordPointer, getWeightPointer, id, NLMISC::IStream::isReading, MaxStage, nlassert, NormalFlag, NumValue, PaletteSkinFlag, PositionFlag, PrimaryColorFlag, remapV2Flags, reserve, SecondaryColorFlag, NLMISC::IStream::serial, setNumVertices, setVertexFormat, TexCoord0Flag, TouchedAll, w, and Weight.

Referenced by serial.

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 934 of file vertex_buffer.cpp.

References _Flags, _InternalFlags, _NbVerts, _Type, getValueEx, id, NLMISC::IStream::isReading, nlassert, NumValue, NLMISC::IStream::serialBuffer, NLMISC::IStream::serialVersion, SizeType, TouchedAll, TValue, and value.

Referenced by serial.

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

Definition at line 558 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, nlassert, PrimaryColor, PrimaryColorFlag, and UChar4.

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

Definition at line 544 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Float3, nlassert, Normal, NormalFlag, and v.

void NL3D::CVertexBuffer::setNumVertices uint32    n
 

Set the number of active vertices.

It enlarge capacity, if needed.

Definition at line 335 of file vertex_buffer.cpp.

References _Capacity, _InternalFlags, _NbVerts, reserve, and TouchedNumVertices.

Referenced by NL3D::CCloudScape::CCloudScape, NL3D::CNoise3d::render, NL3D::CNoise3d::render2passes, NL3D::CNoise3d::renderGrid, NL3D::CNoise3d::renderGrid2passes, serialHeader, and serialOldV1Minus.

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

Definition at line 643 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, nlassert, PaletteSkin, PaletteSkinFlag, and UChar4.

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

Definition at line 574 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, nlassert, SecondaryColor, SecondaryColorFlag, and UChar4.

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

Definition at line 609 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Float2, MaxStage, nlassert, TexCoord0, and TexCoord0Flag.

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

Definition at line 590 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Float2, MaxStage, nlassert, TexCoord0, TexCoord0Flag, and v.

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 659 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Double1, Double2, Double3, Double4, nlassert, NumValue, and value.

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

Definition at line 676 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Double2, Double3, Double4, nlassert, NumValue, x, and y.

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

Definition at line 713 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Double3, Double4, nlassert, and NumValue.

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

Definition at line 694 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Double3, Double4, nlassert, NumValue, x, y, and z.

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

Definition at line 730 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Double4, nlassert, NumValue, w, x, y, and z.

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

Definition at line 750 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Float1, Float2, Float3, Float4, nlassert, NumValue, and value.

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

Definition at line 767 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Float2, Float3, Float4, nlassert, NumValue, x, and y.

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

Definition at line 804 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Float3, Float4, nlassert, and NumValue.

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

Definition at line 785 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Float3, Float4, nlassert, NumValue, x, y, and z.

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

Definition at line 821 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, Float4, nlassert, NumValue, w, x, y, and z.

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

Definition at line 841 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, nlassert, NumValue, Short1, Short2, Short3, Short4, and value.

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

Definition at line 858 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, nlassert, NumValue, Short2, Short3, Short4, x, and y.

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

Definition at line 876 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, nlassert, NumValue, Short3, Short4, x, y, and z.

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

Definition at line 895 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, nlassert, NumValue, Short4, w, x, y, and z.

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

Definition at line 915 of file vertex_buffer.h.

References _Flags, _Offset, _Type, _VertexSize, _Verts, nlassert, NumValue, and UChar4.

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

Definition at line 531 of file vertex_buffer.h.

References _Flags, _Type, _VertexSize, _Verts, Float3, nlassert, Position, PositionFlag, and v.

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

Definition at line 514 of file vertex_buffer.h.

References _Flags, _Type, _VertexSize, _Verts, Float3, nlassert, Position, PositionFlag, x, y, and z.

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 154 of file vertex_buffer.cpp.

References addValueEx, clearValueEx, Float1, Float2, Float3, Float4, Fog, FogFlag, initEx, MaxStage, Normal, NormalFlag, PaletteSkin, PaletteSkinFlag, Position, PositionFlag, PrimaryColor, PrimaryColorFlag, SecondaryColor, SecondaryColorFlag, TexCoord0, TexCoord0Flag, TValue, UChar4, Weight, and WeightFlag.

Referenced by NL3D::CCloudScape::CCloudScape, NL3D::CNoise3d::init, and serialOldV1Minus.

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

Definition at line 627 of file vertex_buffer.h.

References _Flags, _Offset, _VertexSize, _Verts, MaxWeight, nlassert, w, Weight, and WeightFlag.


Member Data Documentation

uint32 NL3D::CVertexBuffer::_Capacity [private]
 

Definition at line 249 of file vertex_buffer.h.

Referenced by capacity, CVertexBuffer, deleteAllVertices, initEx, operator=, reserve, and setNumVertices.

uint16 NL3D::CVertexBuffer::_Flags [private]
 

Definition at line 240 of file vertex_buffer.h.

Referenced by addValueEx, clearValueEx, CVertexBuffer, getColorOff, getColorPointer, getNormalCoordPointer, getNormalOff, getNumTexCoordUsed, getPaletteSkinOff, getPaletteSkinPointer, getSpecularOff, getSpecularPointer, getTexCoordOff, getTexCoordPointer, getValueEx, getValueOffEx, getWeightOff, getWeightPointer, hasValueEx, initEx, operator=, serialHeader, serialOldV1Minus, serialSubset, setColor, setNormalCoord, setPaletteSkin, setSpecular, setTexCoord, setValueDouble1Ex, setValueDouble2Ex, setValueDouble3Ex, setValueDouble4Ex, setValueFloat1Ex, setValueFloat2Ex, setValueFloat3Ex, setValueFloat4Ex, setValueShort1Ex, setValueShort2Ex, setValueShort3Ex, setValueShort4Ex, setValueUChar4Ex, setVertexCoord, and setWeight.

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, 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 getColorOff, getColorPointer, getNormalCoordPointer, getNormalOff, getPaletteSkinOff, getPaletteSkinPointer, getSpecularOff, getSpecularPointer, getTexCoordOff, getTexCoordPointer, getValueOffEx, getWeightOff, getWeightPointer, initEx, operator=, setColor, setNormalCoord, setPaletteSkin, setSpecular, setTexCoord, setValueDouble1Ex, setValueDouble2Ex, setValueDouble3Ex, setValueDouble4Ex, setValueFloat1Ex, setValueFloat2Ex, setValueFloat3Ex, setValueFloat4Ex, setValueShort1Ex, setValueShort2Ex, setValueShort3Ex, setValueShort4Ex, setValueUChar4Ex, and setWeight.

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 addValueEx, getNumWeight, getValueType, getValueTypePointer, initEx, operator=, serialHeader, serialOldV1Minus, serialSubset, setColor, setNormalCoord, setPaletteSkin, setSpecular, setTexCoord, setValueDouble1Ex, setValueDouble2Ex, setValueDouble3Ex, setValueDouble4Ex, setValueFloat1Ex, setValueFloat2Ex, setValueFloat3Ex, setValueFloat4Ex, setValueShort1Ex, setValueShort2Ex, setValueShort3Ex, setValueShort4Ex, setValueUChar4Ex, and setVertexCoord.

uint16 NL3D::CVertexBuffer::_VertexSize [private]
 

Definition at line 237 of file vertex_buffer.h.

Referenced by CVertexBuffer, 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.

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.

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

Initial value:

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 260 of file vertex_buffer.h.

Referenced by ~CVertexBuffer.

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.

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: