Forward RenderTechnique now handles non-lighting shaders

Former-commit-id: f243ba8aea76ada91510f6b36c292ae0e18e2add
This commit is contained in:
Lynix 2014-03-04 19:35:40 +01:00
parent 05e7e11356
commit 0f2cab56ff
1 changed files with 67 additions and 53 deletions

View File

@ -264,6 +264,8 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount-1)/NAZARA_GRAPHICS_MAX_LIGHTPERPASS + 1;
for (unsigned int pass = 0; pass < passCount; ++pass)
{
if (lightUniforms->exists)
{
unsigned int renderedLightCount = std::min(lightCount, NAZARA_GRAPHICS_MAX_LIGHTPERPASS);
lightCount -= renderedLightCount;
@ -284,6 +286,7 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
for (unsigned int i = renderedLightCount; i < NAZARA_GRAPHICS_MAX_LIGHTPERPASS; ++i)
NzLight::Disable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
}
const NzForwardRenderQueue::StaticData* data = &staticData[0];
unsigned int instanceCount = staticData.size();
@ -315,6 +318,8 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
NzRenderer::SetDepthFunc(oldDepthFunc);
}
else
{
if (lightUniforms->exists)
{
for (const NzForwardRenderQueue::StaticData& data : staticData)
{
@ -362,6 +367,15 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
NzRenderer::SetDepthFunc(oldDepthFunc);
}
}
else
{
for (const NzForwardRenderQueue::StaticData& data : staticData)
{
NzRenderer::SetMatrix(nzMatrixType_World, data.transformMatrix);
DrawFunc(primitiveMode, 0, indexCount);
}
}
}
staticData.clear();
}
}