Physics::AbstractGeom Class Reference

Abstract geom is a base class for two geom types : standard geoms (Geom) and spaces (Space). More...

#include <AbstractGeom.h>

Inheritance diagram for Physics::AbstractGeom:

Inheritance graph
[legend]

List of all members.

Public Types

enum  ECopyOpts { COPY_BODIES = 0x1, COPY_CHILDREN = 0x2, COPY_ALL = 0xffffffff }
 Options for geoms and spaces copy constructors. More...

Public Member Functions

 AbstractGeom ()
osg::BoundingBox getAABB () const
bool isSpace () const
 Returns true if this geom is a space.
virtual SpaceasSpace ()
virtual GeomasGeom ()
virtual const SpaceasSpace () const
virtual const GeomasGeom () const
SpacegetParentSpace ()
 Returns NULL if it has no parent (top most space).
const SpacegetParentSpace () const
bool operator< (const AbstractGeom &g) const
bool operator== (const AbstractGeom &g) const
Visitor methods
virtual void accept (Visitor &v)
virtual void traverse (Visitor &v)
 Traverse children.

Static Public Member Functions

static AbstractGeomclone (const AbstractGeom &v, UINT opts=COPY_ALL, IGeomCollisionContainer *pGeomsContainer=NULL, TDuplicatedBodiesMap *pDuplicatedBodies=NULL)
 Copies an abstract geom (without adding it to the same parent space), whatever its type is.

Protected Member Functions

dSpaceID asSpaceId ()
virtual ~AbstractGeom ()
 Protected destructor forces the object to be deleted by being dereferenced.

Protected Attributes

dGeomID id
 Can be seen as a dSpaceID, with asSpaceId().

Friends

class Geom
class Space
class World


Detailed Description

Abstract geom is a base class for two geom types : standard geoms (Geom) and spaces (Space).

Author:
Sukender
Version:
0.2.0

Definition at line 69 of file AbstractGeom.h.


Member Enumeration Documentation

Options for geoms and spaces copy constructors.

Enumerator:
COPY_BODIES  Copies bodies attached to a geom.
COPY_CHILDREN  Copies spaces and geoms included into a space.
COPY_ALL 

Definition at line 74 of file AbstractGeom.h.


Constructor & Destructor Documentation

Physics::AbstractGeom::AbstractGeom (  )  [inline]

Definition at line 71 of file AbstractGeom.h.

virtual Physics::AbstractGeom::~AbstractGeom (  )  [inline, protected, virtual]

Protected destructor forces the object to be deleted by being dereferenced.

Also avoids the object from beeing created on the stack.

Definition at line 145 of file AbstractGeom.h.


Member Function Documentation

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

Reimplemented in Physics::Geom, and Physics::Space.

Definition at line 42 of file AbstractGeom.cpp.

References Physics::Visitor::apply().

Referenced by Physics::Space::traverse().

virtual const Geom* Physics::AbstractGeom::asGeom (  )  const [inline, virtual]

Reimplemented in Physics::Geom.

Definition at line 108 of file AbstractGeom.h.

virtual Geom* Physics::AbstractGeom::asGeom (  )  [inline, virtual]

Reimplemented in Physics::Geom.

Definition at line 106 of file AbstractGeom.h.

Referenced by clone(), and Physics::combinedTraversal().

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

Reimplemented in Physics::Space.

Definition at line 107 of file AbstractGeom.h.

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

dSpaceID Physics::AbstractGeom::asSpaceId (  )  [inline, protected]

AbstractGeom * Physics::AbstractGeom::clone ( const AbstractGeom v,
UINT  opts = COPY_ALL,
IGeomCollisionContainer pGeomsContainer = NULL,
TDuplicatedBodiesMap pDuplicatedBodies = NULL 
) [static]

Copies an abstract geom (without adding it to the same parent space), whatever its type is.

This can potentially copy the geoms & bodies it contains, according to opts.

Parameters:
v Abstract geom to copy.
opts Copy options (says what to copy and what not).
pGeomsContainer Collision container to use upon Geom copy only (does not make sense for a Space).
pDuplicatedBodies Map of original bodies and corresponding duplicated bodies (used for composite object copy), or NULL.
Composites
Copying a composite object (multiple geoms attached to the same body) can duplicates the body. You have then two choices to avoid this :
  • Call the copy constructor for each geom, but only the first geom of a composite must be copied with the COPY_BODIES flag. If not, then composite object will be copied as separate geoms with each a body. You must then attach manually the geoms of the composite to the appropriate bodies.
  • Or give the constructor a non-NULL pDuplicatedBodies. This map will help handling composite duplication by storing duplicated bodies.

Definition at line 34 of file AbstractGeom.cpp.

References asGeom(), ASSERT, asSpace(), Geom, and Space.

Referenced by Physics::Space::Space().

osg::BoundingBox Physics::AbstractGeom::getAABB (  )  const [inline]

Definition at line 102 of file AbstractGeom.h.

References Physics::toGraphBB().

const Space* Physics::AbstractGeom::getParentSpace (  )  const [inline]

Returns NULL if it has no parent (top most space).

There is no setParentSpace() because it is useless : just add the abstract geom to a space by calling Space::add()

Definition at line 124 of file AbstractGeom.h.

Space* Physics::AbstractGeom::getParentSpace (  )  [inline]

Returns NULL if it has no parent (top most space).

There is no setParentSpace() because it is useless : just add the abstract geom to a space by calling Space::add()

Definition at line 118 of file AbstractGeom.h.

Referenced by Physics::Space::add(), and C3DPhy::addSpace().

bool Physics::AbstractGeom::isSpace (  )  const [inline]

Returns true if this geom is a space.

Definition at line 104 of file AbstractGeom.h.

Referenced by Physics::combinedTraversal(), and Physics::NearCallback::operator()().

bool Physics::AbstractGeom::operator< ( const AbstractGeom g  )  const [inline]

Definition at line 129 of file AbstractGeom.h.

References id.

bool Physics::AbstractGeom::operator== ( const AbstractGeom g  )  const [inline]

Definition at line 130 of file AbstractGeom.h.

References id.

virtual void Physics::AbstractGeom::traverse ( Visitor v  )  [inline, virtual]

Traverse children.

Reimplemented in Physics::Geom, and Physics::Space.

Definition at line 113 of file AbstractGeom.h.

Referenced by Physics::Visitor::traverse().


Friends And Related Function Documentation

friend class Geom [friend]

Definition at line 133 of file AbstractGeom.h.

Referenced by clone().

friend class Space [friend]

Definition at line 134 of file AbstractGeom.h.

Referenced by clone().

friend class World [friend]

Reimplemented in Physics::Space.

Definition at line 135 of file AbstractGeom.h.


Member Data Documentation

dGeomID Physics::AbstractGeom::id [mutable, protected]

Can be seen as a dSpaceID, with asSpaceId().

Definition at line 140 of file AbstractGeom.h.

Referenced by Physics::Space::add(), Physics::Geom::collide(), operator<(), operator==(), and Physics::World::spaceCollide2().


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

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