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

NL3D::UShape Class Reference

#include <u_shape.h> +

+


Detailed Description

+Game interface for managing shape. NB: unlike old GameInterface, here the UShape is a Proxy: it keep a ptr on a IShape, thus it can be created or destroyed statically, on the stack etc...

+

Author:
Lionel Berenguier

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 47 of file u_shape.h. + + + + + + + + + + + + + + + + + + +

Public Member Functions

void attach (class IShape *shape)
 Attach a IShape to this proxy.

bool cameraCollisionable () const
bool empty () const
 return true if the proxy is empty() (not attached)

bool getMeshTriangles (std::vector< NLMISC::CVector > &vertices, std::vector< uint32 > &indices) const
 UShape ()
 Proxy interface.


Private Attributes

IShape_Shape
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::UShape::UShape  ) 
+
+ + + + + +
+   + + +

+Proxy interface. +

+ +

+Definition at line 42 of file u_shape.cpp. +

+

00042                : _Shape(NULL)
+00043 {
+00044 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void NL3D::UShape::attach class IShape shape  ) 
+
+ + + + + +
+   + + +

+Attach a IShape to this proxy. +

+ +

+Definition at line 47 of file u_shape.cpp. +

+Referenced by NL3D::CShapeBankUser::getShape(). +

+

00048 {
+00049         _Shape= shape;
+00050 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::UShape::cameraCollisionable  )  const
+
+ + + + + +
+   + + +

+Return true if this mesh is candidate for Camera Collision For now return true if have some lightmap! +

+Definition at line 125 of file u_shape.cpp. +

+References NL3D::CMeshBase::_LightInfos. +

+

00126 {
+00127         /* For now do it easy, take only lightmapped (ie big) objects. An object that is lightmapped
+00128                 should have some lightInfos
+00129         */
+00130         CMeshBase                       *mesh= dynamic_cast<CMeshBase*>(_Shape);
+00131         if(mesh)
+00132         {
+00133                 return !mesh->_LightInfos.empty();
+00134         }
+00135         else
+00136                 return false;
+00137 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::UShape::empty  )  const [inline]
+
+ + + + + +
+   + + +

+return true if the proxy is empty() (not attached) +

+ +

+Definition at line 56 of file u_shape.h. +

+

00056 {return _Shape==NULL;}
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NL3D::UShape::getMeshTriangles std::vector< NLMISC::CVector > &  vertices,
std::vector< uint32 > &  indices
const
+
+ + + + + +
+   + + +

+Get the mesh under Triangle Form. For now only CMesh and CMeshMultiLod (CMeshGeom only) are supported.

Parameters:
+ + + +
vertices array of vertices
indices triplets of indices to vertices
+
+
Returns:
false if cannot be converted
+ +

+Definition at line 53 of file u_shape.cpp. +

+References NL3D::CMeshMultiLod::getMeshGeom(), NL3D::CMesh::getMeshGeom(), NL3D::CMeshGeom::getNbMatrixBlock(), NL3D::CMeshGeom::getNbRdrPass(), NL3D::CMeshMultiLod::getNumSlotMesh(), NL3D::CPrimitiveBlock::getNumTri(), NL3D::CVertexBuffer::getNumVertices(), NL3D::CMeshGeom::getRdrPassPrimitiveBlock(), NL3D::CPrimitiveBlock::getTriPointer(), NL3D::CMeshGeom::getVertexBuffer(), NL3D::CVertexBuffer::getVertexCoordPointer(), NL3D::CVertexBuffer::getVertexSize(), uint, uint32, and uint8. +

+

00054 {
+00055         if(!_Shape)
+00056                 return false;
+00057 
+00058         // **** try to get a CMeshGeom
+00059         CMesh                           *mesh= dynamic_cast<CMesh*>(_Shape);
+00060         CMeshMultiLod           *meshMulti= dynamic_cast<CMeshMultiLod*>(_Shape);
+00061         const CMeshGeom         *meshGeom= NULL;
+00062         if(mesh)
+00063         {
+00064                 meshGeom= &mesh->getMeshGeom();
+00065         }
+00066         else if(meshMulti)
+00067         {
+00068                 // get the first (bigger) meshGeom
+00069                 if(meshMulti->getNumSlotMesh())
+00070                 {
+00071                         meshGeom= dynamic_cast<const CMeshGeom*>(&meshMulti->getMeshGeom(0));
+00072                 }
+00073         }
+00074 
+00075         if(!meshGeom)
+00076                 return false;
+00077 
+00078         // **** Build the vertices and indices
+00079         uint    i;
+00080         vertices.clear();
+00081         indices.clear();
+00082 
+00083         // build vertices
+00084         const CVertexBuffer     &vb= meshGeom->getVertexBuffer();
+00085         vertices.resize(vb.getNumVertices());
+00086         const uint8     *pVert= (const uint8*)vb.getVertexCoordPointer(0);
+00087         uint            vSize= vb.getVertexSize();
+00088         for(i=0;i<vertices.size();i++)
+00089         {
+00090                 vertices[i]= *(const CVector*)pVert;
+00091                 pVert+= vSize;
+00092         }
+00093 
+00094         // count numTris
+00095         uint    numTris= 0;
+00096         for(i=0;i<meshGeom->getNbMatrixBlock();i++)
+00097         {
+00098                 for(uint rp=0;rp<meshGeom->getNbRdrPass(i);rp++)
+00099                 {
+00100                         numTris+= meshGeom->getRdrPassPrimitiveBlock(i, rp).getNumTri();
+00101                 }
+00102         }
+00103         indices.resize(numTris*3);
+00104 
+00105         // build indices
+00106         uint    triIdx= 0;
+00107         for(i=0;i<meshGeom->getNbMatrixBlock();i++)
+00108         {
+00109                 for(uint rp=0;rp<meshGeom->getNbRdrPass(i);rp++)
+00110                 {
+00111                         const CPrimitiveBlock   &pb= meshGeom->getRdrPassPrimitiveBlock(i, rp);
+00112                         // copy
+00113                         memcpy(&indices[triIdx*3], pb.getTriPointer(), pb.getNumTri()*3*sizeof(uint32));
+00114                         // next
+00115                         triIdx+= pb.getNumTri();
+00116                 }
+00117         }
+00118         
+00119         // ok!
+00120         return true;
+00121 }
+
+


Field Documentation

+

+ + + + +
+ + +
class IShape* NL3D::UShape::_Shape [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 74 of file u_shape.h.

+


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