9#ifndef AVARA3D_VISUAL_VISUALWORLD_H
10#define AVARA3D_VISUAL_VISUALWORLD_H
18#include "a3d/scene/Scene.h"
19#include "a3d/scene/HitTestResult.h"
20#include "a3d/visual/Atmosphere.h"
21#include "a3d/visual/Background.h"
22#include "a3d/visual/Fog.h"
23#include "a3d/visual/Ground.h"
24#include "a3d/visual/Surface.h"
25#include "a3d/visual/material/Material.h"
32 class FrameStatsHistory;
94 HitTestSearchMode
searchMode {HitTestSearchMode::Closest};
140 const std::optional<Fog>&
fog()
const;
164 const std::optional<Ground>&
ground()
const;
177 const std::optional<a3d::Surface>&
surface()
const;
270 const FrameStatsHistory& statsHistory);
272 std::shared_ptr<Material> backgroundMaterial();
278 std::shared_ptr<Node> defaultPOV();
282 std::optional<Background> _background;
283 std::shared_ptr<Material> _backgroundMaterial;
284 std::optional<Fog> _fog;
285 std::optional<Atmosphere> _atmosphere;
286 std::optional<Ground> _ground;
287 std::optional<a3d::Surface> _surface;
288 bool _defaultLightingEnabled;
289 std::weak_ptr<Node> _pointOfView;
Simulates rigid bodies and performs physics collision queries for a Scene.
Abstract rendering destination used by VisualWorld.
Owns a scene graph and the worlds used to simulate and render it.
DebugOptions
Scene-wide debug visualization options.
Manages the visual presentation, camera, and visual queries for a Scene.
VisualWorld(RenderContext &context)
Creates a VisualWorld that renders through context.
void pointOfView(const std::weak_ptr< Node > &cameraNode)
Sets the camera Node used as the point of view.
std::vector< HitTestResult > hitTest(const math::vec2 &point, const HitTestOptions &options) const
Hit-tests visible Scene mesh geometry beneath a logical viewport point.
void didBeginFrameCallback(DidBeginFrameCallback function)
Sets the begin-frame callback; an empty callback disables it.
void surface(const std::optional< a3d::Surface > &surface)
Sets or removes the reference Surface used by ground and atmospheric effects.
math::vec3 unprojectPoint(const math::vec3 &point) const
Unprojects a logical viewport point into world coordinates.
std::vector< HitTestResult > hitTest(const math::vec2 &point) const
Hit-tests the closest visible Scene mesh geometry beneath a logical viewport point.
const std::optional< Fog > & fog() const
Returns the optional distance fog configuration.
Scene * scene() const
Returns the Scene this VisualWorld is attached to, or nullptr if unattached.
math::vec3 projectPoint(const math::vec3 &point) const
Projects a world-space point into logical viewport coordinates.
void ground(const std::optional< Ground > &ground)
Sets or disables visual ground rendering.
std::function< void(VisualWorld &visualWorld, const RenderInfo &info)> DidBeginFrameCallback
Callback invoked after renderer frame setup and before Scene rendering begins.
const std::optional< Atmosphere > & atmosphere() const
Returns the optional atmosphere configuration.
void fog(const std::optional< Fog > &fog)
Sets or disables distance fog.
const std::optional< Background > & background() const
Returns the optional Scene background.
const std::optional< Ground > & ground() const
Returns the optional visual ground configuration.
DidBeginFrameCallback didBeginFrameCallback() const
Returns the callback invoked immediately before Scene rendering begins.
void defaultLightingEnabled(bool enabled)
Enables or disables renderer-provided default lighting.
void atmosphere(const std::optional< Atmosphere > &atmosphere)
Sets or disables atmospheric effects.
void background(const std::optional< Background > &background)
Sets or disables the Scene background.
std::weak_ptr< Node > & pointOfView()
Returns the weak reference to the camera Node used as the point of view.
const std::optional< a3d::Surface > & surface() const
Returns the optional reference Surface used by ground and atmospheric effects.
bool defaultLightingEnabled() const
Returns whether renderer-provided default lighting is enabled.
Capabilities capabilities() const
Returns the rendering capabilities currently available to the VisualWorld.
RenderContext * renderContext() const
Returns the non-owning RenderContext associated with this VisualWorld.
Rendering capabilities available through this VisualWorld.
bool wireframeRendering
Whether wireframe rendering is supported.
Options controlling visual hit testing.
bool elementBoundsOnly
Test MeshElement bounds instead of individual triangles.
HitTestSearchMode searchMode
Which matching hits to return.
Timing and progression information associated with a rendered frame.
double updateTime
Runner elapsed time for the containing update, in seconds.
double simulationTime
Time reached by the most recently completed simulation step, in seconds.
std::uint64_t frameIndex
Zero-based index of the successful rendered frame.
std::uint64_t updateIndex
Runner update responsible for this render attempt.
std::uint64_t simulationStepCount
Total number of completed simulation steps.
double updateDeltaTime
Delta time of the containing Runner update, in seconds.