Fixed crash on ForwardRenderTechnique
Former-commit-id: 80181ffddf69a52af96814db54aa18a7809fa5d5
This commit is contained in:
parent
16bf4bbcf2
commit
19d5b62009
|
|
@ -302,9 +302,7 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene)
|
||||||
// Calcul des lumières les plus proches
|
// Calcul des lumières les plus proches
|
||||||
if (lightCount < m_maxLightsPerObject && !m_lights.IsEmpty())
|
if (lightCount < m_maxLightsPerObject && !m_lights.IsEmpty())
|
||||||
{
|
{
|
||||||
unsigned int count = m_lights.ComputeClosestLights(data.transformMatrix.GetTranslation() + boundingSphere.GetPosition(), boundingSphere.radius, maxLightCount);
|
unsigned int count = std::min(m_maxLightsPerObject-lightCount, m_lights.ComputeClosestLights(data.transformMatrix.GetTranslation() + boundingSphere.GetPosition(), boundingSphere.radius, maxLightCount));
|
||||||
count -= lightCount;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < count; ++i)
|
for (unsigned int i = 0; i < count; ++i)
|
||||||
m_lights.GetResult(i)->Enable(program, lightCount++);
|
m_lights.GetResult(i)->Enable(program, lightCount++);
|
||||||
}
|
}
|
||||||
|
|
@ -478,9 +476,7 @@ void NzForwardRenderTechnique::DrawTransparentModels(const NzScene* scene)
|
||||||
// Calcul des lumières les plus proches
|
// Calcul des lumières les plus proches
|
||||||
if (lightCount < m_maxLightsPerObject && !m_lights.IsEmpty())
|
if (lightCount < m_maxLightsPerObject && !m_lights.IsEmpty())
|
||||||
{
|
{
|
||||||
unsigned int count = m_lights.ComputeClosestLights(matrix.GetTranslation() + staticModel.boundingSphere.GetPosition(), staticModel.boundingSphere.radius, maxLightCount);
|
unsigned int count = std::min(m_maxLightsPerObject-lightCount, m_lights.ComputeClosestLights(matrix.GetTranslation() + staticModel.boundingSphere.GetPosition(), staticModel.boundingSphere.radius, maxLightCount));
|
||||||
count -= lightCount;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < count; ++i)
|
for (unsigned int i = 0; i < count; ++i)
|
||||||
m_lights.GetResult(i)->Enable(program, lightCount++);
|
m_lights.GetResult(i)->Enable(program, lightCount++);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue