class
#include <esp/gfx/Simulator.h>
Simulator
Contents
Derived classes
Constructors, destructors, conversion operators
- Simulator(const SimulatorConfiguration& cfg) explicit
- ~Simulator() virtual
- Simulator() protected
Public functions
- void reconfigure(const SimulatorConfiguration& cfg) virtual
- void reset() virtual
-
void seed(uint32_
t newSeed) virtual -
auto getRenderer() -> std::
shared_ptr<Renderer> -
auto getPhysicsManager() -> std::
shared_ptr<physics:: PhysicsManager> -
auto getSemanticScene() -> std::
shared_ptr<scene:: SemanticScene> -
auto getActiveSceneGraph() -> scene::
SceneGraph& -
auto getActiveSemanticSceneGraph() -> scene::
SceneGraph& -
void saveFrame(const std::
string& filename) - auto gpuDevice() const -> int
- The ID of the CUDA device of the OpenGL context owned by the simulator. This will only be nonzero if the simulator is built in –headless mode on linux.
- auto addObject(const int objectLibIndex, const int sceneID = 0) -> int
- Instance an object from a template index in esp::
assets:: ResourceManager:: physicsObjectLibrary_. See esp:: physics:: PhysicsManager:: addObject(). - auto getPhysicsObjectLibrarySize() -> int
- Get the current size of the physics object library. Objects [0,size) can be instanced with addObject.
- auto removeObject(const int objectID, const int sceneID = 0) -> int
- Remove an instanced object by ID. See esp::
physics:: PhysicsManager:: removeObject(). -
auto getExistingObjectIDs(const int sceneID = 0) -> std::
vector<int> - Get the IDs of the physics objects instanced in a physical scene. See esp::
physics:: PhysicsManager:: getExistingObjectIDs. -
auto getObjectMotionType(const int objectID,
const int sceneID = 0) -> esp::
physics:: MotionType - Get the esp::
physics:: MotionType of an object. See esp:: physics:: PhysicsManager:: getExistingObjectIDs. -
auto setObjectMotionType(const esp::
physics:: MotionType& motionType, const int objectID, const int sceneID = 0) -> bool - Set the esp::
physics:: MotionType of an object. See esp:: physics:: PhysicsManager:: getExistingObjectIDs. -
void applyTorque(const Magnum::
Vector3& tau, const int objectID, const int sceneID = 0) - Apply torque to an object. See esp::
physics:: PhysicsManager:: applyTorque. -
void applyForce(const Magnum::
Vector3& force, const Magnum:: Vector3& relPos, const int objectID, const int sceneID = 0) - Apply force to an object. See esp::
physics:: PhysicsManager:: applyForce. -
auto getTransformation(const int objectID,
const int sceneID = 0) -> Magnum::
Matrix4 - Get the current 4x4 transformation matrix of an object. See esp::
physics:: PhysicsManager:: getTransformation. -
void setTransformation(const Magnum::
Matrix4& transform, const int objectID, const int sceneID = 0) - Set the 4x4 transformation matrix of an object kinematically. See esp::
physics:: PhysicsManager:: setTransformation. -
void setTranslation(const Magnum::
Vector3& translation, const int objectID, const int sceneID = 0) - Set the 3D position of an object kinematically. See esp::
physics:: PhysicsManager:: setTranslation. -
auto getTranslation(const int objectID,
const int sceneID = 0) -> Magnum::
Vector3 - Get the current 3D position of an object. See esp::
physics:: PhysicsManager:: getTranslation. -
void setRotation(const Magnum::
Quaternion& rotation, const int objectID, const int sceneID = 0) - Set the orientation of an object kinematically. See esp::
physics:: PhysicsManager:: setRotation. -
auto getRotation(const int objectID,
const int sceneID = 0) -> Magnum::
Quaternion - Get the current orientation of an object. See esp::
physics:: PhysicsManager:: getRotation. - auto stepWorld(const double dt = 1.0/60.0) -> double
- the physical world has a notion of time which passes during animation/simulation/action/etc... Step the physical world forward in time by a desired duration. Note that the actual duration of time passed by this step will depend on simulation time stepping mode (todo). See esp::
physics:: PhysicsManager:: stepPhysics. - auto getWorldTime() -> double
- Get the current time in the simulated world. This is always 0 if no esp::
physics:: PhysicsManager is initialized. See stepWorld. See esp:: physics:: PhysicsManager:: getWorldTime. -
auto recomputeNavMesh(nav::
PathFinder& pathfinder, const nav:: NavMeshSettings& navMeshSettings) -> bool - Compute the navmesh for the simulator's current active scene and assign it to the referenced nav::
PathFinder.
Protected variables
- WindowlessContext::uptr context_
-
std::
shared_ptr<Renderer> renderer_ -
assets::
ResourceManager resourceManager_ -
scene::
SceneManager sceneManager_ - int activeSceneID_
- int activeSemanticSceneID_
-
std::
vector<int> sceneID_ -
std::
shared_ptr<scene:: SemanticScene> semanticScene_ -
std::
shared_ptr<physics:: PhysicsManager> physicsManager_ -
core::
Random random_ - SimulatorConfiguration config_
Function documentation
int esp:: gfx:: Simulator:: addObject(const int objectLibIndex,
const int sceneID = 0)
Instance an object from a template index in esp::
Parameters | |
---|---|
objectLibIndex | The index of the object's template in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene to add an object to. |
Returns | The ID assigned to new object which identifies it in esp:: |
int esp:: gfx:: Simulator:: getPhysicsObjectLibrarySize()
Get the current size of the physics object library. Objects [0,size) can be instanced with addObject.
Returns | The current number of templates stored in esp:: |
---|
int esp:: gfx:: Simulator:: removeObject(const int objectID,
const int sceneID = 0)
Remove an instanced object by ID. See esp::
Parameters | |
---|---|
objectID | The ID of the object identifying it in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene to remove the object from. |
Returns | The deallocated object ID previously idnetifying the removed object or esp:: |
std:: vector<int> esp:: gfx:: Simulator:: getExistingObjectIDs(const int sceneID = 0)
Get the IDs of the physics objects instanced in a physical scene. See esp::
Parameters | |
---|---|
sceneID | !! Not used currently !! Specifies which physical scene to query. |
Returns | A vector of ID keys into esp:: |
esp:: physics:: MotionType esp:: gfx:: Simulator:: getObjectMotionType(const int objectID,
const int sceneID = 0)
Get the esp::
Parameters | |
---|---|
objectID | The ID of the object identifying it in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene to query. |
Returns | The esp:: |
bool esp:: gfx:: Simulator:: setObjectMotionType(const esp:: physics:: MotionType& motionType,
const int objectID,
const int sceneID = 0)
Set the esp::
Parameters | |
---|---|
motionType | The desired motion type of the object |
objectID | The ID of the object identifying it in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene to query. |
Returns | whether or not the set was successful. |
void esp:: gfx:: Simulator:: applyTorque(const Magnum:: Vector3& tau,
const int objectID,
const int sceneID = 0)
Apply torque to an object. See esp::
Parameters | |
---|---|
tau | The desired torque to apply. |
objectID | The ID of the object identifying it in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene of the object. |
void esp:: gfx:: Simulator:: applyForce(const Magnum:: Vector3& force,
const Magnum:: Vector3& relPos,
const int objectID,
const int sceneID = 0)
Apply force to an object. See esp::
Parameters | |
---|---|
force | The desired linear force to apply. |
relPos | The desired location relative to the object origin at which to apply the force. |
objectID | The ID of the object identifying it in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene of the object. |
Magnum:: Matrix4 esp:: gfx:: Simulator:: getTransformation(const int objectID,
const int sceneID = 0)
Get the current 4x4 transformation matrix of an object. See esp::
Parameters | |
---|---|
objectID | The object ID and key identifying the object in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene of the object. |
Returns | The 4x4 transform of the object. |
void esp:: gfx:: Simulator:: setTransformation(const Magnum:: Matrix4& transform,
const int objectID,
const int sceneID = 0)
Set the 4x4 transformation matrix of an object kinematically. See esp::
Parameters | |
---|---|
transform | The desired 4x4 transform of the object. |
objectID | The object ID and key identifying the object in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene of the object. |
void esp:: gfx:: Simulator:: setTranslation(const Magnum:: Vector3& translation,
const int objectID,
const int sceneID = 0)
Set the 3D position of an object kinematically. See esp::
Parameters | |
---|---|
translation | The desired 3D position of the object. |
objectID | The object ID and key identifying the object in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene of the object. |
Magnum:: Vector3 esp:: gfx:: Simulator:: getTranslation(const int objectID,
const int sceneID = 0)
Get the current 3D position of an object. See esp::
Parameters | |
---|---|
objectID | The object ID and key identifying the object in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene of the object. |
Returns | The 3D position of the object. |
void esp:: gfx:: Simulator:: setRotation(const Magnum:: Quaternion& rotation,
const int objectID,
const int sceneID = 0)
Set the orientation of an object kinematically. See esp::
Parameters | |
---|---|
rotation | The desired orientation of the object. |
objectID | The object ID and key identifying the object in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene of the object. |
Magnum:: Quaternion esp:: gfx:: Simulator:: getRotation(const int objectID,
const int sceneID = 0)
Get the current orientation of an object. See esp::
Parameters | |
---|---|
objectID | The object ID and key identifying the object in esp:: |
sceneID | !! Not used currently !! Specifies which physical scene of the object. |
Returns | A quaternion representation of the object's orientation. |
double esp:: gfx:: Simulator:: stepWorld(const double dt = 1.0/60.0)
the physical world has a notion of time which passes during animation/simulation/action/etc... Step the physical world forward in time by a desired duration. Note that the actual duration of time passed by this step will depend on simulation time stepping mode (todo). See esp::
Parameters | |
---|---|
dt | The desired amount of time to advance the physical world. |
Returns | The new world time after stepping. See esp:: |
double esp:: gfx:: Simulator:: getWorldTime()
Get the current time in the simulated world. This is always 0 if no esp::
Returns | The amount of time, esp:: |
---|
bool esp:: gfx:: Simulator:: recomputeNavMesh(nav:: PathFinder& pathfinder,
const nav:: NavMeshSettings& navMeshSettings)
Compute the navmesh for the simulator's current active scene and assign it to the referenced nav::
Parameters | |
---|---|
pathfinder | The pathfinder object to which the recomputed navmesh will be assigned. |
navMeshSettings | The nav:: |
Returns | Whether or not the navmesh recomputation succeeded. |