![]() |
Murl Engine API
Version 2025.1
|
The Physics::ISimulator interface represents a generic physics simulator. More...
#include <murl_physics_i_simulator.h>
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.
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... | |
|
pure virtual |
Initialize the simulator.
| engine | The engine to attach to. |
| appConfig | The application configuration object. |
| features | The feature set to possibly update according to this renderer' capabilities. |
|
pure virtual |
Deinitialize the simulator.
Create a simulator object.
| className | The class name of the simulator object to create. |
Destroy an object that was created by this simulator.
| object | A reference to a pointer containing the object to destroy. |
|
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.
|
pure virtual |
End submission of simulator objects for the next tick.
Start the actual simulation process after all current objects have been submitted.
| dt | The simulator time step. |
|
pure virtual |
Wait for the current simulation process to complete, after calling BeginSimulation().
|
pure virtual |
Set the current island affecting subsequent physics objects.
This method must only be called between BeginSubmission() and EndSubmission().
| island | The island to activate. |
|
pure virtual |
Set the current world transform affecting subsequent objects.
This method must only be called between BeginSubmission() and EndSubmission().
| transform | The world transform to apply. |
| scaleFactor | The world scale factor to apply. |
|
pure virtual |
Set multiple surfaces affecting subsequent object collisions.
This method must only be called between BeginSubmission() and EndSubmission().
| surfaces | An array of surfaces to apply. |
| numberOfSurfaces | The actual number of surfaces to activate. |
|
pure virtual |
Attach a collidable geometry object to the current body for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
| geometry | The collidable geometry to attach. |
|
pure virtual |
Queue up a spring object for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
| spring | The spring to queue up. |
|
pure virtual |
Queue up a joint object for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
| joint | The joint to queue up. |
|
pure virtual |
Queue up a field object for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
| field | The field to queue up. |
|
pure virtual |
Push a body to the internal stack for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
| body | The body to push. |
| worldTransform | The output world transform return value. |
|
pure virtual |
Pop a body off the internal stack for simulation.
This method must only be called between BeginSubmission() and EndSubmission().
| body | The body to pop. |
|
pure virtual |
Check if the current island was reset.
|
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.
| objects | An index to receive all the present objects. |