NL3D::CPrimitiveBlock Class Reference

#include <primitive_block.h>


Detailed Description

Class CPrimitiveBlock

Definition at line 48 of file 3d/primitive_block.h.

Public Member Functions

void addLine (uint32 vidx0, uint32 vidx1)
 Apend a line at getNumLine() (then resize +1 the numline).

void addQuad (uint32 vidx0, uint32 vidx1, uint32 vidx2, uint32 vidx3)
 Apend a quad at getNumQuad() (then resize +1 the numquad).

void addTri (uint32 vidx0, uint32 vidx1, uint32 vidx2)
 Apend a triangle at getNumTri() (then resize +1 the numtri).

uint32 capacityLine () const
 Return the number of Line reserved.

uint32 capacityQuad ()
uint32 capacityTri ()
 Return the number of triangles reserved.

 CPrimitiveBlock (void)
const uint32getLinePointer (void) const
uint32getLinePointer (void)
uint32 getNumLine (void) const
 Get the number of active Lineangles.

uint32 getNumQuad (void) const
uint32 getNumTri (void) const
 Get the number of active triangles.

uint32 getNumTriangles ()
 return total number of triangle in this primitive block

const uint32getQuadPointer (void) const
 return the quad buffer, const version

uint32getQuadPointer (void)
const uint32getTriPointer (void) const
uint32getTriPointer (void)
void reserveLine (uint32 n)
 reserve space for nLines Line. You are allowed to write your Line indices on this space.

void reserveQuad (uint32 n)
void reserveTri (uint32 n)
 reserve space for nTris triangles. You are allowed to write your triangles indices on this space.

void serial (NLMISC::IStream &f)
void setLine (uint lineIdx, uint32 vidx0, uint32 vidx1)
 Build a Lineangle.

void setNumLine (uint32 n)
 Set the number of active Line. It enlarge Line capacity, if needed.

void setNumQuad (uint32 n)
void setNumTri (uint32 n)
 Set the number of active triangles. It enlarge Tri capacity, if needed.

void setQuad (uint quadIdx, uint32 vidx0, uint32 vidx1, uint32 vidx2, uint32 vidx3)
void setTri (uint triIdx, uint32 vidx0, uint32 vidx1, uint32 vidx2)
 Build a triangle.

 ~CPrimitiveBlock (void)

Private Attributes

uint32_Fan
uint32 _FanIdx
std::vector< uint32_Line
uint32 _LineCapacity
uint32 _NbLines
uint32 _NbQuads
uint32 _NbTris
std::vector< uint32_Quad
uint32 _QuadCapacity
uint32_Strip
uint32 _StripIdx
std::vector< uint32_Tri
uint32 _TriCapacity


Constructor & Destructor Documentation

NL3D::CPrimitiveBlock::CPrimitiveBlock void   )  [inline]
 

Definition at line 73 of file 3d/primitive_block.h.

References _LineCapacity, _NbLines, _NbQuads, _NbTris, _QuadCapacity, and _TriCapacity.

NL3D::CPrimitiveBlock::~CPrimitiveBlock void   )  [inline]
 

Definition at line 75 of file 3d/primitive_block.h.

00075 {}; 


Member Function Documentation

void NL3D::CPrimitiveBlock::addLine uint32  vidx0,
uint32  vidx1
 

Apend a line at getNumLine() (then resize +1 the numline).

Definition at line 80 of file primitive_block.cpp.

References getNumLine(), setLine(), setNumLine(), and uint32.

Referenced by NL3D::CPSUtil::displayBBox(), NL3D::CInstanceGroup::displayDebugClusters(), and NL3D::CPSGravity::show().

00081 {
00082         setNumLine(getNumLine()+1);
00083         setLine(getNumLine()-1, vidx0, vidx1);
00084 }

void NL3D::CPrimitiveBlock::addQuad uint32  vidx0,
uint32  vidx1,
uint32  vidx2,
uint32  vidx3
 

Apend a quad at getNumQuad() (then resize +1 the numquad).

Definition at line 211 of file primitive_block.cpp.

References getNumQuad(), setNumQuad(), setQuad(), and uint32.

00212 {
00213         setNumQuad(getNumQuad()+1);
00214         setQuad(getNumQuad()-1, vidx0, vidx1, vidx2, vidx3);
00215 }

void NL3D::CPrimitiveBlock::addTri uint32  vidx0,
uint32  vidx1,
uint32  vidx2
 

Apend a triangle at getNumTri() (then resize +1 the numtri).

Definition at line 138 of file primitive_block.cpp.

References getNumTri(), setNumTri(), setTri(), and uint32.

Referenced by NL3D::CInstanceGroup::displayDebugClusters(), and NL3D::COrderFace::insertInPB().

00139 {
00140         setNumTri(getNumTri()+1);
00141         setTri(getNumTri()-1, vidx0, vidx1, vidx2);
00142 }

uint32 NL3D::CPrimitiveBlock::capacityLine  )  const [inline]
 

Return the number of Line reserved.

Definition at line 83 of file 3d/primitive_block.h.

References _LineCapacity, and uint32.

00083 {return _LineCapacity;}

uint32 NL3D::CPrimitiveBlock::capacityQuad  )  [inline]
 

Return the number of triangles reserved.

Definition at line 131 of file 3d/primitive_block.h.

References _QuadCapacity, and uint32.

00131 { return _QuadCapacity; }

uint32 NL3D::CPrimitiveBlock::capacityTri  )  [inline]
 

Return the number of triangles reserved.

Definition at line 104 of file 3d/primitive_block.h.

References _TriCapacity, and uint32.

00104 {return _TriCapacity;}

const uint32 * NL3D::CPrimitiveBlock::getLinePointer void   )  const
 

Definition at line 46 of file primitive_block.cpp.

References _Line, and uint32.

00047 {
00048         if(_Line.begin()==_Line.end())
00049                 return NULL;
00050         else
00051                 return(&(*_Line.begin()));
00052 }

uint32 * NL3D::CPrimitiveBlock::getLinePointer void   ) 
 

Definition at line 38 of file primitive_block.cpp.

References _Line, and uint32.

Referenced by NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::DuplicatePrimitiveBlock(), NL3D::CMeshGeom::flagSkinVerticesForMatrixBlock(), and NL3D::CDriverGL::render().

00039 {
00040         if(_Line.begin()==_Line.end())
00041                 return NULL;
00042         else
00043                 return(&(*_Line.begin()));
00044 }

uint32 NL3D::CPrimitiveBlock::getNumLine void   )  const [inline]
 

Get the number of active Lineangles.

Definition at line 87 of file 3d/primitive_block.h.

References _NbLines, and uint32.

Referenced by addLine(), NL3D::CMeshMRMGeom::compileRunTime(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::DuplicatePrimitiveBlock(), NL3D::CMeshGeom::flagSkinVerticesForMatrixBlock(), NL3D::getMeshNumTri(), and NL3D::CDriverGL::render().

00087 {return _NbLines;}

uint32 NL3D::CPrimitiveBlock::getNumQuad void   )  const [inline]
 

Get the number of active quads.

Definition at line 141 of file 3d/primitive_block.h.

References _NbQuads, and uint32.

Referenced by addQuad(), NL3D::CZoneLighter::addTriangles(), NL3D::CInstanceLighter::addTriangles(), NL3D::CMeshMRMGeom::compileRunTime(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::DuplicatePrimitiveBlock(), NL3D::CMeshGeom::flagSkinVerticesForMatrixBlock(), NL3D::getMeshNumTri(), NL3D::CCoarseMeshBuild::remapCoordinates(), and NL3D::CDriverGL::render().

00141 { return _NbQuads; }

uint32 NL3D::CPrimitiveBlock::getNumTri void   )  const [inline]
 

Get the number of active triangles.

Definition at line 108 of file 3d/primitive_block.h.

References _NbTris, and uint32.

Referenced by addTri(), NL3D::CZoneLighter::addTriangles(), NL3D::CInstanceLighter::addTriangles(), NL3D::CVegetableShape::build(), NL3D::CMeshMRMSkinnedGeom::CLod::buildPrimitiveBlock(), NL3D::CMeshMultiLod::compileCoarseMeshes(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::CMeshInstance::createShadowMap(), NL3D::DuplicatePrimitiveBlock(), NL3D::CMeshGeom::flagSkinVerticesForMatrixBlock(), NL3D::getMeshNumTri(), NL3D::UShape::getMeshTriangles(), NL3D::CMeshMRMGeom::profileSceneRender(), NL3D::CMeshGeom::profileSceneRender(), NL3D::CCoarseMeshBuild::remapCoordinates(), and NL3D::CDriverGL::render().

00108 {return _NbTris;}

uint32 NL3D::CPrimitiveBlock::getNumTriangles  )  [inline]
 

return total number of triangle in this primitive block

Definition at line 160 of file 3d/primitive_block.h.

References _NbLines, _NbQuads, _NbTris, and uint32.

Referenced by NL3D::CMeshMRMGeom::build(), and NL3D::CMeshGeom::getNumTriangles().

00161         {
00162                 // Return number of triangles in this primitive block
00163                 return _NbTris+2*_NbQuads+_NbLines;
00164         }

const uint32 * NL3D::CPrimitiveBlock::getQuadPointer void   )  const
 

return the quad buffer, const version

Definition at line 157 of file primitive_block.cpp.

References _Quad, and uint32.

00158 {
00159         if(_Quad.begin()==_Quad.end())
00160                 return NULL;
00161         else
00162                 return(&(*_Quad.begin()));
00163 }

uint32 * NL3D::CPrimitiveBlock::getQuadPointer void   ) 
 

Return the Quad buffer

Definition at line 149 of file primitive_block.cpp.

References _Quad, and uint32.

Referenced by NL3D::CZoneLighter::addTriangles(), NL3D::CInstanceLighter::addTriangles(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::DuplicatePrimitiveBlock(), NL3D::CMeshGeom::flagSkinVerticesForMatrixBlock(), NL3D::CCoarseMeshBuild::remapCoordinates(), and NL3D::CDriverGL::render().

00150 {
00151         if(_Quad.begin()==_Quad.end())
00152                 return NULL;
00153         else
00154                 return(&(*_Quad.begin()));
00155 }

const uint32 * NL3D::CPrimitiveBlock::getTriPointer void   )  const
 

Definition at line 99 of file primitive_block.cpp.

References _Tri, and uint32.

00100 {
00101         if(_Tri.begin()==_Tri.end())
00102                 return NULL;
00103         else
00104                 return(&(*_Tri.begin()));
00105 }

uint32 * NL3D::CPrimitiveBlock::getTriPointer void   ) 
 

Definition at line 91 of file primitive_block.cpp.

References _Tri, and uint32.

Referenced by NL3D::CZoneLighter::addTriangles(), NL3D::CInstanceLighter::addTriangles(), NL3D::CVegetableShape::build(), NL3D::CMeshMRMSkinnedGeom::CLod::buildPrimitiveBlock(), NL3D::CMeshMultiLod::compileCoarseMeshes(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::CMeshInstance::createShadowMap(), NL3D::DuplicatePrimitiveBlock(), NL3D::CMeshGeom::flagSkinVerticesForMatrixBlock(), NL3D::UShape::getMeshTriangles(), NL3D::CCoarseMeshBuild::remapCoordinates(), and NL3D::CDriverGL::render().

00092 {
00093         if(_Tri.begin()==_Tri.end())
00094                 return NULL;
00095         else
00096                 return(&(*_Tri.begin()));
00097 }

void NL3D::CPrimitiveBlock::reserveLine uint32  n  ) 
 

reserve space for nLines Line. You are allowed to write your Line indices on this space.

Definition at line 56 of file primitive_block.cpp.

References _Line, _LineCapacity, and uint32.

Referenced by NL3D::CPSUtil::displayBBox(), NL3D::CInstanceGroup::displayDebugClusters(), NL3D::DuplicatePrimitiveBlock(), setNumLine(), and NL3D::CPSGravity::show().

00057 {
00058         _Line.resize(n*2);
00059         _LineCapacity= n;
00060 }

void NL3D::CPrimitiveBlock::reserveQuad uint32  n  ) 
 

reserve space for quads.

Definition at line 170 of file primitive_block.cpp.

References _Quad, _QuadCapacity, and uint32.

Referenced by NL3D::DuplicatePrimitiveBlock(), NL3D::CPSShockWave::getVBnPB(), and setNumQuad().

00171 {
00172         _Quad.resize(n*4);
00173         _QuadCapacity = n;
00174 }

void NL3D::CPrimitiveBlock::reserveTri uint32  n  ) 
 

reserve space for nTris triangles. You are allowed to write your triangles indices on this space.

Definition at line 109 of file primitive_block.cpp.

References _Tri, _TriCapacity, and uint32.

Referenced by NL3D::CInstanceGroup::displayDebugClusters(), NL3D::DuplicatePrimitiveBlock(), NL3D::CStripifier::optimizeTriangles(), and setNumTri().

00110 {
00111         _Tri.resize(n*3);
00112         _TriCapacity= n;
00113 }

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

Definition at line 219 of file primitive_block.cpp.

References _Line, _LineCapacity, _NbLines, _NbQuads, _NbTris, _Quad, _QuadCapacity, _Tri, _TriCapacity, NLMISC::IStream::serial(), NLMISC::IStream::serialCont(), and NLMISC::IStream::serialVersion().

00220 {
00221         (void)f.serialVersion(0);
00222 
00223         f.serial(_NbLines, _LineCapacity);
00224         f.serialCont(_Line);
00225         f.serial(_NbTris, _TriCapacity);
00226         f.serialCont(_Tri);
00227         f.serial(_NbQuads, _QuadCapacity);
00228         f.serialCont(_Quad);
00229 
00230 }

void NL3D::CPrimitiveBlock::setLine uint  lineIdx,
uint32  vidx0,
uint32  vidx1
 

Build a Lineangle.

Definition at line 69 of file primitive_block.cpp.

References _Line, uint, and uint32.

Referenced by addLine(), NL3D::CDriverUser::CDriverUser(), NL3D::CDRU::drawLine(), NL3D::CDRU::drawLinesUnlit(), NL3D::DuplicatePrimitiveBlock(), and NL3D::CPSTailDot::getVBnPB().

00070 {
00071         uint32* ptr;
00072 
00073         ptr=(uint32*)(&_Line[lineIdx*2]);
00074         *ptr=vidx0;
00075         ptr++;
00076         *ptr=vidx1;
00077 }

void NL3D::CPrimitiveBlock::setNumLine uint32  n  ) 
 

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

Definition at line 61 of file primitive_block.cpp.

References _LineCapacity, _NbLines, reserveLine(), and uint32.

Referenced by addLine(), NL3D::CDriverUser::CDriverUser(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::CInstanceGroup::displayDebugClusters(), NL3D::CPSTailDot::displayRibbons(), NL3D::CDRU::drawLine(), NL3D::CDRU::drawLinesUnlit(), NL3D::CMeshMRMSkinnedGeom::CLod::getRdrPassPrimitiveBlock(), and NL3D::CPSTailDot::getVBnPB().

00062 {
00063         if(_LineCapacity<n)
00064         {
00065                 reserveLine(n);
00066         }
00067         _NbLines= n;
00068 }

void NL3D::CPrimitiveBlock::setNumQuad uint32  n  ) 
 

Set the number of active quads. It enlarges Quad capacity, if needed.

Definition at line 180 of file primitive_block.cpp.

References _NbQuads, _QuadCapacity, reserveQuad(), and uint32.

Referenced by addQuad(), NL3D::CDriverUser::CDriverUser(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::CDRU::drawBitmap(), NL3D::CDRU::drawQuad(), NL3D::CPSShockWaveHelper::drawShockWave(), and NL3D::CMeshMRMSkinnedGeom::CLod::getRdrPassPrimitiveBlock().

00181 {
00182         if(_QuadCapacity<n)
00183         {
00184                 reserveQuad(n);
00185         }
00186         _NbQuads = n;
00187 }

void NL3D::CPrimitiveBlock::setNumTri uint32  n  ) 
 

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

Definition at line 114 of file primitive_block.cpp.

References _NbTris, _TriCapacity, reserveTri(), and uint32.

Referenced by addTri(), NL3D::CDriverUser::CDriverUser(), NL3D::CMeshMRMGeom::computeMeshVBHeap(), NL3D::CMeshGeom::computeMeshVBHeap(), NL3D::CInstanceGroup::displayDebugClusters(), NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSRibbon::displayRibbons(), NL3D::CDRU::drawTriangle(), NL3D::CDRU::drawTrianglesUnlit(), NL3D::CMeshMRMSkinnedGeom::CLod::getRdrPassPrimitiveBlock(), NL3D::CPSRibbonLookAt::getVBnPB(), NL3D::CPSRibbon::getVBnPB(), NL3D::CStripifier::optimizeTriangles(), and NL3D::CSegRemanenceShape::setupVBnPB().

00115 {
00116         if(_TriCapacity<n)
00117         {
00118                 reserveTri(n);
00119         }
00120         _NbTris= n;
00121 }

void NL3D::CPrimitiveBlock::setQuad uint  quadIdx,
uint32  vidx0,
uint32  vidx1,
uint32  vidx2,
uint32  vidx3
 

Build a quad.

Definition at line 193 of file primitive_block.cpp.

References _Quad, uint, and uint32.

Referenced by addQuad(), NL3D::CDriverUser::CDriverUser(), NL3D::CDRU::drawBitmap(), NL3D::CDRU::drawQuad(), NL3D::DuplicatePrimitiveBlock(), and NL3D::CPSShockWave::getVBnPB().

00194 {
00195         uint32* ptr;
00196 
00197         ptr = (uint32*)(&_Quad[quadIdx*4]);
00198         *ptr = vidx0;
00199         ptr++;
00200         *ptr = vidx1;
00201         ptr++;
00202         *ptr = vidx2;
00203         ptr++;
00204         *ptr = vidx3;
00205 }

void NL3D::CPrimitiveBlock::setTri uint  triIdx,
uint32  vidx0,
uint32  vidx1,
uint32  vidx2
 

Build a triangle.

Definition at line 122 of file primitive_block.cpp.

References _Tri, nlassert, sint, uint, and uint32.

Referenced by addTri(), NL3D::CDriverUser::CDriverUser(), NL3D::CDRU::drawTriangle(), NL3D::CDRU::drawTrianglesUnlit(), NL3D::DuplicatePrimitiveBlock(), NL3D::CMeshMRMSkinnedGeom::CLod::getRdrPassPrimitiveBlock(), NL3D::CPSRibbonLookAt::getVBnPB(), NL3D::CPSRibbon::getVBnPB(), and NL3D::CSegRemanenceShape::setupVBnPB().

00123 {
00124         #ifdef NL_DEBUG
00125                 nlassert((sint) triIdx <= ((sint) _Tri.size() - 3));
00126         #endif
00127         uint32* ptr;
00128 
00129         ptr=(uint32*)(&_Tri[triIdx*3]);
00130         *ptr=vidx0;
00131         ptr++;
00132         *ptr=vidx1;
00133         ptr++;
00134         *ptr=vidx2;
00135 }


Field Documentation

uint32* NL3D::CPrimitiveBlock::_Fan [private]
 

Definition at line 71 of file 3d/primitive_block.h.

uint32 NL3D::CPrimitiveBlock::_FanIdx [private]
 

Definition at line 70 of file 3d/primitive_block.h.

std::vector<uint32> NL3D::CPrimitiveBlock::_Line [private]
 

Definition at line 64 of file 3d/primitive_block.h.

Referenced by getLinePointer(), reserveLine(), serial(), and setLine().

uint32 NL3D::CPrimitiveBlock::_LineCapacity [private]
 

Definition at line 63 of file 3d/primitive_block.h.

Referenced by capacityLine(), CPrimitiveBlock(), reserveLine(), serial(), and setNumLine().

uint32 NL3D::CPrimitiveBlock::_NbLines [private]
 

Definition at line 62 of file 3d/primitive_block.h.

Referenced by CPrimitiveBlock(), getNumLine(), getNumTriangles(), serial(), and setNumLine().

uint32 NL3D::CPrimitiveBlock::_NbQuads [private]
 

Definition at line 57 of file 3d/primitive_block.h.

Referenced by CPrimitiveBlock(), getNumQuad(), getNumTriangles(), serial(), and setNumQuad().

uint32 NL3D::CPrimitiveBlock::_NbTris [private]
 

Definition at line 52 of file 3d/primitive_block.h.

Referenced by CPrimitiveBlock(), getNumTri(), getNumTriangles(), serial(), and setNumTri().

std::vector<uint32> NL3D::CPrimitiveBlock::_Quad [private]
 

Definition at line 59 of file 3d/primitive_block.h.

Referenced by getQuadPointer(), reserveQuad(), serial(), and setQuad().

uint32 NL3D::CPrimitiveBlock::_QuadCapacity [private]
 

Definition at line 58 of file 3d/primitive_block.h.

Referenced by capacityQuad(), CPrimitiveBlock(), reserveQuad(), serial(), and setNumQuad().

uint32* NL3D::CPrimitiveBlock::_Strip [private]
 

Definition at line 69 of file 3d/primitive_block.h.

uint32 NL3D::CPrimitiveBlock::_StripIdx [private]
 

Todo:
hulud: support for strips and fans

Definition at line 68 of file 3d/primitive_block.h.

std::vector<uint32> NL3D::CPrimitiveBlock::_Tri [private]
 

Definition at line 54 of file 3d/primitive_block.h.

Referenced by getTriPointer(), reserveTri(), serial(), and setTri().

uint32 NL3D::CPrimitiveBlock::_TriCapacity [private]
 

Definition at line 53 of file 3d/primitive_block.h.

Referenced by capacityTri(), CPrimitiveBlock(), reserveTri(), serial(), and setNumTri().


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