diff options
| author | hachem <im@hachem.wtf> | 2025-08-14 00:02:01 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-14 00:02:01 +0200 |
| commit | 1b251bd174527951eec220ecbcb7eca89328e5b8 (patch) | |
| tree | c47632a340b4cbdd97812f8c92798fc36146558c /src/states/simulation_state.h | |
| parent | 1ac0f136629ce4046a5f6529cf3d1e51e96df408 (diff) | |
feat: state manager
Diffstat (limited to 'src/states/simulation_state.h')
| -rw-r--r-- | src/states/simulation_state.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/states/simulation_state.h b/src/states/simulation_state.h new file mode 100644 index 0000000..a0d9e73 --- /dev/null +++ b/src/states/simulation_state.h @@ -0,0 +1,56 @@ +#pragma once + +#include "core/state.h" +#include "core/event.h" +#include "core/camera.h" +#include "core/log.h" + +#include "rendering/vertex_array.h" +#include "rendering/vertex_buffer.h" +#include "rendering/index_buffer.h" +#include "rendering/shader.h" +#include "rendering/texture.h" + +namespace Donut +{ + class SimulationState + : public State + { + public: + ~SimulationState() = default; + + void on_enter() override; + void on_exit() override; + void on_update(float delta_time) override; + void on_render() override; + void on_event(Event& event) override; + private: + void handle_key_input(float delta_time); + void update_texture(); + private: + std::unique_ptr<Camera> m_camera; + + std::shared_ptr<VertexArray> m_vertex_array; + std::shared_ptr<VertexBuffer> m_vertex_buffer; + std::shared_ptr<IndexBuffer> m_index_buffer; + std::shared_ptr<Shader> m_shader; + std::shared_ptr<Texture2D> m_texture; + + std::shared_ptr<Shader> m_compute_shader; + std::shared_ptr<Texture2D> m_processed_texture; + + float m_compute_brightness = 0.0f; + float m_compute_contrast = 1.0f; + float m_compute_saturation = 1.0f; + bool m_use_compute_shader = true; + + bool m_keys[1024] = { false }; + bool m_first_mouse = true; + float m_last_x = 0.0f; + float m_last_y = 0.0f; + float m_delta_time = 0.0f; + float m_last_frame = 0.0f; + bool m_mouse_dragging = false; + float m_texture_time = 0.0f; + }; +}; |
