From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02371.html | 602 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 602 insertions(+) create mode 100644 docs/doxygen/nel/a02371.html (limited to 'docs/doxygen/nel/a02371.html') diff --git a/docs/doxygen/nel/a02371.html b/docs/doxygen/nel/a02371.html new file mode 100644 index 00000000..51fef992 --- /dev/null +++ b/docs/doxygen/nel/a02371.html @@ -0,0 +1,602 @@ + + +NeL: NL3D::CCoarseMeshManager class Reference + + + +
+

NL3D::CCoarseMeshManager Class Reference

#include <coarse_mesh_manager.h> +

+


Detailed Description

+Management of coarse meshes.

+This container will render meshes with very low polygon count efficiently.

+All coarse meshes must use a common vertex format. It is a pos + UV vertex format. (NL3D_COARSEMESH_VERTEX_FORMAT_EXPORT)

+Internally the CCoarseMeshManager store meshes with pos + UV + color vertex format, to color instances (NL3D_COARSEMESH_VERTEX_FORMAT_MGR)

+Coarse meshes must use indexed triangle primitive in a single render pass in a single matrix block.

+All coarse meshes musts use a single material. It is a simple mapping with alpha test rendering and a common texture.

+The coarse meshes must have been preprocessed to build the common texture and remap the UV mapping coordinates in the new common texture.

+The manager must have been setuped with the common texture.

+

Author:
Cyril 'Hulud' Corvazier, Lionel Berenguier

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 85 of file coarse_mesh_manager.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

bool addMesh (uint numVertices, const uint8 *vBuffer, uint numTris, const uint32 *indexBuffer)
 CCoarseMeshManager ()
 Constructor.

void flushRender (IDriver *drv)
uint getColorOff () const
CMaterialgetMaterial ()
uint getUVOff () const
uint getVertexSize () const
 Get the VertexSize of the MGR format.

void setTextureFile (const char *file)
 Set texture file to use with this coarse mesh.


Private Attributes

uint _CurrentNumTriangles
uint _CurrentNumVertices
CMaterial _Material
CSmartPtr< CTextureFile_Texture
std::vector< uint32_Triangles
CVertexBuffer _VBuffer
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CCoarseMeshManager::CCoarseMeshManager  ) 
+
+ + + + + +
+   + + +

+Constructor. +

+

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NL3D::CCoarseMeshManager::addMesh uint  numVertices,
const uint8 vBuffer,
uint  numTris,
const uint32 indexBuffer
+
+ + + + + +
+   + + +

+Add a coarse mesh in the manager. If an error occured, it returns CantAddCoarseMesh.

Parameters:
+ + + +
vBuffer the VertexBuffer pre-transformed / Colored. Size MUST be numVertices*NL3D_COARSEMESH_VERTEX_FORMAT_MGR
indexBuffer containing triangles that will be inserted.
+
+
Returns:
false if the mesh can't be added to this pass BECAUSE OF TOO MANY VERTICES or TOO MANY PRIMITIVES reason You may call flushRender(), then restart a block. NB: if numVertices>NL3D_COARSEMESH_VERTEXBUFFER_SIZE or if numTriangles>NL3D_COARSEMESH_TRIANGLE_SIZE, it will always return false
+ +

+Definition at line 84 of file coarse_mesh_manager.cpp. +

+References _CurrentNumTriangles, _CurrentNumVertices, _Triangles, _VBuffer, NL3D::CVertexBuffer::getVertexCoordPointer(), NL3D::CVertexBuffer::getVertexSize(), H_AUTO_USE, NL3D_COARSEMESH_TRIANGLE_SIZE, NL3D_COARSEMESH_VERTEXBUFFER_SIZE, uint, uint32, and uint8. +

+Referenced by NL3D::CMeshMultiLod::renderCoarseMesh(). +

+

00085 {
+00086         H_AUTO_USE( NL3D_StaticLod_AddMesh );
+00087 
+00088         // if 0 mesh, quit
+00089         if(numTris==0 || numVertices==0)
+00090                 return true;
+00091 
+00092         // check vertex size
+00093         if(_CurrentNumVertices + numVertices > NL3D_COARSEMESH_VERTEXBUFFER_SIZE)
+00094                 return false;
+00095 
+00096         // check tri size
+00097         if(_CurrentNumTriangles + numTris> NL3D_COARSEMESH_TRIANGLE_SIZE)
+00098                 return false;
+00099         
+00100         // Copy Vertices to VBuffer
+00101         uint    baseVertex= _CurrentNumVertices;
+00102         CFastMem::memcpy(_VBuffer.getVertexCoordPointer(baseVertex), vBuffer, numVertices*_VBuffer.getVertexSize());
+00103         // next
+00104         _CurrentNumVertices+= numVertices;
+00105 
+00106         // Copy tris to triangles, adding baseVertex to index
+00107         uint32                  *triDst= &_Triangles[_CurrentNumTriangles*3];
+00108         const uint32    *triSrc= indexBuffer;
+00109         uint    numIdx= numTris*3;
+00110         // NB: for the majority of CoarseMesh (4 faces==48 bytes of indices), not interressant to use CFastMem::precache()
+00111         for(;numIdx>0;numIdx--, triSrc++, triDst++)
+00112         {
+00113                 *triDst= *triSrc + baseVertex;
+00114         }
+00115         // next
+00116         _CurrentNumTriangles+= numTris;
+00117 
+00118         return true;
+00119 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CCoarseMeshManager::flushRender IDriver drv  ) 
+
+ + + + + +
+   + + +

+Render the container +

+Definition at line 123 of file coarse_mesh_manager.cpp. +

+References _CurrentNumTriangles, _CurrentNumVertices, _Triangles, _VBuffer, NL3D::IDriver::activeVertexBuffer(), H_AUTO, NL3D::IDriver::renderTriangles(), and NL3D::IDriver::setupModelMatrix(). +

+Referenced by NL3D::CMeshMultiLod::renderCoarseMesh(), and NL3D::CRenderTrav::traverse(). +

+

00124 {
+00125         H_AUTO( NL3D_StaticLod_Render );
+00126 
+00127         // If not empty, render
+00128         if(_CurrentNumVertices && _CurrentNumTriangles)
+00129         {
+00130                 // Set Ident matrix
+00131                 drv->setupModelMatrix (CMatrix::Identity);
+00132 
+00133                 // Set VB
+00134                 drv->activeVertexBuffer(_VBuffer);
+00135 
+00136                 // render
+00137                 drv->renderTriangles(_Material, &_Triangles[0], _CurrentNumTriangles);
+00138         }
+00139 
+00140         // reset
+00141         _CurrentNumVertices= 0;
+00142         _CurrentNumTriangles= 0;
+00143 }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CCoarseMeshManager::getColorOff  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 119 of file coarse_mesh_manager.h. +

+References _VBuffer, NL3D::CVertexBuffer::getColorOff(), and uint. +

+Referenced by NL3D::CMeshMultiLod::renderCoarseMesh(). +

+

00119 {return (uint)_VBuffer.getColorOff();}
+
+

+ + + + +
+ + + + + + + + + +
CMaterial& NL3D::CCoarseMeshManager::getMaterial  )  [inline]
+
+ + + + + +
+   + + +

+Get material of the container. For rendering purpose only. +

+Definition at line 114 of file coarse_mesh_manager.h. +

+Referenced by NL3D::CMeshMultiLod::renderMeshGeom(). +

+

00114 {return _Material;}
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CCoarseMeshManager::getUVOff  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 118 of file coarse_mesh_manager.h. +

+References _VBuffer, NL3D::CVertexBuffer::getTexCoordOff(), and uint. +

+Referenced by NL3D::CMeshMultiLod::renderCoarseMesh(). +

+

00118 {return (uint)_VBuffer.getTexCoordOff(0);}
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CCoarseMeshManager::getVertexSize  )  const [inline]
+
+ + + + + +
+   + + +

+Get the VertexSize of the MGR format. +

+ +

+Definition at line 117 of file coarse_mesh_manager.h. +

+References _VBuffer, NL3D::CVertexBuffer::getVertexSize(), and uint. +

+Referenced by NL3D::CMeshMultiLod::instanciateCoarseMeshSpace(), and NL3D::CMeshMultiLod::renderCoarseMesh(). +

+

00117 {return _VBuffer.getVertexSize();}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CCoarseMeshManager::setTextureFile const char *  file  ) 
+
+ + + + + +
+   + + +

+Set texture file to use with this coarse mesh. +

+ +

+Definition at line 77 of file coarse_mesh_manager.cpp. +

+References file. +

+Referenced by NL3D::CScene::CScene(), and NL3D::CSceneUser::setCoarseMeshManagerTexture(). +

+

00078 {
+00079         _Texture->setFileName (file);
+00080 }
+
+


Field Documentation

+

+ + + + +
+ + +
uint NL3D::CCoarseMeshManager::_CurrentNumTriangles [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 126 of file coarse_mesh_manager.h. +

+Referenced by addMesh(), and flushRender().

+

+ + + + +
+ + +
uint NL3D::CCoarseMeshManager::_CurrentNumVertices [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 125 of file coarse_mesh_manager.h. +

+Referenced by addMesh(), and flushRender().

+

+ + + + +
+ + +
CMaterial NL3D::CCoarseMeshManager::_Material [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 132 of file coarse_mesh_manager.h.

+

+ + + + +
+ + +
CSmartPtr<CTextureFile> NL3D::CCoarseMeshManager::_Texture [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 129 of file coarse_mesh_manager.h.

+

+ + + + +
+ + +
std::vector<uint32> NL3D::CCoarseMeshManager::_Triangles [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 124 of file coarse_mesh_manager.h. +

+Referenced by addMesh(), and flushRender().

+

+ + + + +
+ + +
CVertexBuffer NL3D::CCoarseMeshManager::_VBuffer [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 123 of file coarse_mesh_manager.h. +

+Referenced by addMesh(), flushRender(), getColorOff(), getUVOff(), and getVertexSize().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 06:45:24 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1