Commit abbd3514 authored by Felix Schröder's avatar Felix Schröder
Browse files

Fix light shadow type transformation

parent 82e3b576
......@@ -316,7 +316,7 @@ void Renderer::render(const glm::mat4& view, const glm::mat4& projection)
m_deferredPrograms[m_deferredPrograms.size() - 1].attachNew(GL_FRAGMENT_SHADER, src);
m_deferredPrograms[m_deferredPrograms.size() - 1].use();
m_activeDfIdUniform = glGetUniformLocation(
m_deferredPrograms[m_deferredPrograms.size() - 1].id(), "activeDfId");
m_deferredPrograms[m_deferredPrograms.size() - 1].id(), "activeDfId");
m_invalidRenderables = false;
}
......@@ -433,6 +433,13 @@ void Renderer::addLightAt(std::shared_ptr<Light> light, uint32_t lightIndex)
{
m_lights[lightIndex] = light;
if(light->shadowType() == ShadowType::SHADOWMAP_SHADOW ||
light->shadowType() == ShadowType::TRACED_SHADOW)
{
std::static_pointer_cast<TracedLight>(light)->setSsShadowTextureSize(
m_gBufferFbo->getDepthAttachment()->size());
}
if(light->shadowType() == ShadowType::SHADOWMAP_SHADOW)
{
if(!m_generatedShaderSource.empty())
......@@ -463,17 +470,6 @@ uint32_t Renderer::addLight(std::shared_ptr<Light> light)
});
const uint32_t id = max_id_iter == m_lights.end() ? 0 : max_id_iter->first + 1;
if(light->shadowType() == ShadowType::SHADOWMAP_SHADOW) // is TracedLight or ShadowMapLight
{
std::static_pointer_cast<ShadowMapLight>(light)->setSsShadowTextureSize(
m_gBufferFbo->getDepthAttachment()->size());
}
else if(light->shadowType() == ShadowType::TRACED_SHADOW)
{
std::static_pointer_cast<TracedLight>(light)->setSsShadowTextureSize(
m_gBufferFbo->getDepthAttachment()->size());
}
addLightAt(std::move(light), id);
return id;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment