From 0802ee19573e880e319a61ae814ee42c01e28cd3 Mon Sep 17 00:00:00 2001 From: hachem Date: Thu, 20 Aug 2026 02:05:45 +0200 Subject: refactor: trailing return types in engine and states --- src/engine/engine.h | 100 ++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'src/engine/engine.h') diff --git a/src/engine/engine.h b/src/engine/engine.h index 1c25466..0451d40 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -65,30 +65,30 @@ namespace Donut Engine(); ~Engine() = default; - void draw_full_screen_quad(); - void draw_blur_pass(); - void dispatch_compute(const Camera& cam); - void upload_camera_ubo(const Camera& cam); - void upload_objects_ubo(const std::vector& objs); - void upload_disk_ubo(); - void upload_simulation_ubo(); - void render_scene(); - void update_physics(float delta_time); - void update_window_dimensions(); - void set_window_dimensions(int width, int height); - - int get_width() const { return m_width; } - int get_height() const { return m_height; } - - std::vector& get_objects() { return m_objects; } - BlackHole& get_sag_a() { return m_sag_a; } - Camera& get_camera() { return m_camera; } - bool& get_gravity() { return m_gravity; } - - void update_performance(float delta_time); - void set_target_fps(int fps) { m_target_fps = fps; } - int get_target_fps() const { return m_target_fps; } - float get_current_fps() const { return m_current_fps; } + auto draw_full_screen_quad() -> void; + auto draw_blur_pass() -> void; + auto dispatch_compute(const Camera& cam) -> void; + auto upload_camera_ubo(const Camera& cam) -> void; + auto upload_objects_ubo(const std::vector& objs) -> void; + auto upload_disk_ubo() -> void; + auto upload_simulation_ubo() -> void; + auto render_scene() -> void; + auto update_physics(float delta_time) -> void; + auto update_window_dimensions() -> void; + auto set_window_dimensions(int width, int height) -> void; + + auto get_width() const -> int { return m_width; } + auto get_height() const -> int { return m_height; } + + auto get_objects() -> std::vector& { return m_objects; } + auto get_sag_a() -> BlackHole& { return m_sag_a; } + auto get_camera() -> Camera& { return m_camera; } + auto get_gravity() -> bool& { return m_gravity; } + + auto update_performance(float delta_time) -> void; + auto set_target_fps(int fps) -> void { m_target_fps = fps; } + auto get_target_fps() const -> int { return m_target_fps; } + auto get_current_fps() const -> float { return m_current_fps; } void set_compute_height(int height) { #ifdef __APPLE__ @@ -96,43 +96,43 @@ namespace Donut #endif m_compute_height = height; } - int get_compute_height() const { return m_compute_height; } - int get_compute_width() const { return (m_width * m_compute_height) / m_height; } - void update_compute_dimensions(); + auto get_compute_height() const -> int { return m_compute_height; } + auto get_compute_width() const -> int { return (m_width * m_compute_height) / m_height; } + auto update_compute_dimensions() -> void; - int get_max_steps_moving() const { return m_max_steps_moving; } - int get_max_steps_static() const { return m_max_steps_static; } - float get_early_exit_distance() const { return m_early_exit_distance; } - void set_max_steps_moving(int steps) { m_max_steps_moving = steps; } - void set_max_steps_static(int steps) { m_max_steps_static = steps; } - void set_early_exit_distance(float distance) { m_early_exit_distance = distance; } + auto get_max_steps_moving() const -> int { return m_max_steps_moving; } + auto get_max_steps_static() const -> int { return m_max_steps_static; } + auto get_early_exit_distance() const -> float { return m_early_exit_distance; } + auto set_max_steps_moving(int steps) -> void { m_max_steps_moving = steps; } + auto set_max_steps_static(int steps) -> void { m_max_steps_static = steps; } + auto set_early_exit_distance(float distance) -> void { m_early_exit_distance = distance; } - float get_disk_thickness() const { return m_disk_thickness; } - void set_disk_thickness(float thickness) { m_disk_thickness = thickness; } + auto get_disk_thickness() const -> float { return m_disk_thickness; } + auto set_disk_thickness(float thickness) -> void { m_disk_thickness = thickness; } - float get_disk_density() const { return m_disk_density; } - void set_disk_density(float density) { m_disk_density = density; } + auto get_disk_density() const -> float { return m_disk_density; } + auto set_disk_density(float density) -> void { m_disk_density = density; } - float get_rotation_speed() const { return m_rotation_speed; } - void set_rotation_speed(float speed) { m_rotation_speed = speed; } + auto get_rotation_speed() const -> float { return m_rotation_speed; } + auto set_rotation_speed(float speed) -> void { m_rotation_speed = speed; } - float get_blur_strength() const { return m_blur_strength; } - void set_blur_strength(float strength) { m_blur_strength = strength; } + auto get_blur_strength() const -> float { return m_blur_strength; } + auto set_blur_strength(float strength) -> void { m_blur_strength = strength; } - float get_glow_intensity() const { return m_glow_intensity; } - void set_glow_intensity(float intensity) { m_glow_intensity = intensity; } + auto get_glow_intensity() const -> float { return m_glow_intensity; } + auto set_glow_intensity(float intensity) -> void { m_glow_intensity = intensity; } - void load_objects_from_scene(const std::vector& objects); - void export_high_res_frame(const std::string& filename, int width = 4096, int height = 3072); - void print_object_info() const; + auto load_objects_from_scene(const std::vector& objects) -> void; + auto export_high_res_frame(const std::string& filename, int width = 4096, int height = 3072) -> void; + auto print_object_info() const -> void; - void set_hdri_environment(Ref hdri) { m_hdri_environment = hdri; } - Ref get_hdri_environment() const { return m_hdri_environment; } + auto set_hdri_environment(Ref hdri) -> void { m_hdri_environment = hdri; } + auto get_hdri_environment() const -> Ref { return m_hdri_environment; } private: - Ref create_compute_program(const char* path); + auto create_compute_program(const char* path) -> Ref; std::pair, Ref> quad_vao(); - void draw_geodesic_pass(int cw, int ch); + auto draw_geodesic_pass(int cw, int ch) -> void; private: Ref m_quad_vao; Ref m_texture; -- cgit v1.3