Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
trax::Scene Struct Referenceabstract

A physical simulation scene for running a simulation and creating physical objects in the scene. More...

#include <C:/Trend/Development/Trax3/Code/trax/rigid/Scene.h>

Inheritance diagram for trax::Scene:

Public Member Functions

virtual const char * TypeName () const noexcept=0
virtual bool IsValid (bool bSilent=true) const noexcept=0
 Checks whether the scene is valid.
virtual void Up (const spat::Vector< One > &up)=0
 Sets the up direction for this simulator.
virtual spat::Vector< OneUp () const =0
 Gets the up direction for this simulator.
virtual void Gravity (const spat::Vector< Acceleration > &gravityAccelerarion)=0
 Sets the vector of gravity acceleration.
virtual spat::Vector< AccelerationGravity () const =0
 Gets the gravity force applied with this simulator.
virtual void Register (Simulated &simulated)=0
 Registers a Simulated object for simulation.
virtual void Unregister (const Simulated &simulated)=0
 Unregisters a Simulated object from simulation.
virtual void UnregisterAllSimulated ()=0
 Unregisters all Simulated objects from simulation.
virtual bool IsSimulationRunning () const noexcept=0
virtual Time SimulationTime () const noexcept=0
virtual void BeginSimulation () noexcept=0
 Prepares the simulation to start.
virtual void Loop (Time forTimePeriod)=0
 Steps the simulation by fixed_timestep until forTimePeriod expires.
virtual void Step (Time dt=fixed_timestep)=0
 Completes one simulation step.
virtual void EndSimulation () noexcept=0
 Cleans up after the simulation ends.
virtual void Pause () noexcept=0
 Pauses the simulation.
virtual void Resume () noexcept=0
 Resumes the simulation.
virtual void Stop () noexcept=0
 Stops the simulation loop.
virtual std::unique_ptr< BodyCreateBody () const =0
virtual std::unique_ptr< ShapeCreateShape () const =0
virtual std::unique_ptr< GestaltCreateGestalt () const =0
virtual std::unique_ptr< GestaltCreateGestalt (spat::Box< Length > box, Mass mass) const noexcept=0
virtual std::unique_ptr< GeomCreateGeom (GeomType type) const =0
virtual std::unique_ptr< GeomCuboidCreateGeomCuboid () const =0
virtual std::unique_ptr< GeomCylinderCreateGeomCylinder () const =0
virtual std::unique_ptr< GeomCapsuleCreateGeomCapsule () const =0
virtual std::unique_ptr< GeomSphereCreateGeomSphere () const =0
virtual std::unique_ptr< GeomHeightFieldCreateGeomHeightField () const =0
virtual std::unique_ptr< GeomMeshCreateGeomConvexMesh () const =0
virtual std::unique_ptr< GeomMeshCreateGeomTriangleMesh () const =0
virtual std::unique_ptr< HingeJointCreateHingeJoint (Body *pBodyA, const spat::Frame< Length, One > &localAnchorA, Body *pBodyB, const spat::Frame< Length, One > &localAnchorB) const =0
virtual std::unique_ptr< SliderJointCreateSliderJoint (Body *pBodyA, const spat::Frame< Length, One > &localAnchorA, Body *pBodyB, const spat::Frame< Length, One > &localAnchorB) const =0
virtual std::unique_ptr< BallAndSocketJointCreateBallAndSocketJoint (Body *pBodyA, const spat::Frame< Length, One > &localAnchorA, Body *pBodyB, const spat::Frame< Length, One > &localAnchorB) const =0
virtual std::unique_ptr< DistanceJointCreateDistanceJoint (Body *pBodyA, const spat::Frame< Length, One > &localAnchorA, Body *pBodyB, const spat::Frame< Length, One > &localAnchorB) const =0
virtual std::shared_ptr< TrackJointFeederCreateTrackJointFeeder (const Body &bodyMoving, const spat::Frame< Length, One > &localAnchor) noexcept=0
virtual std::shared_ptr< TrackJointFeederCreateTrackJointFeeder (const Body &bodyMoving, const spat::Frame< Length, One > &localAnchor, const Body &bodyTrack) noexcept=0
virtual std::shared_ptr< TrackJointFeederMotorModelCreateTrackJointFeederMotorModel (const Body &bodyMoving, const spat::Frame< Length, One > &localAnchor) noexcept=0
virtual std::shared_ptr< TrackJointFeederMotorModelCreateTrackJointFeederMotorModel (const Body &bodyMoving, const spat::Frame< Length, One > &localAnchor, const Body &bodyTrack) noexcept=0
virtual void Release (TrackJointFeeder &feeder) noexcept=0
virtual void DumpTasksTo (std::ostream &stream) const noexcept=0
 Dumps information about all tasks to the given stream.
virtual struct JackJackOnSimulationStep () noexcept=0
 A Jack that triggers a pulse once a simulation step.
virtual struct MultiPlugPlugToStop () noexcept=0
 A Plug that stops a running simulation.
Simulate

Enters a main simulation loop and simulates the scene.

The simulation is left when the simulation is stopped or the PlugToStop is triggered.

Parameters
forTimePeriodTime to run simulation for. This is meant as a convenience function to run the simulation for a certain time (e.g. for testing); to do one simulation step in a game loop use Loop() or Step() instead.
virtual void Simulate ()=0
virtual void Simulate (Time forTimePeriod)=0
Public Member Functions inherited from trax::Identified< Scene >
virtual const std::string & Reference (const std::string &name) const=0
 Gets a reference that was set for this object by name.
virtual const std::vector< char const * > & ReferenceNames (const std::string &namePart) const=0
 Searches for all reference names that countain namePart as substring in the name.
virtual IDType ID () const noexcept=0
 Identified (const Identified &)=delete
Identified & operator= (const Identified &)=delete

Static Public Member Functions

static dclspc std::unique_ptr< SceneMake (const Simulator &simulator) noexcept
 Makes a Scene object.

Detailed Description

A physical simulation scene for running a simulation and creating physical objects in the scene.

The times given to the simulation are proper simulation times, not the time that passes for the real world. Ideally the simulation runs faster than real time. It is strongly recommended to use fixed time steps for the simulation; variable time steps will lead to instabilities. Use the Loop() method to adapt to variable time steps.

Member Function Documentation

◆ BeginSimulation()

virtual void trax::Scene::BeginSimulation ( )
pure virtualnoexcept

Prepares the simulation to start.

If you do not use the Simulate() methods but Loop() or Step() the simulation your own, call this before entering the simulation loop the first time.

◆ EndSimulation()

virtual void trax::Scene::EndSimulation ( )
pure virtualnoexcept

Cleans up after the simulation ends.

If you do not use the Simulate() methods but Loop() or Step() the simulation your own, call this after leaving the simulation loop the last time.

◆ Gravity()

virtual void trax::Scene::Gravity ( const spat::Vector< Acceleration > & gravityAccelerarion)
pure virtual

Sets the vector of gravity acceleration.

Gravity acts according to the negative up direction.

Parameters
gravityAccelerarionVector of gravity acceleration.

◆ IsSimulationRunning()

virtual bool trax::Scene::IsSimulationRunning ( ) const
pure virtualnoexcept
Returns
whether the simulation is currently running.

◆ IsValid()

virtual bool trax::Scene::IsValid ( bool bSilent = true) const
pure virtualnoexcept

Checks whether the scene is valid.

Parameters
bSilentIf false there will be diagnostic output to the console.
Returns
true if the scene is valid.

◆ JackOnSimulationStep()

virtual struct Jack & trax::Scene::JackOnSimulationStep ( )
pure virtualnoexcept

A Jack that triggers a pulse once a simulation step.

Use this to create a timer.

◆ Loop()

virtual void trax::Scene::Loop ( Time forTimePeriod)
pure virtual

Steps the simulation by fixed_timestep until forTimePeriod expires.

The loop is left when the simulation is stopped or the PlugToStop is triggered.

Parameters
forTimePeriodTime to run simulation for.

◆ Register()

virtual void trax::Scene::Register ( Simulated & simulated)
pure virtual

Registers a Simulated object for simulation.

Objects that are created with a scene reference register automatically, others will need manual registration.

Parameters
simulatedThe Simulated object to register.

◆ SimulationTime()

virtual Time trax::Scene::SimulationTime ( ) const
pure virtualnoexcept
Returns
the current expired simulation time.

◆ TypeName()

virtual const char * trax::Scene::TypeName ( ) const
pure virtualnoexcept
Returns
the name for the object type that implements this interface.

◆ Up()

virtual void trax::Scene::Up ( const spat::Vector< One > & up)
pure virtual

Sets the up direction for this simulator.

Parameters
upVector pointing in the up direction

The documentation for this struct was generated from the following file:
  • C:/Trend/Development/Trax3/Code/trax/rigid/Scene.h