VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Attributes
DtSpatialVrfObjectManagerOctree Class Reference

Spatial object manager which uses an octree. This manager behaves better than the spatial subdivision-based manager for scenarios which have uneven distribution of their entities across the available terrain.

Inheritance diagram for DtSpatialVrfObjectManagerOctree:
Inheritance graph
[legend]

Public Member Functions

 DtSpatialVrfObjectManagerOctree (const DtManagedObjectListConstPtr &vrfObjList)
 
virtual ~DtSpatialVrfObjectManagerOctree ()
 
virtual void addVrfObjects (const DtManagedObjectListConstPtr &vrfObjects)
 
virtual void removeVrfObject (const DtSimObject *vrfObject)
 
virtual bool setResolutions (unsigned int xRes, unsigned int yRes, unsigned int zRes)
 
virtual void clearVrfObjects ()
 
virtual void reset (const DtManagedObjectListConstPtr &vrfObjects)
 
virtual bool getVrfObjects (const DtExtent &extent, DtVrfConstObjectUniqueContainer &objects) const
 
virtual bool getVrfObjects (DtVrfObjectPredicate &predicate, const DtExtent &extent, DtVrfConstObjectUniqueContainer &objects) const
 
virtual bool getVrfObjects (DtChord &chord, std::list< const DtSimObject * > &objects) const
 
virtual bool getVrfObjects (DtVrfObjectPredicate &predicate, DtChord &chord, std::list< const DtSimObject * > &objects) const
 
virtual void visitVrfObjects (const DtExtent &extent, DtSpatialSelectionFunctor &callback) const
 
virtual void visitVrfObjects (const DtChord &chord, DtSpatialSelectionFunctor &callback) const
 
unsigned int numObjects () const
 
- Public Member Functions inherited from DtSpatialVrfObjectManagerInterface
virtual ~DtSpatialVrfObjectManagerInterface ()
 
virtual bool getVrfObjects (const DtVrfObjectPredicate &predicate, const DtExtent &extent, DtVrfConstObjectUniqueContainer &objects) const =0
 
virtual bool getVrfObjects (const DtChord &chord, std::list< const DtSimObject * > &objects) const =0
 
virtual bool getVrfObjects (const DtVrfObjectPredicate &predicate, const DtChord &chord, std::list< const DtSimObject * > &objects) const =0
 

Protected Attributes

DtExtent myRootExtent
 
DtOctree< const DtSimObject > * myOctree
 

Private Member Functions

 DtSpatialVrfObjectManagerOctree ()
 
 DtSpatialVrfObjectManagerOctree (const DtSpatialVrfObjectManagerOctree &orig)
 
DtSpatialVrfObjectManagerOctreeoperator= (const DtSpatialVrfObjectManagerOctree &orig)
 

Additional Inherited Members

- Public Types inherited from DtSpatialVrfObjectManagerInterface
typedef std::vector< const
DtSimObject * > 
DtVrfObjectUniqueContainer
 
typedef std::vector< const
DtSimObject * > 
DtVrfConstObjectUniqueContainer
 
typedef std::vector< const
DtSimObject * > 
DtVrfObjectContainer
 

Constructor & Destructor Documentation

DtSpatialVrfObjectManagerOctree::DtSpatialVrfObjectManagerOctree ( )
private

Not implemented.

DtSpatialVrfObjectManagerOctree::DtSpatialVrfObjectManagerOctree ( const DtSpatialVrfObjectManagerOctree orig)
private

Not implemented.

DtSpatialVrfObjectManagerOctree::DtSpatialVrfObjectManagerOctree ( const DtManagedObjectListConstPtr vrfObjList)
virtual DtSpatialVrfObjectManagerOctree::~DtSpatialVrfObjectManagerOctree ( )
virtual

Member Function Documentation

DtSpatialVrfObjectManagerOctree& DtSpatialVrfObjectManagerOctree::operator= ( const DtSpatialVrfObjectManagerOctree orig)
private

Not implemented.

virtual void DtSpatialVrfObjectManagerOctree::addVrfObjects ( const DtManagedObjectListConstPtr vrfObjects)
virtual

Spatially sorts the vrfObjects associated in the vrfObjects.

Implements DtSpatialVrfObjectManagerInterface.

virtual void DtSpatialVrfObjectManagerOctree::removeVrfObject ( const DtSimObject vrfObject)
virtual

Removes vrfObject from the set of vrfObjects we are maintaining.

Parameters
vrfObjectPointer to the object to be removed.

Implements DtSpatialVrfObjectManagerInterface.

virtual bool DtSpatialVrfObjectManagerOctree::setResolutions ( unsigned int  xRes,
unsigned int  yRes,
unsigned int  zRes 
)
virtual

Doesn't do anything. Only here for interface compatibility.

Implements DtSpatialVrfObjectManagerInterface.

virtual void DtSpatialVrfObjectManagerOctree::clearVrfObjects ( )
virtual

Clears all managed objects from the manager. Does not affect the spatial container, other than to empty its cells of any elements.

Implements DtSpatialVrfObjectManagerInterface.

virtual void DtSpatialVrfObjectManagerOctree::reset ( const DtManagedObjectListConstPtr vrfObjects)
virtual

Clears out the current subdivision, sets it to have the minimum extent, that contains all of the DtSimObjects specified, and adds the specified DtSimObjects.

Note
This is provided as a memory optimization. Deleting and reallocating the spatial subdivision every tick was inefficient. So the spatial container is just cleared and resized to adjust for entities moving, being created destroyed, etc. This has the benefit of not causing a large memory reallocation, but at the disadvantage of not allowing the spatial subdivision to change its resolution.

Implements DtSpatialVrfObjectManagerInterface.

virtual void DtSpatialVrfObjectManagerOctree::visitVrfObjects ( const DtExtent extent,
DtSpatialSelectionFunctor callback 
) const
virtual

Functions that call the specified functor for every object intersecting the requested region (whether chord or extent). The functor should return false while additional processing should be done, and true if processing is complete and visitVrfObjects() should return. Note that processing is not guaranteed to stop immediately when the functor returns true; it is only a recommendation that processing can stop at any time.

Note
The functor may, and probably will, be called for additional DtSimObjects when a primitive is supplied. We are only guaranteed not to miss any that do intersect.

Implements DtSpatialVrfObjectManagerInterface.

virtual void DtSpatialVrfObjectManagerOctree::visitVrfObjects ( const DtChord chord,
DtSpatialSelectionFunctor callback 
) const
virtual
unsigned int DtSpatialVrfObjectManagerOctree::numObjects ( ) const
inlinevirtual

Number of objects in the octree.

Implements DtSpatialVrfObjectManagerInterface.

Member Data Documentation

DtExtent DtSpatialVrfObjectManagerOctree::myRootExtent
protected

The extent of the octree.

DtOctree<const DtSimObject>* DtSpatialVrfObjectManagerOctree::myOctree
protected

The octree being used to store the objects.


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

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)