diff --git a/rawrbox.render/include/rawrbox/render/renderer.hpp b/rawrbox.render/include/rawrbox/render/renderer.hpp index 4c9f544f..68488250 100644 --- a/rawrbox.render/include/rawrbox/render/renderer.hpp +++ b/rawrbox.render/include/rawrbox/render/renderer.hpp @@ -191,7 +191,7 @@ namespace rawrbox { [[nodiscard]] virtual Diligent::ITextureView* getDepth() const; [[nodiscard]] virtual Diligent::ITextureView* getColor(bool rt = false) const; - [[nodiscard]] virtual std::string getShadersDirectory() const; + [[nodiscard]] virtual std::filesystem::path getShadersDirectory() const; [[nodiscard]] virtual const Diligent::RENDER_DEVICE_TYPE& getRenderType() const; #ifdef _DEBUG diff --git a/rawrbox.render/src/renderer.cpp b/rawrbox.render/src/renderer.cpp index 1aef15a0..145aa3c2 100644 --- a/rawrbox.render/src/renderer.cpp +++ b/rawrbox.render/src/renderer.cpp @@ -200,10 +200,12 @@ namespace rawrbox { // Setup shader pipeline if not exists if (rawrbox::SHADER_FACTORY == nullptr) { auto rootDir = this->getShadersDirectory(); + if (!std::filesystem::exists(rootDir)) throw this->_logger->error("Shaders directory '{}' not found!", rootDir.generic_string()); + auto dirs = rawrbox::PathUtils::glob(rootDir, true); auto paths = fmt::format("{}", fmt::join(dirs, ";")); - this->_logger->info("Initializing shader factory (using {}):", fmt::styled(rootDir, fmt::fg(fmt::color::coral))); + this->_logger->info("Initializing shader factory (using {}):", fmt::styled(rootDir.generic_string(), fmt::fg(fmt::color::coral))); for (const auto& dir : dirs) { this->_logger->info("\t{}", dir); } @@ -691,7 +693,7 @@ namespace rawrbox { return rt ? this->_render->getRT() : this->_render->getHandle(); } - std::string RendererBase::getShadersDirectory() const { + std::filesystem::path RendererBase::getShadersDirectory() const { return "./assets/shaders"; }