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/a03168.html | 394 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 394 insertions(+) create mode 100644 docs/doxygen/nel/a03168.html (limited to 'docs/doxygen/nel/a03168.html') diff --git a/docs/doxygen/nel/a03168.html b/docs/doxygen/nel/a03168.html new file mode 100644 index 00000000..5778e501 --- /dev/null +++ b/docs/doxygen/nel/a03168.html @@ -0,0 +1,394 @@ + + +NeL: NL3D::CPSConstraintMesh::CMeshDisplayShare class Reference + + + +
+

NL3D::CPSConstraintMesh::CMeshDisplayShare Class Reference

#include <ps_mesh.h> +

+


Detailed Description

+This class manage sharing between several mesh displays. There can be a limited number of them at a given time. +

+ +

+Definition at line 480 of file ps_mesh.h. + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 CMeshDisplayShare (uint maxNumMD)
 ctor giving the max number of CDipslayMesh structures to be kept simultaneously.

CMeshDisplaygetMeshDisplay (CMesh *mesh, uint32 format)

Static Private Member Functions

void buildRdrPassSet (TRdrPassSet &dest, const CMesh &mesh)
 build a set of render pass from a mesh

void buildVB (CVertexBuffer &dest, const CMesh &mesh, uint32 format)
 Build a vb from a shape. The format can add an additionnal color.


Private Attributes

std::list< CMDEntry_Cache
uint _MaxNumMD
uint _NumMD
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + +
NL3D::CPSConstraintMesh::CMeshDisplayShare::CMeshDisplayShare uint  maxNumMD  )  [inline]
+
+ + + + + +
+   + + +

+ctor giving the max number of CDipslayMesh structures to be kept simultaneously. +

+ +

+Definition at line 484 of file ps_mesh.h. +

+References _MaxNumMD, _NumMD, and uint. +

+

00484 : _MaxNumMD(maxNumMD), _NumMD(0) {}
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPSConstraintMesh::CMeshDisplayShare::buildRdrPassSet TRdrPassSet dest,
const CMesh mesh
[static, private]
+
+ + + + + +
+   + + +

+build a set of render pass from a mesh +

+ +

+Definition at line 2064 of file ps_mesh.cpp. +

+References NL3D::ConstraintMeshBufSize, NL3D::DuplicatePrimitiveBlock(), NL3D::CMeshBase::getMaterial(), NL3D::CMesh::getNbMatrixBlock(), NL3D::CMesh::getNbRdrPass(), NL3D::CVertexBuffer::getNumVertices(), NL3D::CMesh::getRdrPassMaterial(), NL3D::CMesh::getRdrPassPrimitiveBlock(), NL3D::CMesh::getVertexBuffer(), nlassert, NL3D::CPSConstraintMesh::TRdrPassSet, and uint. +

+Referenced by getMeshDisplay(). +

+

02065 {               
+02066         // we don't support skinning for mesh particles, so there must be only one matrix block 
+02067         nlassert(m.getNbMatrixBlock() == 1);  // SKINNING UNSUPPORTED
+02068         
+02069         dest.resize(m.getNbRdrPass(0));
+02070         const CVertexBuffer &srcVb = m.getVertexBuffer();
+02071         
+02072         for (uint k = 0; k < m.getNbRdrPass(0); ++k)
+02073         {
+02074                 dest[k].Mat = m.getMaterial(m.getRdrPassMaterial(0, k));
+02075                 dest[k].SourceMat = dest[k].Mat;
+02076                 DuplicatePrimitiveBlock(m.getRdrPassPrimitiveBlock(0, k), dest[k].Pb, ConstraintMeshBufSize, srcVb.getNumVertices() );          
+02077         }       
+02078 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CPSConstraintMesh::CMeshDisplayShare::buildVB CVertexBuffer dest,
const CMesh mesh,
uint32  destFormat
[static, private]
+
+ + + + + +
+   + + +

+Build a vb from a shape. The format can add an additionnal color. +

+we duplicate the original mesh data's 'ConstraintMeshBufSize' times, eventually adding a color +

+Definition at line 2081 of file ps_mesh.cpp. +

+References NL3D::ConstraintMeshBufSize, NL3D::CVertexBuffer::getColorOff(), NL3D::CVertexBuffer::getNumVertices(), NL3D::CVertexBuffer::getUVRouting(), NL3D::CMesh::getVertexBuffer(), NL3D::CVertexBuffer::getVertexCoordPointer(), NL3D::CVertexBuffer::getVertexFormat(), NL3D::CVertexBuffer::getVertexSize(), nlassert, NL3D::CVertexBuffer::setNumVertices(), NL3D::CVertexBuffer::setUVRouting(), NL3D::CVertexBuffer::setVertexFormat(), sint, uint, uint32, uint8, and v. +

+Referenced by getMeshDisplay(). +

+

02082 {
+02084         const CVertexBuffer &meshVb = mesh.getVertexBuffer();   
+02085         nlassert(destFormat == meshVb.getVertexFormat() || destFormat == (meshVb.getVertexFormat() | (uint32) CVertexBuffer::PrimaryColorFlag) );
+02086         dest.setVertexFormat(destFormat);       
+02087         dest.setNumVertices(ConstraintMeshBufSize * meshVb.getNumVertices());
+02088         for(uint k = 0; k < CVertexBuffer::MaxStage; ++k)
+02089         {
+02090                 dest.setUVRouting((uint8) k, meshVb.getUVRouting()[k]);
+02091         }
+02092 
+02093 
+02094         uint8 *outPtr = (uint8 *) dest.getVertexCoordPointer();
+02095         uint8 *inPtr = (uint8 *)  meshVb.getVertexCoordPointer();
+02096         uint  meshSize  = dest.getVertexSize() * meshVb.getNumVertices();
+02097 
+02098         if (destFormat == meshVb.getVertexFormat()) // no color added
+02099         {               
+02100                 for (uint k = 0; k < ConstraintMeshBufSize; ++k)
+02101                 {
+02102                         ::memcpy((void *) (outPtr + k * meshSize), (void *) inPtr, meshSize);                   
+02103                 }
+02104         }
+02105         else // color added, but not available in src 
+02106         {
+02107                 sint colorOff = dest.getColorOff();
+02108                 uint inVSize    = meshVb.getVertexSize();
+02109                 uint outVSize   = dest.getVertexSize();         
+02110                 for (uint k = 0; k < ConstraintMeshBufSize; ++k)
+02111                 {
+02112                         for (uint v = 0; v < meshVb.getNumVertices(); ++v)
+02113                         {
+02114                                 // copy until color
+02115                                 ::memcpy((void *) (outPtr + k * meshSize + v * outVSize), (void *) (inPtr + v * inVSize), colorOff);
+02116                                 // copy datas after color
+02117                                 ::memcpy((void *) (outPtr + k * meshSize + v * outVSize + colorOff + sizeof(uint8[4])), (void *) (inPtr + v * inVSize + colorOff), inVSize - colorOff);
+02118                         }
+02119                 }
+02120         }
+02121 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
CPSConstraintMesh::CMeshDisplay & NL3D::CPSConstraintMesh::CMeshDisplayShare::getMeshDisplay CMesh mesh,
uint32  format
+
+ + + + + +
+   + + +

+ +

+Definition at line 2033 of file ps_mesh.cpp. +

+References _Cache, _MaxNumMD, _NumMD, buildRdrPassSet(), buildVB(), format, nlassert, and uint32. +

+Referenced by NL3D::CPSConstraintMesh::restoreMaterials(). +

+

02034 {
+02035         nlassert(mesh); 
+02036         // linear search is ok because of small size
+02037         for(std::list<CMDEntry>::iterator it = _Cache.begin(); it != _Cache.end(); ++it)
+02038         {
+02039                 if (it->Format == format && it->Mesh == mesh)
+02040                 {
+02041                         // relink at start (most recent use)
+02042                         _Cache.splice(_Cache.begin(), _Cache, it);
+02043                         return it->MD;
+02044                 }
+02045         }
+02046         if (_NumMD == _MaxNumMD)
+02047         {
+02048                 _Cache.pop_back(); // remove least recently used mesh
+02049                 -- _NumMD;
+02050         }
+02051         //NLMISC::TTicks start = NLMISC::CTime::getPerformanceTime();   
+02052         _Cache.push_front(CMDEntry());
+02053         _Cache.front().Mesh = mesh;
+02054         _Cache.front().Format = format;
+02055         buildRdrPassSet(_Cache.front().MD.RdrPasses, *mesh);
+02056         buildVB(_Cache.front().MD.VB, *mesh, format);
+02057         ++ _NumMD;
+02058         /*NLMISC::TTicks end = NLMISC::CTime::getPerformanceTime();
+02059         nlinfo("mesh setup time = %.2f", (float) (1000 * NLMISC::CTime::ticksToSecond(end - start)));   */
+02060         return _Cache.front().MD;
+02061 }
+
+


Field Documentation

+

+ + + + +
+ + +
std::list<CMDEntry> NL3D::CPSConstraintMesh::CMeshDisplayShare::_Cache [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 498 of file ps_mesh.h. +

+Referenced by getMeshDisplay().

+

+ + + + +
+ + +
uint NL3D::CPSConstraintMesh::CMeshDisplayShare::_MaxNumMD [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 496 of file ps_mesh.h. +

+Referenced by CMeshDisplayShare(), and getMeshDisplay().

+

+ + + + +
+ + +
uint NL3D::CPSConstraintMesh::CMeshDisplayShare::_NumMD [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 497 of file ps_mesh.h. +

+Referenced by CMeshDisplayShare(), and getMeshDisplay().

+


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