51enum class RenderLayer { Skybox = 0, Opaque = 100, Transparent = 200, UI = 300 };
87 void render(std::shared_ptr<scene::Scene>
scene, std::shared_ptr<scene::Camera> camera);
166 void resize(
int width,
int height);
229 unsigned int m_draw_calls;
232 unsigned int m_triangles_count;
235 bool m_depth_test_enabled;
238 bool m_culling_enabled;
241 bool m_blending_enabled;
244 std::vector<std::shared_ptr<scene::Light>> m_directional_lights;
247 std::vector<std::shared_ptr<scene::Light>> m_point_lights;
250 std::vector<std::shared_ptr<scene::Light>> m_spot_lights;
253 std::shared_ptr<scene::Material> m_default_material;
256 std::shared_ptr<scene::Material> m_last_bound_material;
259 std::unique_ptr<Framebuffer> m_framebuffer;
262 std::unique_ptr<Framebuffer> m_bright_framebuffer;
265 std::unique_ptr<Framebuffer> m_blur_framebuffer[2];
268 std::shared_ptr<Shader> m_postprocess_shader;
271 std::shared_ptr<Shader> m_bright_pass_shader;
274 std::shared_ptr<Shader> m_blur_shader;
277 std::shared_ptr<scene::Mesh> m_screen_quad;
280 int m_tone_map_mode = 2;
283 float m_exposure = 1.0f;
286 float m_gamma = 2.2f;
289 int m_window_width = 1280;
290 int m_window_height = 720;
293 bool m_bloom_enabled =
true;
296 float m_bloom_threshold = 1.0f;
299 float m_bloom_intensity = 0.5f;
310 std::shared_ptr<scene::Mesh> mesh;
316 float distance_to_camera;
326 std::vector<RenderItem> m_render_queue;
341 void build_render_queue(std::shared_ptr<scene::Node> node, std::shared_ptr<scene::Camera> camera,
342 const glm::mat4 &par_transform, std::vector<RenderItem> &out_items);
358 void build_render_queue_culled(std::shared_ptr<scene::Node> node, std::shared_ptr<scene::Camera> camera,
359 const glm::mat4 &par_transform, std::vector<RenderItem> &out_items,
369 void sort_render_queue(std::vector<RenderItem> &items);
382 void render_mesh(std::shared_ptr<scene::Mesh> mesh,
const glm::mat4 &transform,
383 std::shared_ptr<scene::Camera> camera);
391 void apply_render_mode();
398 void collect_lights(std::shared_ptr<scene::Scene>
scene);
405 void collect_node_lights(std::shared_ptr<scene::Node> node);
412 void bind_lights(std::shared_ptr<renderer::Shader> shader);
423 void bind_material(std::shared_ptr<scene::Material> material, std::shared_ptr<renderer::Shader> shader);
431 void clear_material_cache();
Declaration of the Camera class for managing viewport and projection.
void resize(int width, int height)
Resizes the framebuffer to specific width and height.
Definition renderer.cpp:370
void set_gamma(float gamma)
Sets the gamma of the tone map.
Definition renderer.hpp:192
unsigned int get_draw_calls() const
Get the number of draw calls made in the last render.
Definition renderer.hpp:148
RenderMode get_render_mode() const
Get the current rendering mode.
Definition renderer.hpp:138
void set_blending(bool enabled)
Enable or disable blending.
Definition renderer.cpp:166
void set_bloom_threshold(float threshold)
Sets the bloom brightness threshold.
Definition renderer.hpp:215
void set_tone_map_mode(int mode)
Sets the tone map mode.
Definition renderer.hpp:178
void set_bloom_intensity(float intensity)
Sets the bloom intensity/strength.
Definition renderer.hpp:222
~Renderer()=default
Destructor for the Renderer class.
void set_depth_test(bool enabled)
Enable or disable depth testing.
Definition renderer.cpp:147
void render(std::shared_ptr< scene::Scene > scene, std::shared_ptr< scene::Camera > camera)
Render a scene from the perspective of a camera.
Definition renderer.cpp:39
unsigned int get_triangles_count() const
Get the number of triangles rendered in the last render.
Definition renderer.hpp:158
Renderer()
Constructor for the Renderer class.
Definition renderer.cpp:17
void enable_post_processing(bool enabled)
Enables post processing effects based on tone map mode and exposure/gamma.
void set_render_mode(RenderMode mode)
Set the rendering mode.
Definition renderer.cpp:145
void set_exposure(float exposure)
Sets the exposure of the tone map.
Definition renderer.hpp:185
void set_culling(bool enabled)
Enable or disable face culling.
Definition renderer.cpp:156
void set_bloom_enabled(bool enabled)
Enable or disable bloom effect.
Definition renderer.hpp:206
Frustum structure.
Definition frustum.hpp:218
Framebuffer class for off-screen rendering.
Defines the Mesh class for managing 3D mesh data.
Namespace for rendering-related classes and functions.
Definition buffer.cpp:9
RenderMode
Enumerates the different rendering modes.
Definition renderer.hpp:42
RenderLayer
Enumerates the different render layers.
Definition renderer.hpp:51
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.
Defines the Scene class for managing a 3D scene graph.