lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
Loading...
Searching...
No Matches
scene.hpp
Go to the documentation of this file.
1
12
13#pragma once
14
15#include "lmgl/scene/light.hpp"
16#include "lmgl/scene/node.hpp"
17#include "lmgl/scene/skybox.hpp"
18
19#include <memory>
20#include <string>
21
22namespace lmgl {
23
30namespace scene {
31
39class Scene {
40 public:
48 Scene(const std::string &name = "Scene");
49
57 inline std::shared_ptr<Node> get_root() const { return m_root; }
58
65 void update();
66
74 inline const std::string &get_name() const { return m_name; }
75
83 inline void set_name(const std::string &name) { m_name = name; }
84
90 inline std::vector<std::shared_ptr<Light>> get_lights() const { return m_lights; }
91
97 void add_light(std::shared_ptr<Light> light);
98
104 void remove_light(std::shared_ptr<Light> light);
105
109 void clear_lights();
110
116 inline void set_skybox(std::shared_ptr<Skybox> skybox) { m_skybox = skybox; }
117
123 inline std::shared_ptr<Skybox> get_skybox() const { return m_skybox; }
124
125 private:
127 std::string m_name;
128
130 std::shared_ptr<Node> m_root;
131
133 std::vector<std::shared_ptr<Light>> m_lights;
134
136 std::shared_ptr<Skybox> m_skybox;
137};
138
139} // namespace scene
140
141} // namespace lmgl
void add_light(std::shared_ptr< Light > light)
Adds a light in the scene.
Definition scene.cpp:12
void set_name(const std::string &name)
Set the name of the scene.
Definition scene.hpp:83
void update()
Update the scene.
Definition scene.cpp:10
const std::string & get_name() const
Getters and setters for the scene's name.
Definition scene.hpp:74
std::shared_ptr< Node > get_root() const
Getter for the root node.
Definition scene.hpp:57
std::shared_ptr< Skybox > get_skybox() const
Get the skybox of the scene.
Definition scene.hpp:123
void remove_light(std::shared_ptr< Light > light)
Removes a light from the scene.
Definition scene.cpp:17
std::vector< std::shared_ptr< Light > > get_lights() const
Returns all the lights in the scene.
Definition scene.hpp:90
Scene(const std::string &name="Scene")
Constructor for the Scene class.
Definition scene.cpp:8
void clear_lights()
Removes all lights from the scene.
Definition scene.cpp:24
void set_skybox(std::shared_ptr< Skybox > skybox)
Set the skybox for the scene.
Definition scene.hpp:116
Definition of the Light class and LightType enumeration.
Namespace for scene-related classes and functions.
Definition camera.cpp:7
Forward declarations for Assimp Material structure.
Definition model_loader.cpp:12
Defines the Node class for managing scene graph nodes in a 3D environment.
Skybox rendering system with cubemap support.