|
Avara3D 0.2.0
C++ API reference
|
Owns a scene graph and the worlds used to simulate and render it. More...
#include <a3d/scene/Scene.h>
Classes | |
| struct | StepInfo |
| Timing information for one simulation step. More... | |
Public Types | |
| enum class | ImportOptions : uint16_t { None = 0 , ImportMeshes = 1 << 0 , ImportMaterials = 1 << 1 , ImportLights = 1 << 2 , ImportCameras = 1 << 3 , ImportAll = UINT16_MAX } |
| Selects which resource categories are imported by FromFile(). More... | |
| enum class | DebugOptions : uint32_t { None = 0 , ShowStatsOverlay = 1 << 0 , ShowMeshBounds = 1 << 1 , ShowMeshFrames = 1 << 2 , ShowMeshWireframes = 1 << 3 , ShowCameras = 1 << 4 , ShowLights = 1 << 5 , ShowLightExtents = 1 << 6 , ShowPhysicsBounds = 1 << 7 , ShowPhysicsFrames = 1 << 8 , ShowPhysicsWireframes = 1 << 9 , ShowPhysicsContactPoints = 1 << 10 , ShowPhysicsNormals = 1 << 11 , ShowPhysicsConstraints = 1 << 12 , ShowPhysicsConstraintLimits } |
| Scene-wide debug visualization options. More... | |
| using | WillStepCallback = std::function< void(Scene &scene, const StepInfo &info)> |
| Callback invoked immediately before a Scene simulation step. More... | |
| using | DidStepCallback = std::function< void(Scene &scene, const StepInfo &info)> |
| Callback invoked immediately after a Scene simulation step. More... | |
Public Member Functions | |
| Scene () | |
| Creates a Scene with an empty root node and no worlds or input context. More... | |
| Scene (const std::string &name) | |
| Creates a named Scene with an empty root node and no worlds or input context. More... | |
| Scene (std::unique_ptr< VisualWorld > visualWorld, std::unique_ptr< PhysicsWorld > physicsWorld, std::unique_ptr< InputContext > inputContext) | |
| Creates a Scene and takes ownership of its optional worlds and input context. More... | |
| Scene (const std::string &name, std::unique_ptr< VisualWorld > visualWorld, std::unique_ptr< PhysicsWorld > physicsWorld, std::unique_ptr< InputContext > inputContext) | |
| Creates a named Scene and takes ownership of its optional worlds and input context. More... | |
| const std::optional< std::string > & | name () const |
| Returns the optional Scene name. More... | |
| void | name (const std::string &name) |
| Sets the Scene name. More... | |
| const std::shared_ptr< Node > & | rootNode () const |
| Returns the root node of the Scene hierarchy. More... | |
| void | rootNode (const std::shared_ptr< Node > &node) |
| Replaces the root node of the Scene hierarchy. More... | |
| VisualWorld * | visualWorld () const |
| Returns the owned VisualWorld, or nullptr if none is installed. More... | |
| void | visualWorld (std::unique_ptr< VisualWorld > world) |
| Replaces the owned VisualWorld; nullptr removes the current world. More... | |
| PhysicsWorld * | physicsWorld () const |
| Returns the owned PhysicsWorld, or nullptr if none is installed. More... | |
| void | physicsWorld (std::unique_ptr< PhysicsWorld > world) |
| Replaces the owned PhysicsWorld; nullptr removes the current world. More... | |
| InputContext * | inputContext () const |
| Returns the owned InputContext, or nullptr if none is installed. More... | |
| void | inputContext (std::unique_ptr< InputContext > context) |
| Replaces the owned InputContext; nullptr removes the current context. More... | |
| AABB | aabb (bool vertfit=false) const |
| Returns the world-space axis-aligned bounding box enclosing the Scene hierarchy. More... | |
| math::vec3 | extent (bool vertfit=false) const |
| Returns the dimensions of the Scene world-space axis-aligned bounding box. More... | |
| DebugOptions | debugOptions () const |
| Returns the enabled Scene debug visualization options. More... | |
| void | debugOptions (DebugOptions options) |
| Sets the enabled Scene debug visualization options. More... | |
| WillStepCallback | willStepCallback () const |
| Returns the callback invoked before each simulation step. More... | |
| void | willStepCallback (WillStepCallback callback) |
| Replaces the callback invoked before each simulation step; an empty callback disables it. More... | |
| DidStepCallback | didStepCallback () const |
| Returns the callback invoked after each simulation step. More... | |
| void | didStepCallback (DidStepCallback callback) |
| Replaces the callback invoked after each simulation step; an empty callback disables it. More... | |
Static Public Member Functions | |
| static std::unique_ptr< Scene > | FromFile (const std::filesystem::path &path, ImportOptions options=ImportOptions::ImportAll) |
Imports a Scene from path. More... | |
Owns a scene graph and the worlds used to simulate and render it.
A Scene always has a root Node. VisualWorld, PhysicsWorld, and InputContext are optional and may be installed or replaced independently. Nodes attached beneath the root become part of the Scene hierarchy and can discover the Scene and its currently installed worlds.
| using a3d::Scene::DidStepCallback = std::function<void(Scene& scene, const StepInfo& info)> |
| using a3d::Scene::WillStepCallback = std::function<void(Scene& scene, const StepInfo& info)> |
|
strong |
Scene-wide debug visualization options.
|
strong |
Selects which resource categories are imported by FromFile().
| a3d::Scene::Scene | ( | ) |
Creates a Scene with an empty root node and no worlds or input context.
|
explicit |
Creates a named Scene with an empty root node and no worlds or input context.
| a3d::Scene::Scene | ( | std::unique_ptr< VisualWorld > | visualWorld, |
| std::unique_ptr< PhysicsWorld > | physicsWorld, | ||
| std::unique_ptr< InputContext > | inputContext | ||
| ) |
Creates a Scene and takes ownership of its optional worlds and input context.
Any argument may be nullptr.
| a3d::Scene::Scene | ( | const std::string & | name, |
| std::unique_ptr< VisualWorld > | visualWorld, | ||
| std::unique_ptr< PhysicsWorld > | physicsWorld, | ||
| std::unique_ptr< InputContext > | inputContext | ||
| ) |
Creates a named Scene and takes ownership of its optional worlds and input context.
Any world or input-context argument may be nullptr.
| AABB a3d::Scene::aabb | ( | bool | vertfit = false | ) | const |
Returns the world-space axis-aligned bounding box enclosing the Scene hierarchy.
| vertfit | when true, fits bounds to transformed mesh vertices; when false, uses transformed local mesh bounds for a faster, potentially looser result. |
| DebugOptions a3d::Scene::debugOptions | ( | ) | const |
Returns the enabled Scene debug visualization options.
| void a3d::Scene::debugOptions | ( | DebugOptions | options | ) |
Sets the enabled Scene debug visualization options.
| DidStepCallback a3d::Scene::didStepCallback | ( | ) | const |
Returns the callback invoked after each simulation step.
| void a3d::Scene::didStepCallback | ( | DidStepCallback | callback | ) |
Replaces the callback invoked after each simulation step; an empty callback disables it.
| math::vec3 a3d::Scene::extent | ( | bool | vertfit = false | ) | const |
Returns the dimensions of the Scene world-space axis-aligned bounding box.
| vertfit | when true, fits bounds to transformed mesh vertices; when false, uses transformed local mesh bounds for a faster, potentially looser result. |
|
static |
| InputContext * a3d::Scene::inputContext | ( | ) | const |
Returns the owned InputContext, or nullptr if none is installed.
| void a3d::Scene::inputContext | ( | std::unique_ptr< InputContext > | context | ) |
Replaces the owned InputContext; nullptr removes the current context.
| const std::optional< std::string > & a3d::Scene::name | ( | ) | const |
Returns the optional Scene name.
| void a3d::Scene::name | ( | const std::string & | name | ) |
Sets the Scene name.
| PhysicsWorld * a3d::Scene::physicsWorld | ( | ) | const |
Returns the owned PhysicsWorld, or nullptr if none is installed.
| void a3d::Scene::physicsWorld | ( | std::unique_ptr< PhysicsWorld > | world | ) |
Replaces the owned PhysicsWorld; nullptr removes the current world.
| const std::shared_ptr< Node > & a3d::Scene::rootNode | ( | ) | const |
Returns the root node of the Scene hierarchy.
| void a3d::Scene::rootNode | ( | const std::shared_ptr< Node > & | node | ) |
| VisualWorld * a3d::Scene::visualWorld | ( | ) | const |
Returns the owned VisualWorld, or nullptr if none is installed.
| void a3d::Scene::visualWorld | ( | std::unique_ptr< VisualWorld > | world | ) |
Replaces the owned VisualWorld; nullptr removes the current world.
| WillStepCallback a3d::Scene::willStepCallback | ( | ) | const |
Returns the callback invoked before each simulation step.
| void a3d::Scene::willStepCallback | ( | WillStepCallback | callback | ) |
Replaces the callback invoked before each simulation step; an empty callback disables it.