diff options
| author | hachem <im@hachem.wtf> | 2026-08-20 02:27:02 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-20 02:40:07 +0200 |
| commit | 5b361d81dbd2af0d0e99b9eb1adebea76ff05db0 (patch) | |
| tree | 34db1df17e8c7248aeeb92156d635d31c2484e3f /src/core/hdri_manager.h | |
| parent | e3abaaf59777258ba06705135a0cafcb5918ad12 (diff) | |
[chore]: MASSIVE refactor + more vulkan bs
Diffstat (limited to 'src/core/hdri_manager.h')
| -rw-r--r-- | src/core/hdri_manager.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/core/hdri_manager.h b/src/core/hdri_manager.h new file mode 100644 index 0000000..fa05330 --- /dev/null +++ b/src/core/hdri_manager.h @@ -0,0 +1,48 @@ +#pragma once + +#include "core/log.h" +#include "rendering/texture.h" + +#include <string> +#include <unordered_map> +#include <memory> + +namespace Donut +{ + class HDRIManager + { + public: + static auto get() -> HDRIManager& + { + static HDRIManager instance; + return instance; + } + + auto load_hdri(const std::string& path) -> Ref<CubemapTexture>; + auto get_current_hdri() const -> Ref<CubemapTexture> { return m_current_hdri; } + + auto set_current_hdri(const std::string& path) -> void; + auto get_available_hdri() const -> const std::vector<std::string>& { return m_available_hdri; } + auto get_hdri_name(const std::string& path) const -> std::string; + auto clear_cache() -> void; + + private: + HDRIManager() = default; + ~HDRIManager() = default; + + HDRIManager(const HDRIManager&) = delete; + HDRIManager& operator=(const HDRIManager&) = delete; + + std::unordered_map<std::string, Ref<CubemapTexture>> m_hdri_cache; + + Ref<CubemapTexture> m_current_hdri; + + std::vector<std::string> m_available_hdri = + { + "assets/hdri/HDR_blue_nebulae-1.hdr", + "assets/hdri/HDR_subdued_blue_nebulae.hdr", + "assets/hdri/HDR_subdued_multi_nebulae.hdr", + "assets/hdri/night_sky.hdr" + }; + }; +}; |
