Graphics: Move LightData to a shader module and add hotreload in debug
This commit is contained in:
@@ -18,7 +18,26 @@ namespace Nz
|
||||
|
||||
std::vector<std::shared_ptr<UberShader>> DepthMaterial::BuildShaders()
|
||||
{
|
||||
ShaderAst::ModulePtr shaderModule = ShaderLang::Parse(std::string_view(reinterpret_cast<const char*>(r_shader), sizeof(r_shader)));
|
||||
ShaderAst::ModulePtr shaderModule;
|
||||
|
||||
#ifdef NAZARA_DEBUG
|
||||
std::filesystem::path shaderPath = "../../src/Nazara/Graphics/Resources/Shaders/depth_material.nzsl";
|
||||
if (std::filesystem::exists(shaderPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
shaderModule = ShaderLang::ParseFromFile(shaderPath);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError(std::string("failed to load shader from engine folder: ") + e.what());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!shaderModule)
|
||||
shaderModule = ShaderLang::Parse(std::string_view(reinterpret_cast<const char*>(r_shader), sizeof(r_shader)));
|
||||
|
||||
auto shader = std::make_shared<UberShader>(ShaderStageType::Fragment | ShaderStageType::Vertex, std::move(shaderModule));
|
||||
|
||||
return { std::move(shader) };
|
||||
|
||||
Reference in New Issue
Block a user