NL3D::CVisualCollisionManagerUser Class Reference

#include <visual_collision_manager_user.h>

Inheritance diagram for NL3D::CVisualCollisionManagerUser:

NL3D::UVisualCollisionManager

Detailed Description

UVisualCollisionManager implementation.
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 48 of file visual_collision_manager_user.h.

Public Member Functions

virtual uint addMeshCollision (const std::vector< CVector > &vertices, const std::vector< uint16 > &triangles)
virtual UVisualCollisionEntitycreateEntity ()
 CVisualCollisionManagerUser ()
 Constructor.

virtual void deleteEntity (UVisualCollisionEntity *entity)
virtual float getCameraCollision (const CVector &start, const CVector &end, float radius, bool cone)
virtual void removeMeshCollision (uint id)
virtual void setLandscape (ULandscape *landscape)
virtual void setSunContributionPower (float power, float maxThreshold)

Protected Types

typedef CPtrSet< CVisualCollisionEntityUserTVisualCollisionEntitySet

Protected Attributes

TVisualCollisionEntitySet _Entities
CVisualCollisionManager _Manager


Member Typedef Documentation

typedef CPtrSet<CVisualCollisionEntityUser> NL3D::CVisualCollisionManagerUser::TVisualCollisionEntitySet [protected]
 

Definition at line 103 of file visual_collision_manager_user.h.


Constructor & Destructor Documentation

NL3D::CVisualCollisionManagerUser::CVisualCollisionManagerUser  )  [inline]
 

Constructor.

Definition at line 53 of file visual_collision_manager_user.h.

References NL3D_MEM_VISUAL_COLLISION.

00054         {
00055                 NL3D_MEM_VISUAL_COLLISION
00056         }


Member Function Documentation

virtual uint NL3D::CVisualCollisionManagerUser::addMeshCollision const std::vector< CVector > &  vertices,
const std::vector< uint16 > &  triangles
[inline, virtual]
 

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

Implements NL3D::UVisualCollisionManager.

Definition at line 89 of file visual_collision_manager_user.h.

References NL3D::CVisualCollisionManager::addMeshCollision(), NL3D_MEM_CAMERA_COLLISION, and uint.

00090         {
00091                 NL3D_MEM_CAMERA_COLLISION
00092                 return _Manager.addMeshCollision(vertices, triangles);
00093         }

virtual UVisualCollisionEntity* NL3D::CVisualCollisionManagerUser::createEntity  )  [inline, virtual]
 

create an entity. NB: CVisualCollisionManager owns this ptr, and you must delete it with deleteEntity(). NB: all CVisualCollisionEntity are deleted when this manager is deleted.

Implements NL3D::UVisualCollisionManager.

Definition at line 65 of file visual_collision_manager_user.h.

References _Entities, NL3D::CPtrSet< T >::insert(), and NL3D_MEM_VISUAL_COLLISION.

00066         {
00067                 NL3D_MEM_VISUAL_COLLISION
00068                 return _Entities.insert(new CVisualCollisionEntityUser(&_Manager));
00069         }

virtual void NL3D::CVisualCollisionManagerUser::deleteEntity UVisualCollisionEntity entity  )  [inline, virtual]
 

delete an entity.

Implements NL3D::UVisualCollisionManager.

Definition at line 71 of file visual_collision_manager_user.h.

References _Entities, NL3D::CPtrSet< T >::erase(), and NL3D_MEM_VISUAL_COLLISION.

00072         {
00073                 NL3D_MEM_VISUAL_COLLISION
00074                 _Entities.erase(dynamic_cast<CVisualCollisionEntityUser*>(entity));
00075         }

virtual float NL3D::CVisualCollisionManagerUser::getCameraCollision const CVector start,
const CVector end,
float  radius,
bool  cone
[inline, virtual]
 

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)

Implements NL3D::UVisualCollisionManager.

Definition at line 83 of file visual_collision_manager_user.h.

References NL3D::CVisualCollisionManager::getCameraCollision(), and NL3D_MEM_CAMERA_COLLISION.

00084         {
00085                 NL3D_MEM_CAMERA_COLLISION
00086                 return _Manager.getCameraCollision (start, end, radius, cone);
00087         }

virtual void NL3D::CVisualCollisionManagerUser::removeMeshCollision uint  id  )  [inline, virtual]
 

Remove a Mesh from the collision manager.

Implements NL3D::UVisualCollisionManager.

Definition at line 95 of file visual_collision_manager_user.h.

References NL3D_MEM_CAMERA_COLLISION, NL3D::CVisualCollisionManager::removeMeshCollision(), and uint.

00096         {
00097                 NL3D_MEM_CAMERA_COLLISION
00098                 _Manager.removeMeshCollision(id);
00099         }

virtual void NL3D::CVisualCollisionManagerUser::setLandscape ULandscape landscape  )  [inline, virtual]
 

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

Implements NL3D::UVisualCollisionManager.

Definition at line 59 of file visual_collision_manager_user.h.

References NL3D_MEM_VISUAL_COLLISION, and NL3D::CVisualCollisionManager::setLandscape().

00060         {
00061                 NL3D_MEM_VISUAL_COLLISION
00062                 _Manager.setLandscape(&(dynamic_cast<CLandscapeUser*>(landscape)->getLandscape()->Landscape));
00063         }

virtual void NL3D::CVisualCollisionManagerUser::setSunContributionPower float  power,
float  maxThreshold
[inline, virtual]
 

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.

Implements NL3D::UVisualCollisionManager.

Definition at line 77 of file visual_collision_manager_user.h.

References NL3D_MEM_VISUAL_COLLISION, and NL3D::CVisualCollisionManager::setSunContributionPower().

00078         {
00079                 NL3D_MEM_VISUAL_COLLISION
00080                 _Manager.setSunContributionPower (power, maxThreshold);
00081         }


Field Documentation

TVisualCollisionEntitySet NL3D::CVisualCollisionManagerUser::_Entities [protected]
 

Definition at line 104 of file visual_collision_manager_user.h.

Referenced by createEntity(), and deleteEntity().

CVisualCollisionManager NL3D::CVisualCollisionManagerUser::_Manager [protected]
 

Definition at line 102 of file visual_collision_manager_user.h.


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 08:27:11 2004 for NeL by doxygen 1.3.6