Physics::Space Class Reference

Space is a group of owned geoms, and a level of collision. More...

#include <Space.h>

Inheritance diagram for Physics::Space:

Inheritance graph
[legend]

List of all members.

Public Types

typedef std::set< osg::ref_ptr
< AbstractGeom > > 
TListGeoms

Public Member Functions

 Space ()
 Constructs a simple space.
 Space (const SpaceTypeInfo &spaceTypeInfo)
 Constructor with a data structure.
 Space (const osg::Vec3 &worldBox)
 Convienence constructor for a quad mode space, centered on (0,0,0).
 Space (const Space &v, UINT opts=COPY_ALL, IGeomCollisionContainer *pGeomsContainer=NULL, TDuplicatedBodiesMap *pDuplicatedBodies=NULL)
virtual SpaceasSpace ()
virtual const SpaceasSpace () const
TListGeoms::const_iterator getGeomsBegin () const
TListGeoms::const_iterator getGeomsEnd () const
bool isInSpace (AbstractGeom *pAbstractGeom) const
 Tests if an abstract geom is in the space (O(log(n))).
void add (AbstractGeom *pAbstractGeom)
 Adds an abstract geom (a space or a geom). You cannot add twice the same.
void add (C3DPhy &r3DPhy)
 Adds all geoms and all additional spaces of a 3D-Phy. You cannot add a 3DPhy if one of its geoms (or space) is already in this space.
void remove (AbstractGeom *pAbstractGeom)
 Does nothing if not found.
void removeAll ()
void remove (C3DPhy &r3DPhy)
virtual void accept (Visitor &v)
virtual void traverse (Visitor &v)
 Traverse children.
SpaceTypeInfo::ESpaceType getType () const
 operator dSpaceID ()
 operator const dSpaceID () const

Protected Member Functions

virtual ~Space ()

Protected Attributes

TListGeoms vGeoms
bool collided
 Indicates if dSpaceCollide() has been called on this space.
SpaceTypeInfo typeInfo

Private Member Functions

void init ()
void initSimple ()
void initHash (UINT minLevel, UINT maxLevel)
void initQuad (osg::Vec3 worldBox, osg::Vec3 center=osg::Vec3(0, 0, 0), UINT level=4)
void initSweepAndPrune (int axesOrder)

Friends

class World


Detailed Description

Space is a group of owned geoms, and a level of collision.

Space is actually a special geom that contains other geoms and that has no position nor orientation, used for collisions (spaces themselves are tested before the contained geoms). It is used to make collision detection go faster by grouping geoms. You should encapsulate only pertinent groups, or performance would suffer of a bad architecture. Note that it owns the contained geoms.

Author:
Sukender
Version:
0.2.0

Definition at line 194 of file Space.h.


Member Typedef Documentation

typedef std::set<osg::ref_ptr<AbstractGeom> > Physics::Space::TListGeoms

Definition at line 210 of file Space.h.


Constructor & Destructor Documentation

Physics::Space::Space (  )  [inline]

Constructs a simple space.

Definition at line 197 of file Space.h.

References I18N::init().

Physics::Space::Space ( const SpaceTypeInfo spaceTypeInfo  )  [inline]

Constructor with a data structure.

Definition at line 199 of file Space.h.

References I18N::init().

Physics::Space::Space ( const osg::Vec3 &  worldBox  )  [inline]

Convienence constructor for a quad mode space, centered on (0,0,0).

Definition at line 201 of file Space.h.

References I18N::init().

Physics::Space::Space ( const Space v,
UINT  opts = COPY_ALL,
IGeomCollisionContainer pGeomsContainer = NULL,
TDuplicatedBodiesMap pDuplicatedBodies = NULL 
)

Physics::Space::~Space (  )  [protected, virtual]

Definition at line 50 of file Space.cpp.


Member Function Documentation

void Physics::Space::accept ( Visitor v  )  [virtual]

void Physics::Space::add ( C3DPhy r3DPhy  ) 

Adds all geoms and all additional spaces of a 3D-Phy. You cannot add a 3DPhy if one of its geoms (or space) is already in this space.

Definition at line 85 of file Space.cpp.

References add(), C3DPhy::getGeoms(), and C3DPhy::getSpaces().

void Physics::Space::add ( AbstractGeom pAbstractGeom  ) 

Adds an abstract geom (a space or a geom). You cannot add twice the same.

Definition at line 62 of file Space.cpp.

References ASSERT, Physics::AbstractGeom::asSpaceId(), Physics::AbstractGeom::getParentSpace(), Physics::AbstractGeom::id, LOG_WARN, and vGeoms.

Referenced by add(), C3DPhyOwner::addInScene(), and Space().

virtual const Space* Physics::Space::asSpace (  )  const [inline, virtual]

Reimplemented from Physics::AbstractGeom.

Definition at line 208 of file Space.h.

virtual Space* Physics::Space::asSpace (  )  [inline, virtual]

Reimplemented from Physics::AbstractGeom.

Definition at line 207 of file Space.h.

TListGeoms::const_iterator Physics::Space::getGeomsBegin (  )  const [inline]

Definition at line 211 of file Space.h.

Referenced by Physics::combinedTraversal().

TListGeoms::const_iterator Physics::Space::getGeomsEnd (  )  const [inline]

Definition at line 212 of file Space.h.

Referenced by Physics::combinedTraversal().

SpaceTypeInfo::ESpaceType Physics::Space::getType (  )  const [inline]

Definition at line 232 of file Space.h.

void Physics::Space::init (  )  [private]

void Physics::Space::initHash ( UINT  minLevel,
UINT  maxLevel 
) [private]

Definition at line 138 of file Space.cpp.

References Physics::AbstractGeom::asSpaceId().

Referenced by init().

void Physics::Space::initQuad ( osg::Vec3  worldBox,
osg::Vec3  center = osg::Vec3(0,0,0),
UINT  level = 4 
) [private]

Definition at line 143 of file Space.cpp.

References Physics::toPhyVec3().

Referenced by init().

void Physics::Space::initSimple (  )  [private]

Definition at line 134 of file Space.cpp.

Referenced by init().

void Physics::Space::initSweepAndPrune ( int  axesOrder  )  [private]

Definition at line 149 of file Space.cpp.

Referenced by init().

bool Physics::Space::isInSpace ( AbstractGeom pAbstractGeom  )  const

Tests if an abstract geom is in the space (O(log(n))).

Definition at line 109 of file Space.cpp.

References vGeoms.

Physics::Space::operator const dSpaceID (  )  const [inline]

Definition at line 243 of file Space.h.

Physics::Space::operator dSpaceID (  )  [inline]

Definition at line 242 of file Space.h.

void Physics::Space::remove ( C3DPhy r3DPhy  ) 

Definition at line 103 of file Space.cpp.

References C3DPhy::getGeoms(), and C3DPhy::getSpaces().

void Physics::Space::remove ( AbstractGeom pAbstractGeom  ) 

Does nothing if not found.

Definition at line 92 of file Space.cpp.

References ASSERT, and vGeoms.

Referenced by C3DPhyOwner::doDeletePhy().

void Physics::Space::removeAll (  ) 

Definition at line 98 of file Space.cpp.

References vGeoms.

void Physics::Space::traverse ( Visitor v  )  [virtual]

Traverse children.

Reimplemented from Physics::AbstractGeom.

Definition at line 56 of file Space.cpp.

References Physics::AbstractGeom::accept(), and vGeoms.


Friends And Related Function Documentation

friend class World [friend]

Reimplemented from Physics::AbstractGeom.

Definition at line 246 of file Space.h.


Member Data Documentation

bool Physics::Space::collided [protected]

Indicates if dSpaceCollide() has been called on this space.

Definition at line 250 of file Space.h.

Referenced by Physics::World::resetSpaceCollideFlag(), and Physics::World::spaceCollide().

Definition at line 252 of file Space.h.

Referenced by init().


The documentation for this class was generated from the following files:

Generated on Sun Jan 17 11:39:36 2010 for PVLE (Pro-Vocation Light Engine) by  doxygen 1.5.9