PxAggregate Class Referenceabstract

Class to aggregate actors into a single broad-phase entry. More...

#include <PxAggregate.h>

Inheritance diagram for PxAggregate:
Collaboration diagram for PxAggregate:

Public Member Functions

virtual void release ()=0
 Deletes the aggregate object. More...
 
virtual bool addActor (PxActor &actor, const PxBVHStructure *bvhStructure=NULL)=0
 Adds an actor to the aggregate object. More...
 
virtual bool removeActor (PxActor &actor)=0
 Removes an actor from the aggregate object. More...
 
virtual bool addArticulation (PxArticulationBase &articulation)=0
 Adds an articulation to the aggregate object. More...
 
virtual bool removeArticulation (PxArticulationBase &articulation)=0
 Removes an articulation from the aggregate object. More...
 
virtual PxU32 getNbActors () const =0
 Returns the number of actors contained in the aggregate. More...
 
virtual PxU32 getMaxNbActors () const =0
 Retrieves max amount of actors that can be contained in the aggregate. More...
 
virtual PxU32 getActors (PxActor **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const =0
 Retrieve all actors contained in the aggregate. More...
 
virtual PxScenegetScene ()=0
 Retrieves the scene which this aggregate belongs to. More...
 
virtual bool getSelfCollision () const =0
 Retrieves aggregate's self-collision flag. More...
 
virtual const char * getConcreteTypeName () const
 Returns string name of dynamic type. More...
 
- Public Member Functions inherited from PxBase
template<class T >
T * is ()
 
template<class T >
const T * is () const
 
PX_FORCE_INLINE PxType getConcreteType () const
 Returns concrete type of object. More...
 
PX_FORCE_INLINE void setBaseFlag (PxBaseFlag::Enum flag, bool value)
 Set PxBaseFlag. More...
 
PX_FORCE_INLINE void setBaseFlags (PxBaseFlags inFlags)
 Set PxBaseFlags. More...
 
PX_FORCE_INLINE PxBaseFlags getBaseFlags () const
 Returns PxBaseFlags. More...
 
virtual bool isReleasable () const
 Whether the object is subordinate. More...
 

Protected Member Functions

PX_INLINE PxAggregate (PxType concreteType, PxBaseFlags baseFlags)
 
PX_INLINE PxAggregate (PxBaseFlags baseFlags)
 
virtual ~PxAggregate ()
 
virtual bool isKindOf (const char *name) const
 Returns whether a given type name matches with the type of this instance. More...
 
- Protected Member Functions inherited from PxBase
PX_INLINE PxBase (PxType concreteType, PxBaseFlags baseFlags)
 Constructor setting concrete type and base flags. More...
 
PX_INLINE PxBase (PxBaseFlags baseFlags)
 Deserialization constructor setting base flags. More...
 
virtual ~PxBase ()
 Destructor. More...
 
template<class T >
bool typeMatch () const
 

Additional Inherited Members

- Protected Attributes inherited from PxBase
PxType mConcreteType
 
PxBaseFlags mBaseFlags
 

Detailed Description

Class to aggregate actors into a single broad-phase entry.

A PxAggregate object is a collection of PxActors, which will exist as a single entry in the broad-phase structures. This has 3 main benefits:

1) it reduces "broad phase pollution" by allowing a collection of spatially coherent broad-phase entries to be replaced by a single aggregated entry (e.g. a ragdoll or a single actor with a large number of attached shapes).

2) it reduces broad-phase memory usage

3) filtering can be optimized a lot if self-collisions within an aggregate are not needed. For example if you don't need collisions between ragdoll bones, it's faster to simply disable filtering once and for all, for the aggregate containing the ragdoll, rather than filtering out each bone-bone collision in the filter shader.

See also
PxActor, PxPhysics.createAggregate

Constructor & Destructor Documentation

◆ PxAggregate() [1/2]

PX_INLINE PxAggregate::PxAggregate ( PxType  concreteType,
PxBaseFlags  baseFlags 
)
inlineprotected

◆ PxAggregate() [2/2]

PX_INLINE PxAggregate::PxAggregate ( PxBaseFlags  baseFlags)
inlineprotected

◆ ~PxAggregate()

virtual PxAggregate::~PxAggregate ( )
inlineprotectedvirtual

Member Function Documentation

◆ addActor()

virtual bool PxAggregate::addActor ( PxActor actor,
const PxBVHStructure bvhStructure = NULL 
)
pure virtual

Adds an actor to the aggregate object.

A warning is output if the total number of actors is reached, or if the incoming actor already belongs to an aggregate.

If the aggregate belongs to a scene, adding an actor to the aggregate also adds the actor to that scene.

If the actor already belongs to a scene, a warning is output and the call is ignored. You need to remove the actor from the scene first, before adding it to the aggregate.

Note
When BVHStructure is provided the actor shapes are grouped together. The scene query pruning structure inside PhysX SDK will store/update one bound per actor. The scene queries against such an actor will query actor bounds and then make a local space query against the provided BVH structure, which is in actor's local space.
Parameters
[in]actorThe actor that should be added to the aggregate
[in]bvhStructureBVHStructure for actor shapes. return true if success

◆ addArticulation()

virtual bool PxAggregate::addArticulation ( PxArticulationBase articulation)
pure virtual

Adds an articulation to the aggregate object.

A warning is output if the total number of actors is reached (every articulation link counts as an actor), or if the incoming articulation already belongs to an aggregate.

If the aggregate belongs to a scene, adding an articulation to the aggregate also adds the articulation to that scene.

If the articulation already belongs to a scene, a warning is output and the call is ignored. You need to remove the articulation from the scene first, before adding it to the aggregate.

Parameters
[in]articulationThe articulation that should be added to the aggregate return true if success

◆ getActors()

virtual PxU32 PxAggregate::getActors ( PxActor **  userBuffer,
PxU32  bufferSize,
PxU32  startIndex = 0 
) const
pure virtual

Retrieve all actors contained in the aggregate.

You can retrieve the number of actor pointers by calling getNbActors()

Parameters
[out]userBufferThe buffer to store the actor pointers.
[in]bufferSizeSize of provided user buffer.
[in]startIndexIndex of first actor pointer to be retrieved
Returns
Number of actor pointers written to the buffer.
See also
PxShape getNbShapes()

◆ getConcreteTypeName()

virtual const char* PxAggregate::getConcreteTypeName ( ) const
inlinevirtual

Returns string name of dynamic type.

Returns
Class name of most derived type of this object.

Implements PxBase.

◆ getMaxNbActors()

virtual PxU32 PxAggregate::getMaxNbActors ( ) const
pure virtual

Retrieves max amount of actors that can be contained in the aggregate.

Returns
Max aggregate size.
See also
PxPhysics::createAggregate()

◆ getNbActors()

virtual PxU32 PxAggregate::getNbActors ( ) const
pure virtual

Returns the number of actors contained in the aggregate.

You can use getActors() to retrieve the actor pointers.

Returns
Number of actors contained in the aggregate.
See also
PxActor getActors()

◆ getScene()

virtual PxScene* PxAggregate::getScene ( )
pure virtual

Retrieves the scene which this aggregate belongs to.

Returns
Owner Scene. NULL if not part of a scene.
See also
PxScene

◆ getSelfCollision()

virtual bool PxAggregate::getSelfCollision ( ) const
pure virtual

Retrieves aggregate's self-collision flag.

Returns
self-collision flag

◆ isKindOf()

virtual bool PxAggregate::isKindOf ( const char *  superClass) const
inlineprotectedvirtual

Returns whether a given type name matches with the type of this instance.

Reimplemented from PxBase.

References PxBase::isKindOf().

◆ release()

virtual void PxAggregate::release ( )
pure virtual

Deletes the aggregate object.

Deleting the PxAggregate object does not delete the aggregated actors. If the PxAggregate object belongs to a scene, the aggregated actors are automatically re-inserted in that scene. If you intend to delete both the PxAggregate and its actors, it is best to release the actors first, then release the PxAggregate when it is empty.

Implements PxBase.

◆ removeActor()

virtual bool PxAggregate::removeActor ( PxActor actor)
pure virtual

Removes an actor from the aggregate object.

A warning is output if the incoming actor does not belong to the aggregate. Otherwise the actor is removed from the aggregate. If the aggregate belongs to a scene, the actor is reinserted in that scene. If you intend to delete the actor, it is best to call PxActor::release() directly. That way the actor will be automatically removed from its aggregate (if any) and not reinserted in a scene.

Parameters
[in]actorThe actor that should be removed from the aggregate return true if success

◆ removeArticulation()

virtual bool PxAggregate::removeArticulation ( PxArticulationBase articulation)
pure virtual

Removes an articulation from the aggregate object.

A warning is output if the incoming articulation does not belong to the aggregate. Otherwise the articulation is removed from the aggregate. If the aggregate belongs to a scene, the articulation is reinserted in that scene. If you intend to delete the articulation, it is best to call PxArticulation::release() directly. That way the articulation will be automatically removed from its aggregate (if any) and not reinserted in a scene.

Parameters
[in]articulationThe articulation that should be removed from the aggregate return true if success

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