lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
Loading...
Searching...
No Matches
lmgl::scene::Scene Class Reference

Represents a 3D scene graph with a root node. More...

#include <scene.hpp>

Public Member Functions

 Scene (const std::string &name="Scene")
 Constructor for the Scene class.
 
std::shared_ptr< Nodeget_root () const
 Getter for the root node.
 
void update ()
 Update the scene.
 
const std::string & get_name () const
 Getters and setters for the scene's name.
 
void set_name (const std::string &name)
 Set the name of the scene.
 
std::vector< std::shared_ptr< Light > > get_lights () const
 Returns all the lights in the scene.
 
void add_light (std::shared_ptr< Light > light)
 Adds a light in the scene.
 
void remove_light (std::shared_ptr< Light > light)
 Removes a light from the scene.
 
void clear_lights ()
 Removes all lights from the scene.
 
void set_skybox (std::shared_ptr< Skybox > skybox)
 Set the skybox for the scene.
 
std::shared_ptr< Skyboxget_skybox () const
 Get the skybox of the scene.
 

Detailed Description

Represents a 3D scene graph with a root node.

The Scene class encapsulates a 3D scene graph, providing a root node from which all other nodes in the scene can be accessed. It also provides methods to update the scene.

Constructor & Destructor Documentation

◆ Scene()

lmgl::scene::Scene::Scene ( const std::string & name = "Scene")

Constructor for the Scene class.

Initializes a Scene with a root node.

Parameters
nameOptional name for the scene.

Member Function Documentation

◆ add_light()

void lmgl::scene::Scene::add_light ( std::shared_ptr< Light > light)

Adds a light in the scene.

Parameters
lightthe light to add.

◆ get_lights()

std::vector< std::shared_ptr< Light > > lmgl::scene::Scene::get_lights ( ) const
inline

Returns all the lights in the scene.

Returns
Vector containing all the lights introduced into the scene.

◆ get_name()

const std::string & lmgl::scene::Scene::get_name ( ) const
inline

Getters and setters for the scene's name.

Provides access to the scene's name property.

Returns
Name of the scene.

◆ get_root()

std::shared_ptr< Node > lmgl::scene::Scene::get_root ( ) const
inline

Getter for the root node.

Provides access to the root node of the scene graph.

Returns
Shared pointer to the root Node object.

◆ get_skybox()

std::shared_ptr< Skybox > lmgl::scene::Scene::get_skybox ( ) const
inline

Get the skybox of the scene.

Returns
The skybox (or nullptr if none).

◆ remove_light()

void lmgl::scene::Scene::remove_light ( std::shared_ptr< Light > light)

Removes a light from the scene.

Parameters
lightthe light to remove.

◆ set_name()

void lmgl::scene::Scene::set_name ( const std::string & name)
inline

Set the name of the scene.

Updates the scene's name property.

Parameters
nameNew name for the scene.

◆ set_skybox()

void lmgl::scene::Scene::set_skybox ( std::shared_ptr< Skybox > skybox)
inline

Set the skybox for the scene.

Parameters
skyboxThe skybox to set (or nullptr to remove).

◆ update()

void lmgl::scene::Scene::update ( )

Update the scene.

This method updates the scene, typically by updating the root node and propagating changes through the scene graph.


The documentation for this class was generated from the following files: