The Physics::ISimulator interface represents a generic physics simulator. More...
#include "murl_physics_i_simulator.h"
Public Member Functions | |
virtual Bool | Init (IEngine *engine, const IAppConfiguration *appConfig, IFeatureSet *features)=0 |
Initialize the simulator. More... | |
virtual Bool | DeInit ()=0 |
Deinitialize the simulator. More... | |
virtual IObject * | CreateObject (const String &className)=0 |
Create a simulator object. More... | |
virtual Bool | DestroyObject (IObject *&object)=0 |
Destroy an object that was created by this simulator. More... | |
virtual Bool | BeginSubmission ()=0 |
Begin submission of simulator objects for the next tick. More... | |
virtual Bool | EndSubmission ()=0 |
End submission of simulator objects for the next tick. More... | |
virtual Bool | BeginSimulation (Real dt)=0 |
Start the actual simulation process after all current objects have been submitted. More... | |
virtual Bool | EndSimulation ()=0 |
Wait for the current simulation process to complete, after calling BeginSimulation(). More... | |
virtual void | SetCurrentIsland (IIsland *island)=0 |
Set the current island affecting subsequent physics objects. More... | |
virtual void | SetCurrentTransform (const Matrix *transform, const Vector *scaleFactor)=0 |
Set the current world transform affecting subsequent objects. More... | |
virtual void | SetCurrentSurfaces (const ISurface **surfaces, UInt32 numberOfSurfaces)=0 |
Set multiple surfaces affecting subsequent object collisions. More... | |
virtual void | PushGeometryToSimulate (IGeometry *geometry)=0 |
Attach a collidable geometry object to the current body for simulation. More... | |
virtual void | PushSpringToSimulate (ISpring *spring)=0 |
Queue up a spring object for simulation. More... | |
virtual void | PushJointToSimulate (IJoint *joint)=0 |
Queue up a joint object for simulation. More... | |
virtual void | PushFieldToSimulate (IField *field)=0 |
Queue up a field object for simulation. More... | |
virtual void | PushBodyToSimulate (IBody *body, Matrix &worldTransform)=0 |
Push a body to the internal stack for simulation. More... | |
virtual void | PopBodyToSimulate (IBody *body)=0 |
Pop a body off the internal stack for simulation. More... | |
virtual Bool | WasReset () const =0 |
Check if the current island was reset. More... | |
virtual Bool | CollectStatisticsObjects (Index< const IStatisticsObject * > &objects) const =0 |
Populate a given index with all objects currently present in the simulator. More... | |
Public Member Functions inherited from Murl::IFactoryObject< ISimulator > | |
~IFactoryObject () override | |
The destructor. | |
virtual const ClassInfo * | GetObjectClassInfo () const=0 |
Get the object instance's class info, if present. More... | |
virtual void | ResetObjectProperties ()=0 |
Reset the object instance's properties to their default values. | |
Public Member Functions inherited from Murl::Physics::ISimulatorRegistry | |
virtual Bool | RegisterObjectClass (const IObject::ClassInfo &classInfo)=0 |
Register an object class. More... | |
virtual Bool | UnregisterObjectClass (const IObject::ClassInfo &classInfo)=0 |
Unregister a previously registered object class. More... | |
virtual SInt32 | GetRegisteredObjectClassInfoIndex (const IObject::ClassInfo &classInfo) const =0 |
Query the index of a registered object class, by its ClassInfo structure. More... | |
virtual SInt32 | GetRegisteredObjectClassInfoIndex (const String &className) const =0 |
Query the index of a registered object class, by its class name. More... | |
virtual UInt32 | GetNumberOfRegisteredObjectClassInfos () const =0 |
Get the total number of registered object classes. More... | |
virtual const IObject::ClassInfo * | GetRegisteredObjectClassInfo (UInt32 index) const =0 |
Get the ClassInfo structure of a registered object class. More... | |
Additional Inherited Members | |
Public Types inherited from Murl::IFactoryObject< ISimulator > | |
using | ClassInfoArray = Array< const ClassInfo * > |
Definition of an array of ClassInfo objects. | |
Static Public Member Functions inherited from Murl::IFactoryObject< ISimulator > | |
static const PropertyInfo * | GetPropertyInfo () |
Get the class' property info struct. More... | |
static const AttributeInfo * | GetAttributeInfo () |
Get the class' attribute info struct. More... | |
static void | ResetProperties (IFactoryObject< ISimulator > *object) |
Reset an object instance's properties to their default values. More... | |
Detailed Description
The Physics::ISimulator interface represents a generic physics simulator.
For most cases, an application does not need to directly interact with this interface. Instead, using physics-related nodes from the Murl::Graph Node Interfaces or Murl::Graph Node Classes sections is the preferred way to implement physics simulation functionality in a cross-platform manner.
Accessing the physics simulator interface directly may be useful in advanced use cases, when creating custom physics objects or even a complete custom simulator suite.
Member Function Documentation
◆ Init()
|
pure virtual |
Initialize the simulator.
- Parameters
-
engine The engine to attach to. appConfig The application configuration object. features The feature set to possibly update according to this renderer' capabilities.
- Returns
- true if successful.
◆ DeInit()
|
pure virtual |
Deinitialize the simulator.
- Returns
- true if successful.
◆ CreateObject()
Create a simulator object.
- Parameters
-
className The class name of the simulator object to create.
- Returns
- The newly created object, or null if failed.
◆ DestroyObject()
Destroy an object that was created by this simulator.
- Parameters
-
object A reference to a pointer containing the object to destroy.
- Returns
- true if successful.
◆ BeginSubmission()
|
pure virtual |
Begin submission of simulator objects for the next tick.
Any calls to state-changing methods like SetCurrentTransform() or SetCurrentSurfaces() must happen between a call to this method and the corresponding EndSubmission() call.
- Returns
- true if successful.
◆ EndSubmission()
|
pure virtual |
End submission of simulator objects for the next tick.
- Returns
- true if successful.
◆ BeginSimulation()
Start the actual simulation process after all current objects have been submitted.
- Parameters
-
dt The simulator time step.
- Returns
- true if successful.
◆ EndSimulation()
|
pure virtual |
Wait for the current simulation process to complete, after calling BeginSimulation().
- Returns
- true if successful.
◆ SetCurrentIsland()
|
pure virtual |
Set the current island affecting subsequent physics objects.
This method must only be called between BeginSubmission() and EndSubmission().
- Parameters
-
island The island to activate.
◆ SetCurrentTransform()
|
pure virtual |
Set the current world transform affecting subsequent objects.
This method must only be called between BeginSubmission() and EndSubmission().
- Parameters
-
transform The world transform to apply. scaleFactor The world scale factor to apply.
◆ SetCurrentSurfaces()
|
pure virtual |
Set multiple surfaces affecting subsequent object collisions.
This method must only be called between BeginSubmission() and EndSubmission().
- Parameters
-
surfaces An array of surfaces to apply. numberOfSurfaces The actual number of surfaces to activate.
◆ PushGeometryToSimulate()
|
pure virtual |
Attach a collidable geometry object to the current body for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
- Parameters
-
geometry The collidable geometry to attach.
◆ PushSpringToSimulate()
|
pure virtual |
Queue up a spring object for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
- Parameters
-
spring The spring to queue up.
◆ PushJointToSimulate()
|
pure virtual |
Queue up a joint object for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
- Parameters
-
joint The joint to queue up.
◆ PushFieldToSimulate()
|
pure virtual |
Queue up a field object for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
- Parameters
-
field The field to queue up.
◆ PushBodyToSimulate()
|
pure virtual |
Push a body to the internal stack for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
- Parameters
-
body The body to push. worldTransform The output world transform return value.
◆ PopBodyToSimulate()
|
pure virtual |
Pop a body off the internal stack for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
- Parameters
-
body The body to pop.
◆ WasReset()
|
pure virtual |
Check if the current island was reset.
- Returns
- true if reset.
◆ CollectStatisticsObjects()
|
pure virtual |
Populate a given index with all objects currently present in the simulator.
For this method to successfully return all the present objects, the method IEngineConfiguration::SetExtendedObjectStatisticsEnabled(true) must be called in the app's Configure() method.
- Parameters
-
objects An index to receive all the present objects.
- Returns
- true if successful.
The documentation for this interface was generated from the following file:
- murl_physics_i_simulator.h