Scene
Scene is the top-level container for all nodes that participate in rendering and updates. It owns the scene graph hierarchy and optional global fog settings. Construct a scene directly with Scene::Create or by subclassing, attach nodes to it, and call Advance once per frame to drive its updates.
auto scene = vglx::Scene::Create();
scene->fog = vglx::Fog::CreateExponential({.color = 0x444444u, .density = 0.3f});
scene->Add(vglx::Mesh::Create(
vglx::BoxGeometry::Create(),
vglx::PhongMaterial::Create({.color = 0x049EF4u})
));
// Inside the main loop:
scene->Advance(delta);
renderer.Render(scene.get(), camera.get());INFO
Derives from Node and inherits all public properties and methods.
Construction
Constructors
Scene()
Constructs a scene object.
Scene::Scene();Factories preferred
Creates an instance of Scene.
static std::unique_ptr<Scene> Scene::Create();Properties
Optional for defining a flat texture background.
std::shared_ptr<Texture> background {nullptr};Optional environment map used as the image-based lighting source.
std::shared_ptr<Texture> environment {nullptr};environment_intensity float
Scalar multiplier applied to the environment lighting contribution.
float environment_intensity {1.0f};Optional global fog settings applied during rendering.
std::optional<Fog> fog {};Functions
Advance() void
Advances the scene by one frame.
Propagates per-frame updates through the scene graph, calling OnUpdate on the scene and all attached nodes in depth-first order. Call this once per frame from your main loop.
void Scene::Advance(float delta);| Parameter | Description |
|---|---|
| delta | Elapsed time in seconds since the last frame. |
GetNodeType() Node::Type virtual
Identifies this node as Node::Type::Scene.
Type vglx::Scene::GetNodeType() const override;