Interface between type class template instantiated for and the WorldConcept class. More...
#include <playrho/d2/detail/WorldModel.hpp>
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< WorldConcept > | Clone_ () 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< BodyID > | GetBodies_ () const override |
Gets the world body range for this constant world. More... | |
std::vector< BodyID > | GetBodiesForProxies_ () 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< KeyedContactID > | GetContacts_ () 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< JointID > | GetJoints_ () 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::Stats > | GetResourceStats_ () 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< ShapeID > | GetShapes_ (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 DynamicTree & | GetTree_ () 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. | |
Interface between type class template instantiated for and the WorldConcept class.
|
inlineoverridevirtualnoexcept |
Clears the world.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Clones the instance - making a deep copy.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Creates a rigid body that's a copy of the given one.
GetBodies_()
function. body | A customized body or its default value. |
Destroy_(BodyID)
function. WrongState | if this function is called while the world is locked. |
LengthError | if this operation would create more than MaxBodies . |
std::out_of_range | if the given body references any invalid shape identifiers. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Creates a joint to constrain one or more bodies.
GetJoints_()
function. Destroy_(JointID)
function. WrongState | if this function is called while the world is locked. |
LengthError | if this operation would create more than MaxJoints . |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Creates an identifiable copy of the given shape within this world.
InvalidArgument | if called for a shape with a vertex radius that's either: less than the minimum vertex radius, or greater than the maximum vertex radius. |
WrongState | if this function is called while the world is locked. |
LengthError | if this operation would create more than MaxShapes . |
Implements playrho::d2::detail::WorldConcept.
|
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.
GetBodies_()
function. id | Identifier of body to destroy that had been created by this world. |
WrongState | if this function is called while the world is locked. |
std::out_of_range | If given an invalid body identifier. |
Implements playrho::d2::detail::WorldConcept.
|
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.
GetBodies_()
function. id | Identifier of body to destroy that had been created by this world. |
WrongState | if this function is called while the world is locked. |
std::out_of_range | If given an invalid body identifier. |
Implements playrho::d2::detail::WorldConcept.
|
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.
GetBodies_()
function. id | Identifier of body to destroy that had been created by this world. |
WrongState | if this function is called while the world is locked. |
std::out_of_range | If given an invalid body identifier. |
Implements playrho::d2::detail::WorldConcept.
|
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.
Implements playrho::d2::detail::WorldConcept.
|
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.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Gets the state of the identified body.
std::out_of_range | If given an invalid body identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Gets the extent of the currently valid body range.
BodyID
that is in range for body related functions. Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Gets the identified contact.
std::out_of_range | If given an invalid contact identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Gets the extent of the currently valid contact range.
ContactID
that is in range for contact related functions. Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Gets the container of contacts attached to the identified body.
ContactFunction
. std::out_of_range | If given an invalid body identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Gets the container of contacts attached to the identified body.
ContactFunction
. std::out_of_range | If given an invalid body identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Gets the data for the underlying configuration.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Gets the data for the underlying configuration.
Implements playrho::d2::detail::WorldConcept.
|
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.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Gets the value of the identified joint.
std::out_of_range | If given an invalid joint identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Gets the extent of the currently valid joint range.
JointID
that is in range for joint related functions. Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Gets the range of joints attached to the identified body.
std::out_of_range | If given an invalid body identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Gets the range of joints attached to the identified body.
std::out_of_range | If given an invalid body identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Gets the collision manifold for the identified contact.
std::out_of_range | If given an invalid contact identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Gets the polymorphic memory resource statistics.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
std::out_of_range | If given an invalid shape identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Gets the extent of the currently valid shape range.
ShapeID
that is in range for shape related functions. Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Gets the identities of the shapes associated with the identified body.
std::out_of_range | If given an invalid body identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Gets whether or not sub-stepping is enabled.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Gets access to the broad-phase dynamic tree information.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Gets the use type information.
Implements playrho::d2::detail::WorldConcept.
Referenced by playrho::d2::detail::WorldModel< T >::IsEqual_().
|
inlineoverridevirtualnoexcept |
Gets the vertex radius range that shapes in this world can be within.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Is the world locked (in the middle of a time step).
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Whether or not "step" is complete.
A "step" is completed when there are no more TOI events for the current time step.
true
unless sub-stepping is enabled and the step function returned without finishing all of its sub-steps. Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Sets a begin contact event listener.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Sets the state of the identified body.
std::out_of_range | if given an invalid id of if the given body references any invalid shape identifiers. |
InvalidArgument | if the specified ID was destroyed. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Sets the identified contact's state.
id | Identifier of the contact whose state is to be set. |
value | Value the contact is to be set to. |
std::out_of_range | If given an invalid identifier. |
InvalidArgument | if the identifier is to a freed contact or if the new state is not allowable. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Sets the detach listener for shapes detaching from bodies.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Sets an end contact event listener.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Sets the identified joint to the given value.
WrongState | if this function is called while the world is locked. |
std::out_of_range | If given an invalid joint identifier. |
InvalidArgument | if the specified ID was destroyed. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Sets a destruction listener for joints.
Clear_()
for every joint. It's also called on Destroy_(BodyID)
for every joint associated with the identified body. Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Sets the collision manifold for the identified contact.
std::out_of_range | If given an invalid contact identifier. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Sets a post-solve contact event listener.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Sets a pre-solve contact event listener.
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Sets the identified shape to the new value.
std::out_of_range | If given an invalid shape identifier. |
InvalidArgument | if the specified ID was destroyed. |
Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Sets the destruction listener for shapes.
Clear_()
for every shape. Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtualnoexcept |
Enables/disables single stepped continuous physics.
GetSubStepping_()
function will return the value this function was called with. Implements playrho::d2::detail::WorldConcept.
|
inlineoverridevirtual |
Shifts the world origin.
position -= newOrigin
. newOrigin | the new origin with respect to the old origin |
WrongState | if this function is called while the world is locked. |
Implements playrho::d2::detail::WorldConcept.
|
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.
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
. conf | Configuration for the simulation step. |
WrongState | if this function is called while the world is locked. |
Implements playrho::d2::detail::WorldConcept.