From 2c8002d30f291cba832a5750212009d48238c308 Mon Sep 17 00:00:00 2001 From: hachem Date: Fri, 22 Aug 2025 12:24:05 +0200 Subject: feat: add HDRI --- src/core/hdri_manager.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/core/hdri_manager.h (limited to 'src/core/hdri_manager.h') diff --git a/src/core/hdri_manager.h b/src/core/hdri_manager.h new file mode 100644 index 0000000..5ccd402 --- /dev/null +++ b/src/core/hdri_manager.h @@ -0,0 +1,46 @@ +#pragma once + +#include "core/log.h" +#include "rendering/texture.h" + +#include +#include +#include + +namespace Donut +{ + class HDRIManager + { + public: + static HDRIManager& get() + { + static HDRIManager instance; + return instance; + } + + Ref load_hdri(const std::string& path); + Ref get_current_hdri() const { return m_current_hdri; } + + void set_current_hdri(const std::string& path); + const std::vector& get_available_hdri() const { return m_available_hdri; } + std::string get_hdri_name(const std::string& path) const; + void clear_cache(); + private: + HDRIManager() = default; + ~HDRIManager() = default; + + HDRIManager(const HDRIManager&) = delete; + HDRIManager& operator=(const HDRIManager&) = delete; + + std::unordered_map> m_hdri_cache; + + Ref m_current_hdri; + + std::vector m_available_hdri = + { + "assets/hdri/hdr_blue_nebulae_1.hdr", + "assets/hdri/hdr_subdued_blue_nebulae.hdr", + "assets/hdri/hdr_subdued_multi_nebulae.hdr" + }; + }; +}; -- cgit v1.3