The Physics::ISimulator interface represents a generic physics simulator. More...

#include "murl_physics_i_simulator.h"

Inheritance diagram for Murl::Physics::ISimulator:

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 IObjectCreateObject (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 PropertyInfoGetPropertyInfo ()
 Get the class' property info struct. More...
 
static const AttributeInfoGetAttributeInfo ()
 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()

virtual Bool Murl::Physics::ISimulator::Init ( IEngine engine,
const IAppConfiguration appConfig,
IFeatureSet features 
)
pure virtual

Initialize the simulator.

Parameters
engineThe engine to attach to.
appConfigThe application configuration object.
featuresThe feature set to possibly update according to this renderer' capabilities.
Returns
true if successful.

◆ DeInit()

virtual Bool Murl::Physics::ISimulator::DeInit ( )
pure virtual

Deinitialize the simulator.

Returns
true if successful.

◆ CreateObject()

virtual IObject* Murl::Physics::ISimulator::CreateObject ( const String className)
pure virtual

Create a simulator object.

Parameters
classNameThe class name of the simulator object to create.
Returns
The newly created object, or null if failed.

◆ DestroyObject()

virtual Bool Murl::Physics::ISimulator::DestroyObject ( IObject *&  object)
pure virtual

Destroy an object that was created by this simulator.

Parameters
objectA reference to a pointer containing the object to destroy.
Returns
true if successful.

◆ BeginSubmission()

virtual Bool Murl::Physics::ISimulator::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()

virtual Bool Murl::Physics::ISimulator::EndSubmission ( )
pure virtual

End submission of simulator objects for the next tick.

Returns
true if successful.

◆ BeginSimulation()

virtual Bool Murl::Physics::ISimulator::BeginSimulation ( Real  dt)
pure virtual

Start the actual simulation process after all current objects have been submitted.

Parameters
dtThe simulator time step.
Returns
true if successful.

◆ EndSimulation()

virtual Bool Murl::Physics::ISimulator::EndSimulation ( )
pure virtual

Wait for the current simulation process to complete, after calling BeginSimulation().

Returns
true if successful.

◆ SetCurrentIsland()

virtual void Murl::Physics::ISimulator::SetCurrentIsland ( IIsland *  island)
pure virtual

Set the current island affecting subsequent physics objects.

This method must only be called between BeginSubmission() and EndSubmission().

Parameters
islandThe island to activate.

◆ SetCurrentTransform()

virtual void Murl::Physics::ISimulator::SetCurrentTransform ( const Matrix transform,
const Vector scaleFactor 
)
pure virtual

Set the current world transform affecting subsequent objects.

This method must only be called between BeginSubmission() and EndSubmission().

Parameters
transformThe world transform to apply.
scaleFactorThe world scale factor to apply.

◆ SetCurrentSurfaces()

virtual void Murl::Physics::ISimulator::SetCurrentSurfaces ( const ISurface **  surfaces,
UInt32  numberOfSurfaces 
)
pure virtual

Set multiple surfaces affecting subsequent object collisions.

This method must only be called between BeginSubmission() and EndSubmission().

Parameters
surfacesAn array of surfaces to apply.
numberOfSurfacesThe actual number of surfaces to activate.

◆ PushGeometryToSimulate()

virtual void Murl::Physics::ISimulator::PushGeometryToSimulate ( IGeometry *  geometry)
pure virtual

Attach a collidable geometry object to the current body for simulation.

This method must only be called between BeginSubmission() and EndSubmission().

Parameters
geometryThe collidable geometry to attach.

◆ PushSpringToSimulate()

virtual void Murl::Physics::ISimulator::PushSpringToSimulate ( ISpring *  spring)
pure virtual

Queue up a spring object for simulation.

This method must only be called between BeginSubmission() and EndSubmission().

Parameters
springThe spring to queue up.

◆ PushJointToSimulate()

virtual void Murl::Physics::ISimulator::PushJointToSimulate ( IJoint *  joint)
pure virtual

Queue up a joint object for simulation.

This method must only be called between BeginSubmission() and EndSubmission().

Parameters
jointThe joint to queue up.

◆ PushFieldToSimulate()

virtual void Murl::Physics::ISimulator::PushFieldToSimulate ( IField *  field)
pure virtual

Queue up a field object for simulation.

This method must only be called between BeginSubmission() and EndSubmission().

Parameters
fieldThe field to queue up.

◆ PushBodyToSimulate()

virtual void Murl::Physics::ISimulator::PushBodyToSimulate ( IBody *  body,
Matrix worldTransform 
)
pure virtual

Push a body to the internal stack for simulation.

This method must only be called between BeginSubmission() and EndSubmission().

Parameters
bodyThe body to push.
worldTransformThe output world transform return value.

◆ PopBodyToSimulate()

virtual void Murl::Physics::ISimulator::PopBodyToSimulate ( IBody *  body)
pure virtual

Pop a body off the internal stack for simulation.

This method must only be called between BeginSubmission() and EndSubmission().

Parameters
bodyThe body to pop.

◆ WasReset()

virtual Bool Murl::Physics::ISimulator::WasReset ( ) const
pure virtual

Check if the current island was reset.

Returns
true if reset.

◆ CollectStatisticsObjects()

virtual Bool Murl::Physics::ISimulator::CollectStatisticsObjects ( Index< const IStatisticsObject * > &  objects) const
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
objectsAn 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


Copyright © 2011-2024 Spraylight GmbH.