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

NL3D::CVisualCollisionManager Class Reference

#include <visual_collision_manager.h> +

+


Detailed Description

+Server to Client collision manager. Snap logic position to Visual position.
Author:
Lionel Berenguier

+Nevrax France

+
Date:
2001
+ +

+ +

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

Public Member Functions

uint addMeshCollision (const std::vector< CVector > &vertices, const std::vector< uint16 > &triangles)
CVisualCollisionEntitycreateEntity ()
 CVisualCollisionManager ()
 Constructor.

void deleteEntity (CVisualCollisionEntity *entity)
float getCameraCollision (const CVector &start, const CVector &end, float radius, bool cone)
void removeMeshCollision (uint id)
void setLandscape (CLandscape *landscape)
void setSunContributionPower (float power, float maxThreshold)
 ~CVisualCollisionManager ()

Private Types

typedef std::map< uint32,
+ CMeshCol
TMeshColMap

Private Member Functions

void deletePatchQuadBlock (CPatchQuadBlock *ptr)
void deleteVisualTileDescNode (CVisualTileDescNode *ptr)
CPatchQuadBlocknewPatchQuadBlock ()
CVisualTileDescNodenewVisualTileDescNode ()

Private Attributes

NLMISC::CRefPtr< CLandscape_Landscape
 The landscape used to generate tiles, and to snap position to tesselated ground.

uint32 _MeshIdPool
CQuadGrid< CMeshCol * > _MeshQuadGrid
TMeshColMap _Meshs
CBlockMemory< CPatchQuadBlock_PatchQuadBlockAllocator
uint8 _SunContributionLUT [256]
CBlockMemory< CVisualTileDescNode_TileDescNodeAllocator
 Allocators.


Friends

class CLandscapeCollisionGrid
class CVisualCollisionEntity
+


Member Typedef Documentation

+

+ + + + +
+ + +
typedef std::map<uint32, CMeshCol> NL3D::CVisualCollisionManager::TMeshColMap [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 201 of file visual_collision_manager.h.

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CVisualCollisionManager::CVisualCollisionManager  ) 
+
+ + + + + +
+   + + +

+Constructor. +

+ +

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

+References _MeshIdPool, _MeshQuadGrid, NL3D::CQuadGrid< CMeshCol * >::create(), NL3D::MeshColQuadGridEltSize, NL3D::MeshColQuadGridSize, NL3D::PatchQuadBlockAllocatorBlockSize, setSunContributionPower(), and NL3D::TileDescNodeAllocatorBlockSize. +

+

00053                                                  : 
+00054         _TileDescNodeAllocator(TileDescNodeAllocatorBlockSize), 
+00055         _PatchQuadBlockAllocator(PatchQuadBlockAllocatorBlockSize)
+00056 {
+00057         _Landscape= NULL;
+00058 
+00059         // Default.
+00060         setSunContributionPower(0.5f, 0.5f);
+00061 
+00062         // init the mesh quadGrid
+00063         _MeshQuadGrid.create(MeshColQuadGridSize, MeshColQuadGridEltSize);
+00064         // valid id start at 1
+00065         _MeshIdPool= 1;
+00066 }
+
+

+ + + + +
+ + + + + + + + + +
NL3D::CVisualCollisionManager::~CVisualCollisionManager  ) 
+
+ + + + + +
+   + + +

+ +

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

+

00069 {
+00070         _Landscape= NULL;
+00071 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
uint NL3D::CVisualCollisionManager::addMeshCollision const std::vector< CVector > &  vertices,
const std::vector< uint16 > &  triangles
+
+ + + + + +
+   + + +

+Add a Mesh to the collision manager. For now it is used only for Camera Collision number of vertices and number of triangles must not exceed 65535

Returns:
the id used for remove, 0 if not succeed
+ +

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

+References _MeshIdPool, _MeshQuadGrid, _Meshs, NL3D::CVisualCollisionManager::CMeshCol::BBox, NL3D::CVisualCollisionManager::CMeshCol::build(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), NL3D::CQuadGrid< CMeshCol * >::insert(), NL3D::CVisualCollisionManager::CMeshCol::QuadGridIt, uint, and uint32. +

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

+

00402 {
+00403         if(vertices.empty() || triangles.empty())
+00404                 return 0;
+00405         // triangles id are stored in uint16 form. so their should not be more than 65535*3 indices
+00406         if(vertices.size()>65535 || triangles.size()>65535*3)
+00407                 return 0;
+00408 
+00409         // allocate a new id
+00410         uint32  id= _MeshIdPool++;
+00411 
+00412         // insert in map
+00413         CMeshCol        &mesh= _Meshs[id];
+00414 
+00415         // Build the col mesh
+00416         mesh.build(vertices, triangles);
+00417 
+00418         // insert in quadGrid
+00419         mesh.QuadGridIt= _MeshQuadGrid.insert(mesh.BBox.getMin(), mesh.BBox.getMax(), &mesh);
+00420 
+00421         return id;
+00422 }
+
+

+ + + + +
+ + + + + + + + + +
CVisualCollisionEntity * NL3D::CVisualCollisionManager::createEntity  ) 
+
+ + + + + +
+   + + +

+create an entity. NB: CVisualCollisionManager do not owns this ptr for now, and you must delete it with deleteEntity(). NB: CVisualCollisionEntity are no more valid when this manager is deleted. +

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

+References CVisualCollisionEntity. +

+Referenced by NL3D::CInstanceLighter::computeSunContribution(). +

+

00083 {
+00084         return new CVisualCollisionEntity(this);
+00085 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CVisualCollisionManager::deleteEntity CVisualCollisionEntity entity  ) 
+
+ + + + + +
+   + + +

+delete an entity. +

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

+Referenced by NL3D::CInstanceLighter::computeSunContribution(), and NL3D::CVisualCollisionEntityUser::~CVisualCollisionEntityUser(). +

+

00090 {
+00091         delete entity;
+00092 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CVisualCollisionManager::deletePatchQuadBlock CPatchQuadBlock ptr  )  [private]
+
+ + + + + +
+   + + +

+ +

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

+References _PatchQuadBlockAllocator, and NLMISC::CBlockMemory< CPatchQuadBlock >::free(). +

+Referenced by NL3D::CVisualCollisionEntity::doComputeLandscape(), and NL3D::CVisualCollisionEntity::~CVisualCollisionEntity(). +

+

00115 {
+00116         _PatchQuadBlockAllocator.free(ptr);
+00117 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CVisualCollisionManager::deleteVisualTileDescNode CVisualTileDescNode ptr  )  [private]
+
+ + + + + +
+   + + +

+ +

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

+References _TileDescNodeAllocator, and NLMISC::CBlockMemory< CVisualTileDescNode >::free(). +

+Referenced by NL3D::CLandscapeCollisionGrid::clear(). +

+

00103 {
+00104         _TileDescNodeAllocator.free(ptr);
+00105 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
float NL3D::CVisualCollisionManager::getCameraCollision const CVector start,
const CVector end,
float  radius,
bool  cone
+
+ + + + + +
+   + + +

+Get Typical Camera 3rd person collision. For landscape, it is done only against TileFaces (ie only under approx 50 m) return a [0,1] value. 0 => collision at start. 1 => no collision.

Parameters:
+ + + +
radius is the radius of the 'cylinder'
cone if true, the object tested is a cone (radius goes to end)
+
+ +

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

+References _MeshQuadGrid, NL3D::CCameraCol::BBox, NL3D::CQuadGrid< CMeshCol * >::begin(), NL3D::CCameraCol::build(), NL3D::CQuadGrid< CMeshCol * >::end(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), min, and NL3D::CQuadGrid< CMeshCol * >::select(). +

+Referenced by NL3D::CVisualCollisionManagerUser::getCameraCollision(). +

+

00145 {
+00146         float   minCol= 1;
+00147 
+00148         // try col with landscape
+00149         if(_Landscape)
+00150         {
+00151                 minCol= _Landscape->getCameraCollision(start, end, radius, cone);
+00152         }
+00153 
+00154         // try col with meshes
+00155         CCameraCol              camCol;
+00156         camCol.build(start, end, radius, cone);
+00157         _MeshQuadGrid.select(camCol.BBox.getMin(), camCol.BBox.getMax());
+00158         // try to intersect with any meshs
+00159         CQuadGrid<CMeshCol*>::CIterator         it;
+00160         for(it= _MeshQuadGrid.begin();it!=_MeshQuadGrid.end();it++)
+00161         {
+00162                 float   meshCol= (*it)->getCameraCollision(camCol);
+00163                 // Keep only yhe smallest value
+00164                 minCol= min(minCol, meshCol);
+00165         }
+00166 
+00167         return minCol;
+00168 }
+
+

+ + + + +
+ + + + + + + + + +
CPatchQuadBlock * NL3D::CVisualCollisionManager::newPatchQuadBlock  )  [private]
+
+ + + + + +
+   + + +

+ +

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

+References _PatchQuadBlockAllocator, and NLMISC::CBlockMemory< CPatchQuadBlock >::allocate(). +

+Referenced by NL3D::CVisualCollisionEntity::doComputeLandscape(). +

+

00109 {
+00110         return _PatchQuadBlockAllocator.allocate();
+00111 }
+
+

+ + + + +
+ + + + + + + + + +
CVisualTileDescNode * NL3D::CVisualCollisionManager::newVisualTileDescNode  )  [private]
+
+ + + + + +
+   + + +

+ +

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

+References _TileDescNodeAllocator, and NLMISC::CBlockMemory< CVisualTileDescNode >::allocate(). +

+Referenced by NL3D::CLandscapeCollisionGrid::addQuadToGrid(). +

+

00097 {
+00098         return _TileDescNodeAllocator.allocate();
+00099 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CVisualCollisionManager::removeMeshCollision uint  id  ) 
+
+ + + + + +
+   + + +

+Remove a Mesh from the collision manager. +

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

+References _MeshQuadGrid, _Meshs, NL3D::CQuadGrid< CMeshCol * >::erase(), and uint. +

+Referenced by NL3D::CVisualCollisionManagerUser::removeMeshCollision(). +

+

00426 {
+00427         // find in map
+00428         TMeshColMap::iterator   it= _Meshs.find(id);
+00429         if(it!=_Meshs.end())
+00430         {
+00431                 // remove from the quadgrid
+00432                 _MeshQuadGrid.erase(it->second.QuadGridIt);
+00433                 // remove from the map
+00434                 _Meshs.erase(it);
+00435         }
+00436 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CVisualCollisionManager::setLandscape CLandscape landscape  ) 
+
+ + + + + +
+   + + +

+setup the landscape used for this collision manager. ptr is kept, and manager and all entities must be cleared when the landscape is deleted. +

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

+Referenced by NL3D::CInstanceLighter::computeSunContribution(), and NL3D::CVisualCollisionManagerUser::setLandscape(). +

+

00076 {
+00077         _Landscape= landscape;
+00078 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CVisualCollisionManager::setSunContributionPower float  power,
float  maxThreshold
+
+ + + + + +
+   + + +

+for CVisualCollisionEntity::getStaticLightSetup().

See also:
CVisualCollisionEntity::getStaticLightSetup()
+Build a lighting table to remap sun contribution from landscape to sun contribution for objects. The value remap the landscape sun contribution (0 ~ 1) to an object sun contribution (0 ~1) using the following formula:

+objectSunContribution = min ( powf ( landscapeSunContribution / maxThreshold, power ), 1 );

+Default is 0.5 (=> sqrt) for power and 0.5 for maxThreshold. +

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

+References _SunContributionLUT, NLMISC::clamp(), sint, and uint. +

+Referenced by CVisualCollisionManager(), and NL3D::CVisualCollisionManagerUser::setSunContributionPower(). +

+

00122 {
+00123         NLMISC::clamp(power, 0.f, 1.f);
+00124 
+00125         for(uint i=0; i<256; i++)
+00126         {
+00127                 float   f= i/255.f;
+00128                 f = powf(f/maxThreshold, power);
+00129                 sint    uf= (sint)floor(255*f);
+00130                 NLMISC::clamp(uf, 0, 255);
+00131                 _SunContributionLUT[i]= uf;
+00132         }
+00133 
+00134 }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend class CLandscapeCollisionGrid [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 211 of file visual_collision_manager.h.

+

+ + + + +
+ + +
friend class CVisualCollisionEntity [friend] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by createEntity().

+


Field Documentation

+

+ + + + +
+ + +
NLMISC::CRefPtr<CLandscape> NL3D::CVisualCollisionManager::_Landscape [private] +
+
+ + + + + +
+   + + +

+The landscape used to generate tiles, and to snap position to tesselated ground. +

+ +

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

+Referenced by NL3D::CVisualCollisionEntity::doComputeLandscape(), NL3D::CVisualCollisionEntity::getPatchTriangleUnderUs(), NL3D::CVisualCollisionEntity::getStaticLightSetup(), NL3D::CVisualCollisionEntity::getSurfaceInfo(), and NL3D::CVisualCollisionEntity::snapToLandscapeCurrentTesselation().

+

+ + + + +
+ + +
uint32 NL3D::CVisualCollisionManager::_MeshIdPool [private] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by addMeshCollision(), and CVisualCollisionManager().

+

+ + + + +
+ + +
CQuadGrid<CMeshCol*> NL3D::CVisualCollisionManager::_MeshQuadGrid [private] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by addMeshCollision(), CVisualCollisionManager(), getCameraCollision(), and removeMeshCollision().

+

+ + + + +
+ + +
TMeshColMap NL3D::CVisualCollisionManager::_Meshs [private] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by addMeshCollision(), and removeMeshCollision().

+

+ + + + +
+ + +
CBlockMemory<CPatchQuadBlock> NL3D::CVisualCollisionManager::_PatchQuadBlockAllocator [private] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by deletePatchQuadBlock(), and newPatchQuadBlock().

+

+ + + + +
+ + +
uint8 NL3D::CVisualCollisionManager::_SunContributionLUT[256] [private] +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by NL3D::CVisualCollisionEntity::getStaticLightSetup(), and setSunContributionPower().

+

+ + + + +
+ + +
CBlockMemory<CVisualTileDescNode> NL3D::CVisualCollisionManager::_TileDescNodeAllocator [private] +
+
+ + + + + +
+   + + +

+Allocators. +

+ +

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

+Referenced by deleteVisualTileDescNode(), and newVisualTileDescNode().

+


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