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

NL3D::CVisualCollisionManager::CMeshCol Class Reference

+ + + + + + + + + + + + + + + + + +

Public Member Functions

void build (const std::vector< CVector > &vertices, const std::vector< uint16 > &triangles)
float getCameraCollision (class CCameraCol &camCol)

Data Fields

NLMISC::CAABBox BBox
CStaticGrid QuadGrid
CQuadGrid< CMeshCol * >::CIterator QuadGridIt
std::vector< uint16Triangles
std::vector< CVectorVertices
+

Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CVisualCollisionManager::CMeshCol::build const std::vector< CVector > &  vertices,
const std::vector< uint16 > &  triangles
+
+ + + + + +
+   + + +

+ +

+Definition at line 370 of file visual_collision_manager.cpp. +

+References NL3D::CVisualCollisionManager::CStaticGrid::add(), NL3D::CVisualCollisionManager::CStaticGrid::compile(), NL3D::CVisualCollisionManager::CStaticGrid::create(), NLMISC::CAABBox::extend(), nlassert, QuadGrid, NLMISC::CAABBox::setCenter(), and uint. +

+Referenced by NL3D::CVisualCollisionManager::addMeshCollision(). +

+

00371 {
+00372         uint    i;
+00373         nlassert(!vertices.empty());
+00374 
+00375         // copy
+00376         Vertices= vertices;
+00377         Triangles= triangles;
+00378         
+00379         // Build the bbox for this col mesh
+00380         BBox.setCenter(vertices[0]);
+00381         for(i=1;i<vertices.size();i++)
+00382                 BBox.extend(vertices[i]);
+00383 
+00384         // Build the Static Grid
+00385         uint    numTris= triangles.size()/3;
+00386         QuadGrid.create(16, numTris, BBox);
+00387         // Add all triangles
+00388         for(i=0;i<numTris;i++)
+00389         {
+00390                 CAABBox         bb;
+00391                 bb.setCenter(Vertices[Triangles[i*3+0]]);
+00392                 bb.extend(Vertices[Triangles[i*3+1]]);
+00393                 bb.extend(Vertices[Triangles[i*3+2]]);
+00394                 QuadGrid.add(i, bb);
+00395         }
+00396         // compile
+00397         QuadGrid.compile();
+00398 }
+
+

+ + + + +
+ + + + + + + + + + +
float NL3D::CVisualCollisionManager::CMeshCol::getCameraCollision class CCameraCol camCol  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 330 of file visual_collision_manager.cpp. +

+References NL3D::CCameraCol::BBox, NL3D::CCameraCol::End, NLMISC::CAABBox::intersect(), min, NL3D::CCameraCol::minimizeDistanceAgainstTri(), QuadGrid, NL3D::CVisualCollisionManager::CStaticGrid::select(), NL3D::CCameraCol::Start, and uint. +

+

00331 {
+00332         // first test if intersect with the bboxes
+00333         if(!camCol.BBox.intersect(BBox))
+00334                 return 1;
+00335 
+00336         // Select triangles
+00337         static std::vector<uint16>              selection;
+00338         uint    numSel= QuadGrid.select(camCol.BBox, selection);
+00339 
+00340         // **** For all triangles, test if intersect the camera collision
+00341         float           sqrMinDist= FLT_MAX;
+00342         for(uint i=0;i<numSel;i++)
+00343         {
+00344                 uint                    triId= selection[i];
+00345                 // build the triangle
+00346                 camCol.minimizeDistanceAgainstTri(
+00347                         Vertices[Triangles[triId*3+0]],
+00348                         Vertices[Triangles[triId*3+1]],
+00349                         Vertices[Triangles[triId*3+2]],
+00350                         sqrMinDist);
+00351         }
+00352         
+00353         // **** return the collision found, between [0,1]
+00354         if(sqrMinDist == FLT_MAX)
+00355                 return 1;
+00356         else
+00357         {
+00358                 float   f= 1;
+00359                 float   d= (camCol.End-camCol.Start).norm();
+00360                 if(d>0)
+00361                 {
+00362                         f= sqrtf(sqrMinDist) / d;
+00363                         f= min(f, 1.f);
+00364                 }
+00365                 return f;
+00366         }
+00367 }
+
+


Field Documentation

+

+ + + + +
+ + +
NLMISC::CAABBox NL3D::CVisualCollisionManager::CMeshCol::BBox +
+
+ + + + + +
+   + + +

+ +

+Definition at line 188 of file visual_collision_manager.h. +

+Referenced by NL3D::CVisualCollisionManager::addMeshCollision().

+

+ + + + +
+ + +
CStaticGrid NL3D::CVisualCollisionManager::CMeshCol::QuadGrid +
+
+ + + + + +
+   + + +

+ +

+Definition at line 192 of file visual_collision_manager.h. +

+Referenced by build(), and getCameraCollision().

+

+ + + + +
+ + +
CQuadGrid<CMeshCol*>::CIterator NL3D::CVisualCollisionManager::CMeshCol::QuadGridIt +
+
+ + + + + +
+   + + +

+ +

+Definition at line 190 of file visual_collision_manager.h. +

+Referenced by NL3D::CVisualCollisionManager::addMeshCollision().

+

+ + + + +
+ + +
std::vector<uint16> NL3D::CVisualCollisionManager::CMeshCol::Triangles +
+
+ + + + + +
+   + + +

+ +

+Definition at line 186 of file visual_collision_manager.h.

+

+ + + + +
+ + +
std::vector<CVector> NL3D::CVisualCollisionManager::CMeshCol::Vertices +
+
+ + + + + +
+   + + +

+ +

+Definition at line 185 of file visual_collision_manager.h.

+


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