PlayRho  2.0.0
An interactive physics engine & library.
playrho::d2::detail::WorldModel< T > Struct Template Referencefinal

Interface between type class template instantiated for and the WorldConcept class. More...

#include <playrho/d2/detail/WorldModel.hpp>

Inheritance diagram for playrho::d2::detail::WorldModel< T >:
[legend]
Collaboration diagram for playrho::d2::detail::WorldModel< T >:
[legend]

Public Types

using data_type = T
 Type alias for the type of the data held.
 

Public Member Functions

template<typename U , std::enable_if_t<!std::is_same_v< U, WorldModel >, int > = 0>
 WorldModel (U &&arg) noexcept(std::is_nothrow_constructible_v< T, U >)
 Initializing constructor.
 
void Clear_ () noexcept override
 Clears the world. More...
 
std::unique_ptr< WorldConceptClone_ () const override
 Clones the instance - making a deep copy. More...
 
BodyID CreateBody_ (const Body &body) override
 Creates a rigid body that's a copy of the given one. More...
 
JointID CreateJoint_ (const Joint &def) override
 Creates a joint to constrain one or more bodies. More...
 
ShapeID CreateShape_ (const Shape &def) override
 Creates an identifiable copy of the given shape within this world. More...
 
void Destroy_ (BodyID id) override
 Destroys the identified body. More...
 
void Destroy_ (JointID id) override
 Destroys the identified body. More...
 
void Destroy_ (ShapeID id) override
 Destroys the identified body. More...
 
std::vector< BodyIDGetBodies_ () const override
 Gets the world body range for this constant world. More...
 
std::vector< BodyIDGetBodiesForProxies_ () const override
 Gets the bodies-for-proxies range for this world. More...
 
Body GetBody_ (BodyID id) const override
 Gets the state of the identified body. More...
 
BodyCounter GetBodyRange_ () const noexcept override
 Gets the extent of the currently valid body range. More...
 
Contact GetContact_ (ContactID id) const override
 Gets the identified contact. More...
 
ContactCounter GetContactRange_ () const noexcept override
 Gets the extent of the currently valid contact range. More...
 
std::vector< KeyedContactIDGetContacts_ () const override
 Gets the container of contacts attached to the identified body. More...
 
std::vector< std::tuple< ContactKey, ContactID > > GetContacts_ (BodyID id) const override
 Gets the container of contacts attached to the identified body. More...
 
const void * GetData_ () const noexcept override
 Gets the data for the underlying configuration. More...
 
void * GetData_ () noexcept override
 Gets the data for the underlying configuration. More...
 
Frequency GetInvDeltaTime_ () const noexcept override
 Gets the inverse delta time. More...
 
Joint GetJoint_ (JointID id) const override
 Gets the value of the identified joint. More...
 
JointCounter GetJointRange_ () const noexcept override
 Gets the extent of the currently valid joint range. More...
 
std::vector< JointIDGetJoints_ () const override
 Gets the range of joints attached to the identified body. More...
 
std::vector< std::pair< BodyID, JointID > > GetJoints_ (BodyID id) const override
 Gets the range of joints attached to the identified body. More...
 
Manifold GetManifold_ (ContactID id) const override
 Gets the collision manifold for the identified contact. More...
 
std::optional< pmr::StatsResource::StatsGetResourceStats_ () const noexcept override
 Gets the polymorphic memory resource statistics. More...
 
Shape GetShape_ (ShapeID id) const override
 
ShapeCounter GetShapeRange_ () const noexcept override
 Gets the extent of the currently valid shape range. More...
 
std::vector< ShapeIDGetShapes_ (BodyID id) const override
 Gets the identities of the shapes associated with the identified body. More...
 
bool GetSubStepping_ () const noexcept override
 Gets whether or not sub-stepping is enabled. More...
 
const DynamicTreeGetTree_ () const noexcept override
 Gets access to the broad-phase dynamic tree information. More...
 
TypeID GetType_ () const noexcept override
 Gets the use type information. More...
 
Interval< Positive< Length > > GetVertexRadiusInterval_ () const noexcept override
 Gets the vertex radius range that shapes in this world can be within. More...
 
bool IsEqual_ (const WorldConcept &other) const noexcept override
 Equality checking function.
 
bool IsLocked_ () const noexcept override
 Is the world locked (in the middle of a time step). More...
 
bool IsStepComplete_ () const noexcept override
 Whether or not "step" is complete. More...
 
void SetBeginContactListener_ (ContactFunction listener) noexcept override
 Sets a begin contact event listener. More...
 
void SetBody_ (BodyID id, const Body &value) override
 Sets the state of the identified body. More...
 
void SetContact_ (ContactID id, const Contact &value) override
 Sets the identified contact's state. More...
 
void SetDetachListener_ (BodyShapeFunction listener) noexcept override
 Sets the detach listener for shapes detaching from bodies. More...
 
void SetEndContactListener_ (ContactFunction listener) noexcept override
 Sets an end contact event listener. More...
 
void SetJoint_ (JointID id, const Joint &def) override
 Sets the identified joint to the given value. More...
 
void SetJointDestructionListener_ (JointFunction listener) noexcept override
 Sets a destruction listener for joints. More...
 
void SetManifold_ (ContactID id, const Manifold &value) override
 Sets the collision manifold for the identified contact. More...
 
void SetPostSolveContactListener_ (ContactImpulsesFunction listener) noexcept override
 Sets a post-solve contact event listener. More...
 
void SetPreSolveContactListener_ (ContactManifoldFunction listener) noexcept override
 Sets a pre-solve contact event listener. More...
 
void SetShape_ (ShapeID id, const Shape &def) override
 Sets the identified shape to the new value. More...
 
void SetShapeDestructionListener_ (ShapeFunction listener) noexcept override
 Sets the destruction listener for shapes. More...
 
void SetSubStepping_ (bool flag) noexcept override
 Enables/disables single stepped continuous physics. More...
 
void ShiftOrigin_ (const Length2 &newOrigin) override
 Shifts the world origin. More...
 
StepStats Step_ (const StepConf &conf) override
 Steps the world simulation according to the given configuration. More...
 
- Public Member Functions inherited from playrho::d2::detail::WorldConcept
virtual ~WorldConcept ()=default
 Destructor.
 

Public Attributes

data_type data
 Data.
 

Detailed Description

template<class T>
struct playrho::d2::detail::WorldModel< T >

Interface between type class template instantiated for and the WorldConcept class.

See also
WorldConcept.
Examples
World.cpp.

Member Function Documentation

◆ Clear_()

template<class T >
void playrho::d2::detail::WorldModel< T >::Clear_ ( )
inlineoverridevirtualnoexcept

Clears the world.

Note
This calls the joint and shape destruction listeners (if they're set), for all defined joints and shapes, before clearing anything. Any exceptions thrown from these listeners are ignored.
Postcondition
The contents of this world have all been destroyed and this world's internal state is reset as though it had just been constructed.
See also
SetJointDestructionListener_, SetShapeDestructionListener_.

Implements playrho::d2::detail::WorldConcept.

◆ Clone_()

template<class T >
std::unique_ptr<WorldConcept> playrho::d2::detail::WorldModel< T >::Clone_ ( ) const
inlineoverridevirtual

Clones the instance - making a deep copy.

Implements playrho::d2::detail::WorldConcept.

◆ CreateBody_()

template<class T >
BodyID playrho::d2::detail::WorldModel< T >::CreateBody_ ( const Body body)
inlineoverridevirtual

Creates a rigid body that's a copy of the given one.

Warning
This function should not be used while the world is locked — as it is during callbacks. If it is, it will throw an exception or abort your program.
Note
No references to the configuration are retained. Its value is copied.
Postcondition
The created body will be present in the range returned from the GetBodies_() function.
Parameters
bodyA customized body or its default value.
Returns
Identifier of the newly created body which can later be destroyed by calling the Destroy_(BodyID) function.
Exceptions
WrongStateif this function is called while the world is locked.
LengthErrorif this operation would create more than MaxBodies.
std::out_of_rangeif the given body references any invalid shape identifiers.
See also
Destroy_(BodyID), GetBodies_.
Physical Entities.

Implements playrho::d2::detail::WorldConcept.

◆ CreateJoint_()

template<class T >
JointID playrho::d2::detail::WorldModel< T >::CreateJoint_ ( const Joint def)
inlineoverridevirtual

Creates a joint to constrain one or more bodies.

Warning
This function is locked during callbacks.
Postcondition
The created joint will be present in the range returned from the GetJoints_() function.
Returns
Identifier of newly created joint which can later be destroyed by calling the Destroy_(JointID) function.
Exceptions
WrongStateif this function is called while the world is locked.
LengthErrorif this operation would create more than MaxJoints.
See also
Physical Entities.
Destroy_(JointID), GetJoints_.

Implements playrho::d2::detail::WorldConcept.

◆ CreateShape_()

template<class T >
ShapeID playrho::d2::detail::WorldModel< T >::CreateShape_ ( const Shape def)
inlineoverridevirtual

Creates an identifiable copy of the given shape within this world.

Exceptions
InvalidArgumentif called for a shape with a vertex radius that's either: less than the minimum vertex radius, or greater than the maximum vertex radius.
WrongStateif this function is called while the world is locked.
LengthErrorif this operation would create more than MaxShapes.
See also
Destroy_(ShapeID), GetShape_, SetShape_.

Implements playrho::d2::detail::WorldConcept.

◆ Destroy_() [1/3]

template<class T >
void playrho::d2::detail::WorldModel< T >::Destroy_ ( BodyID  id)
inlineoverridevirtual

Destroys the identified body.

Destroys the identified body that had previously been created by a call to this world's CreateBody_(const Body&) function.

Warning
This automatically deletes all associated shapes and joints.
This function is locked during callbacks.
Behavior is not specified if identified body wasn't created by this world.
Note
This function is locked during callbacks.
Postcondition
The destroyed body will no longer be present in the range returned from the GetBodies_() function.
Parameters
idIdentifier of body to destroy that had been created by this world.
Exceptions
WrongStateif this function is called while the world is locked.
std::out_of_rangeIf given an invalid body identifier.
See also
CreateBody_, GetBodies_, GetBodyRange_.
Physical Entities.

Implements playrho::d2::detail::WorldConcept.

◆ Destroy_() [2/3]

template<class T >
void playrho::d2::detail::WorldModel< T >::Destroy_ ( JointID  id)
inlineoverridevirtual

Destroys the identified body.

Destroys the identified body that had previously been created by a call to this world's CreateBody_(const Body&) function.

Warning
This automatically deletes all associated shapes and joints.
This function is locked during callbacks.
Behavior is not specified if identified body wasn't created by this world.
Note
This function is locked during callbacks.
Postcondition
The destroyed body will no longer be present in the range returned from the GetBodies_() function.
Parameters
idIdentifier of body to destroy that had been created by this world.
Exceptions
WrongStateif this function is called while the world is locked.
std::out_of_rangeIf given an invalid body identifier.
See also
CreateBody_, GetBodies_, GetBodyRange_.
Physical Entities.

Implements playrho::d2::detail::WorldConcept.

◆ Destroy_() [3/3]

template<class T >
void playrho::d2::detail::WorldModel< T >::Destroy_ ( ShapeID  id)
inlineoverridevirtual

Destroys the identified body.

Destroys the identified body that had previously been created by a call to this world's CreateBody_(const Body&) function.

Warning
This automatically deletes all associated shapes and joints.
This function is locked during callbacks.
Behavior is not specified if identified body wasn't created by this world.
Note
This function is locked during callbacks.
Postcondition
The destroyed body will no longer be present in the range returned from the GetBodies_() function.
Parameters
idIdentifier of body to destroy that had been created by this world.
Exceptions
WrongStateif this function is called while the world is locked.
std::out_of_rangeIf given an invalid body identifier.
See also
CreateBody_, GetBodies_, GetBodyRange_.
Physical Entities.

Implements playrho::d2::detail::WorldConcept.

◆ GetBodies_()

template<class T >
std::vector<BodyID> playrho::d2::detail::WorldModel< T >::GetBodies_ ( ) const
inlineoverridevirtual

Gets the world body range for this constant world.

Gets a range enumerating the bodies currently existing within this world. These are the bodies that had been created from previous calls to the CreateBody_(const Body&) function that haven't yet been destroyed.

Returns
An iterable of body identifiers.
See also
CreateBody_.

Implements playrho::d2::detail::WorldConcept.

◆ GetBodiesForProxies_()

template<class T >
std::vector<BodyID> playrho::d2::detail::WorldModel< T >::GetBodiesForProxies_ ( ) const
inlineoverridevirtual

Gets the bodies-for-proxies range for this world.

Provides insight on what bodies have been queued for proxy processing during the next call to the world step function.

See also
Step_.
Todo:
Remove this function from this class - access from implementation instead.

Implements playrho::d2::detail::WorldConcept.

◆ GetBody_()

template<class T >
Body playrho::d2::detail::WorldModel< T >::GetBody_ ( BodyID  id) const
inlineoverridevirtual

Gets the state of the identified body.

Exceptions
std::out_of_rangeIf given an invalid body identifier.
See also
SetBody_, GetBodyRange_.

Implements playrho::d2::detail::WorldConcept.

◆ GetBodyRange_()

template<class T >
BodyCounter playrho::d2::detail::WorldModel< T >::GetBodyRange_ ( ) const
inlineoverridevirtualnoexcept

Gets the extent of the currently valid body range.

Note
This is one higher than the maxium BodyID that is in range for body related functions.

Implements playrho::d2::detail::WorldConcept.

◆ GetContact_()

template<class T >
Contact playrho::d2::detail::WorldModel< T >::GetContact_ ( ContactID  id) const
inlineoverridevirtual

Gets the identified contact.

Exceptions
std::out_of_rangeIf given an invalid contact identifier.
See also
SetContact_, GetContactRange_.

Implements playrho::d2::detail::WorldConcept.

◆ GetContactRange_()

template<class T >
ContactCounter playrho::d2::detail::WorldModel< T >::GetContactRange_ ( ) const
inlineoverridevirtualnoexcept

Gets the extent of the currently valid contact range.

Note
This is one higher than the maxium ContactID that is in range for contact related functions.

Implements playrho::d2::detail::WorldConcept.

◆ GetContacts_() [1/2]

template<class T >
std::vector<KeyedContactID> playrho::d2::detail::WorldModel< T >::GetContacts_ ( ) const
inlineoverridevirtual

Gets the container of contacts attached to the identified body.

Warning
This collection changes during the time step and you may miss some collisions if you don't use ContactFunction.
Exceptions
std::out_of_rangeIf given an invalid body identifier.
See also
GetBodyRange_.

Implements playrho::d2::detail::WorldConcept.

◆ GetContacts_() [2/2]

template<class T >
std::vector<std::tuple<ContactKey, ContactID> > playrho::d2::detail::WorldModel< T >::GetContacts_ ( BodyID  id) const
inlineoverridevirtual

Gets the container of contacts attached to the identified body.

Warning
This collection changes during the time step and you may miss some collisions if you don't use ContactFunction.
Exceptions
std::out_of_rangeIf given an invalid body identifier.
See also
GetBodyRange_.

Implements playrho::d2::detail::WorldConcept.

◆ GetData_() [1/2]

template<class T >
const void* playrho::d2::detail::WorldModel< T >::GetData_ ( ) const
inlineoverridevirtualnoexcept

Gets the data for the underlying configuration.

Implements playrho::d2::detail::WorldConcept.

◆ GetData_() [2/2]

template<class T >
void* playrho::d2::detail::WorldModel< T >::GetData_ ( )
inlineoverridevirtualnoexcept

Gets the data for the underlying configuration.

Implements playrho::d2::detail::WorldConcept.

◆ GetInvDeltaTime_()

template<class T >
Frequency playrho::d2::detail::WorldModel< T >::GetInvDeltaTime_ ( ) const
inlineoverridevirtualnoexcept

Gets the inverse delta time.

Gets the inverse delta time that was set on construction or assignment, and updated on every call to the Step_ function having a non-zero delta-time.

See also
Step_.

Implements playrho::d2::detail::WorldConcept.

◆ GetJoint_()

template<class T >
Joint playrho::d2::detail::WorldModel< T >::GetJoint_ ( JointID  id) const
inlineoverridevirtual

Gets the value of the identified joint.

Exceptions
std::out_of_rangeIf given an invalid joint identifier.
See also
SetJoint_, GetJointRange_.

Implements playrho::d2::detail::WorldConcept.

◆ GetJointRange_()

template<class T >
JointCounter playrho::d2::detail::WorldModel< T >::GetJointRange_ ( ) const
inlineoverridevirtualnoexcept

Gets the extent of the currently valid joint range.

Note
This is one higher than the maxium JointID that is in range for joint related functions.

Implements playrho::d2::detail::WorldConcept.

◆ GetJoints_() [1/2]

template<class T >
std::vector<JointID> playrho::d2::detail::WorldModel< T >::GetJoints_ ( ) const
inlineoverridevirtual

Gets the range of joints attached to the identified body.

Exceptions
std::out_of_rangeIf given an invalid body identifier.
See also
CreateJoint_, GetBodyRange_.

Implements playrho::d2::detail::WorldConcept.

◆ GetJoints_() [2/2]

template<class T >
std::vector<std::pair<BodyID, JointID> > playrho::d2::detail::WorldModel< T >::GetJoints_ ( BodyID  id) const
inlineoverridevirtual

Gets the range of joints attached to the identified body.

Exceptions
std::out_of_rangeIf given an invalid body identifier.
See also
CreateJoint_, GetBodyRange_.

Implements playrho::d2::detail::WorldConcept.

◆ GetManifold_()

template<class T >
Manifold playrho::d2::detail::WorldModel< T >::GetManifold_ ( ContactID  id) const
inlineoverridevirtual

Gets the collision manifold for the identified contact.

Exceptions
std::out_of_rangeIf given an invalid contact identifier.
See also
SetManifold_, GetContactRange_.

Implements playrho::d2::detail::WorldConcept.

◆ GetResourceStats_()

template<class T >
std::optional<pmr::StatsResource::Stats> playrho::d2::detail::WorldModel< T >::GetResourceStats_ ( ) const
inlineoverridevirtualnoexcept

Gets the polymorphic memory resource statistics.

Note
This will be the zero initialized value unless the world configuration the world was constructed with specified the collection of these statistics.

Implements playrho::d2::detail::WorldConcept.

◆ GetShape_()

template<class T >
Shape playrho::d2::detail::WorldModel< T >::GetShape_ ( ShapeID  id) const
inlineoverridevirtual

Exceptions
std::out_of_rangeIf given an invalid shape identifier.
See also
CreateShape_.

Implements playrho::d2::detail::WorldConcept.

◆ GetShapeRange_()

template<class T >
ShapeCounter playrho::d2::detail::WorldModel< T >::GetShapeRange_ ( ) const
inlineoverridevirtualnoexcept

Gets the extent of the currently valid shape range.

Note
This is one higher than the maxium ShapeID that is in range for shape related functions.

Implements playrho::d2::detail::WorldConcept.

◆ GetShapes_()

template<class T >
std::vector<ShapeID> playrho::d2::detail::WorldModel< T >::GetShapes_ ( BodyID  id) const
inlineoverridevirtual

Gets the identities of the shapes associated with the identified body.

Exceptions
std::out_of_rangeIf given an invalid body identifier.
See also
GetBodyRange_, CreateBody_, SetBody_.

Implements playrho::d2::detail::WorldConcept.

◆ GetSubStepping_()

template<class T >
bool playrho::d2::detail::WorldModel< T >::GetSubStepping_ ( ) const
inlineoverridevirtualnoexcept

Gets whether or not sub-stepping is enabled.

See also
SetSubStepping_, IsStepComplete_.

Implements playrho::d2::detail::WorldConcept.

◆ GetTree_()

template<class T >
const DynamicTree& playrho::d2::detail::WorldModel< T >::GetTree_ ( ) const
inlineoverridevirtualnoexcept

Gets access to the broad-phase dynamic tree information.

Todo:
Consider removing this function. This function exposes the implementation detail of the broad-phase contact detection system.

Implements playrho::d2::detail::WorldConcept.

◆ GetType_()

template<class T >
TypeID playrho::d2::detail::WorldModel< T >::GetType_ ( ) const
inlineoverridevirtualnoexcept

Gets the use type information.

Returns
Type info of the underlying value's type.

Implements playrho::d2::detail::WorldConcept.

Referenced by playrho::d2::detail::WorldModel< T >::IsEqual_().

◆ GetVertexRadiusInterval_()

template<class T >
Interval<Positive<Length> > playrho::d2::detail::WorldModel< T >::GetVertexRadiusInterval_ ( ) const
inlineoverridevirtualnoexcept

Gets the vertex radius range that shapes in this world can be within.

Implements playrho::d2::detail::WorldConcept.

◆ IsLocked_()

template<class T >
bool playrho::d2::detail::WorldModel< T >::IsLocked_ ( ) const
inlineoverridevirtualnoexcept

Is the world locked (in the middle of a time step).

Implements playrho::d2::detail::WorldConcept.

◆ IsStepComplete_()

template<class T >
bool playrho::d2::detail::WorldModel< T >::IsStepComplete_ ( ) const
inlineoverridevirtualnoexcept

Whether or not "step" is complete.

A "step" is completed when there are no more TOI events for the current time step.

Returns
true unless sub-stepping is enabled and the step function returned without finishing all of its sub-steps.
See also
GetSubStepping_, SetSubStepping_.

Implements playrho::d2::detail::WorldConcept.

◆ SetBeginContactListener_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetBeginContactListener_ ( ContactFunction  listener)
inlineoverridevirtualnoexcept

Sets a begin contact event listener.

Implements playrho::d2::detail::WorldConcept.

◆ SetBody_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetBody_ ( BodyID  id,
const Body value 
)
inlineoverridevirtual

Sets the state of the identified body.

Exceptions
std::out_of_rangeif given an invalid id of if the given body references any invalid shape identifiers.
InvalidArgumentif the specified ID was destroyed.
See also
GetBody_, GetBodyRange_.

Implements playrho::d2::detail::WorldConcept.

◆ SetContact_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetContact_ ( ContactID  id,
const Contact value 
)
inlineoverridevirtual

Sets the identified contact's state.

Parameters
idIdentifier of the contact whose state is to be set.
valueValue the contact is to be set to.
Exceptions
std::out_of_rangeIf given an invalid identifier.
InvalidArgumentif the identifier is to a freed contact or if the new state is not allowable.
See also
GetContact_, GetContactRange_.

Implements playrho::d2::detail::WorldConcept.

◆ SetDetachListener_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetDetachListener_ ( BodyShapeFunction  listener)
inlineoverridevirtualnoexcept

Sets the detach listener for shapes detaching from bodies.

Implements playrho::d2::detail::WorldConcept.

◆ SetEndContactListener_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetEndContactListener_ ( ContactFunction  listener)
inlineoverridevirtualnoexcept

Sets an end contact event listener.

Implements playrho::d2::detail::WorldConcept.

◆ SetJoint_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetJoint_ ( JointID  id,
const Joint def 
)
inlineoverridevirtual

Sets the identified joint to the given value.

Exceptions
WrongStateif this function is called while the world is locked.
std::out_of_rangeIf given an invalid joint identifier.
InvalidArgumentif the specified ID was destroyed.
See also
GetJoint_, GetJointRange_.

Implements playrho::d2::detail::WorldConcept.

◆ SetJointDestructionListener_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetJointDestructionListener_ ( JointFunction  listener)
inlineoverridevirtualnoexcept

Sets a destruction listener for joints.

Note
This listener is called on Clear_() for every joint. It's also called on Destroy_(BodyID) for every joint associated with the identified body.
See also
Clear_, Destroy_(BodyID).

Implements playrho::d2::detail::WorldConcept.

◆ SetManifold_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetManifold_ ( ContactID  id,
const Manifold value 
)
inlineoverridevirtual

Sets the collision manifold for the identified contact.

Exceptions
std::out_of_rangeIf given an invalid contact identifier.
See also
GetManifold_, GetContactRange_.

Implements playrho::d2::detail::WorldConcept.

◆ SetPostSolveContactListener_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetPostSolveContactListener_ ( ContactImpulsesFunction  listener)
inlineoverridevirtualnoexcept

Sets a post-solve contact event listener.

Implements playrho::d2::detail::WorldConcept.

◆ SetPreSolveContactListener_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetPreSolveContactListener_ ( ContactManifoldFunction  listener)
inlineoverridevirtualnoexcept

Sets a pre-solve contact event listener.

Implements playrho::d2::detail::WorldConcept.

◆ SetShape_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetShape_ ( ShapeID  id,
const Shape def 
)
inlineoverridevirtual

Sets the identified shape to the new value.

Exceptions
std::out_of_rangeIf given an invalid shape identifier.
InvalidArgumentif the specified ID was destroyed.
See also
CreateShape_.

Implements playrho::d2::detail::WorldConcept.

◆ SetShapeDestructionListener_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetShapeDestructionListener_ ( ShapeFunction  listener)
inlineoverridevirtualnoexcept

Sets the destruction listener for shapes.

Note
This listener is called on Clear_() for every shape.
See also
Clear_.

Implements playrho::d2::detail::WorldConcept.

◆ SetSubStepping_()

template<class T >
void playrho::d2::detail::WorldModel< T >::SetSubStepping_ ( bool  flag)
inlineoverridevirtualnoexcept

Enables/disables single stepped continuous physics.

Note
This is not normally used. Enabling sub-stepping is meant for testing.
Postcondition
The GetSubStepping_() function will return the value this function was called with.
See also
IsStepComplete_, GetSubStepping_.

Implements playrho::d2::detail::WorldConcept.

◆ ShiftOrigin_()

template<class T >
void playrho::d2::detail::WorldModel< T >::ShiftOrigin_ ( const Length2 newOrigin)
inlineoverridevirtual

Shifts the world origin.

Note
Useful for large worlds.
The body shift formula is: position -= newOrigin.
Postcondition
The "origin" of this world's bodies, joints, and the board-phase dynamic tree have been translated per the shift amount and direction.
Parameters
newOriginthe new origin with respect to the old origin
Exceptions
WrongStateif this function is called while the world is locked.

Implements playrho::d2::detail::WorldConcept.

◆ Step_()

template<class T >
StepStats playrho::d2::detail::WorldModel< T >::Step_ ( const StepConf conf)
inlineoverridevirtual

Steps the world simulation according to the given configuration.

Performs position and velocity updating, sleeping of non-moving bodies, updating of the contacts, and notifying the contact listener of begin-contact, end-contact, pre-solve, and post-solve events.

Warning
Behavior is not specified if given a negative step time delta.
Varying the step time delta may lead to non-physical behaviors.
Note
Calling this with a zero step time delta results only in fixtures and bodies registered for special handling being processed. No physics is performed.
If the given velocity and position iterations are zero, this function doesn't do velocity or position resolutions respectively of the contacting bodies.
While body velocities are updated accordingly (per the sum of forces acting on them), body positions (barring any collisions) are updated as if they had moved the entire time step at those resulting velocities. In other words, a body initially at position 0 (p0) going velocity 0 (v0) fast with a sum acceleration of a, after time t and barring any collisions, will have a new velocity (v1) of v0 + (a * t) and a new position (p1) of p0 + v1 * t.
Postcondition
Static bodies are unmoved.
Kinetic bodies are moved based on their previous velocities.
Dynamic bodies are moved based on their previous velocities, gravity, applied forces, applied impulses, masses, damping, and the restitution and friction values of their fixtures when they experience collisions.
Parameters
confConfiguration for the simulation step.
Returns
Statistics for the step.
Exceptions
WrongStateif this function is called while the world is locked.

Implements playrho::d2::detail::WorldConcept.


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