#include <Space.h>
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 Space * | asSpace () |
virtual const Space * | asSpace () 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 |
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.
Definition at line 194 of file Space.h.
typedef std::set<osg::ref_ptr<AbstractGeom> > Physics::Space::TListGeoms |
Physics::Space::Space | ( | ) | [inline] |
Physics::Space::Space | ( | const SpaceTypeInfo & | spaceTypeInfo | ) | [inline] |
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 | |||
) |
Definition at line 36 of file Space.cpp.
References add(), Physics::AbstractGeom::clone(), Physics::AbstractGeom::COPY_CHILDREN, init(), LOG_WARN, and vGeoms.
void Physics::Space::accept | ( | Visitor & | v | ) | [virtual] |
Reimplemented from Physics::AbstractGeom.
Definition at line 54 of file Space.cpp.
References Physics::Visitor::apply().
Referenced by C3DPhy::accept(), C3DPhy::getReferenceFrameObjectNoThrow(), C3DPhy::rotate(), and C3DPhy::translate().
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] |
virtual Space* Physics::Space::asSpace | ( | ) | [inline, virtual] |
TListGeoms::const_iterator Physics::Space::getGeomsBegin | ( | ) | const [inline] |
TListGeoms::const_iterator Physics::Space::getGeomsEnd | ( | ) | const [inline] |
SpaceTypeInfo::ESpaceType Physics::Space::getType | ( | ) | const [inline] |
void Physics::Space::init | ( | ) | [private] |
Definition at line 114 of file Space.cpp.
References ASSERT, Physics::AbstractGeom::asSpaceId(), Physics::SpaceTypeInfo::QuadData::center, Physics::SpaceTypeInfo::getHashData(), Physics::SpaceTypeInfo::getQuadData(), Physics::SpaceTypeInfo::getSweepAndPruneData(), Physics::SpaceTypeInfo::getType(), Physics::SpaceTypeInfo::HASH, initHash(), initQuad(), initSimple(), initSweepAndPrune(), Physics::SpaceTypeInfo::QuadData::level, Physics::SpaceTypeInfo::HashData::maxLevel, Physics::SpaceTypeInfo::HashData::minLevel, Physics::SpaceTypeInfo::QUAD, Physics::SpaceTypeInfo::SIMPLE, Physics::SpaceTypeInfo::SWEEP_AND_PRUNE, typeInfo, and Physics::SpaceTypeInfo::QuadData::worldBox.
Referenced by Space().
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] |
void Physics::Space::initSimple | ( | ) | [private] |
void Physics::Space::initSweepAndPrune | ( | int | axesOrder | ) | [private] |
bool Physics::Space::isInSpace | ( | AbstractGeom * | pAbstractGeom | ) | const |
void Physics::Space::remove | ( | C3DPhy & | r3DPhy | ) |
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::traverse | ( | Visitor & | v | ) | [virtual] |
Traverse children.
Reimplemented from Physics::AbstractGeom.
Definition at line 56 of file Space.cpp.
References Physics::AbstractGeom::accept(), and vGeoms.
friend class World [friend] |
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().
SpaceTypeInfo Physics::Space::typeInfo [protected] |
TListGeoms Physics::Space::vGeoms [protected] |
Definition at line 248 of file Space.h.
Referenced by add(), isInSpace(), remove(), removeAll(), Physics::World::resetSpaceCollideFlag(), Space(), Physics::World::spaceCollide(), and traverse().