From c53aa6958e212ca9c165cf6ebf1cc7009b48b9da Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 10 Sep 2013 16:24:45 +0200 Subject: [PATCH] Small adjustment to landscape vp parameter setting --HG-- branch : multipass-stereo --- code/nel/src/3d/landscape.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/code/nel/src/3d/landscape.cpp b/code/nel/src/3d/landscape.cpp index c6da6ec27..7f9898504 100644 --- a/code/nel/src/3d/landscape.cpp +++ b/code/nel/src/3d/landscape.cpp @@ -1199,22 +1199,26 @@ void CLandscape::render(const CVector &refineCenter, const CVector &frontVecto uint nbvp = uprogstate ? CLandscapeVBAllocator::MaxVertexProgram : 1; for (uint i = 0; i < nbvp; ++i) { - // activate the program to set the uniforms in the program state for all programs - // note: when uniforms are driver state, the indices must be the same across programs - if (uprogstate) _TileVB.activateVP(i); CVertexProgramLandscape *program = _TileVB.getVP(i); - // c[0..3] take the ModelViewProjection Matrix. - driver->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity); - // c[4] take useful constants. - driver->setUniform4f(IDriver::VertexProgram, program->idx().ProgramConstants0, 0, 1, 0.5f, 0); - // c[5] take RefineCenter - driver->setUniform3f(IDriver::VertexProgram, program->idx().RefineCenter, refineCenter); - // c[6] take info for Geomorph trnasition to TileNear. - driver->setUniform2f(IDriver::VertexProgram, program->idx().TileDist, CLandscapeGlobals::TileDistFarSqr, CLandscapeGlobals::OOTileDistDeltaSqr); - // c[10] take the fog vector. - driver->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::Fog)); - // c[12] take the current landscape Center / delta Pos to apply - driver->setUniform3f(IDriver::VertexProgram, program->idx().PZBModelPosition, _PZBModelPosition); + if (program) + { + // activate the program to set the uniforms in the program state for all programs + // note: when uniforms are driver state, the indices must be the same across programs + if (uprogstate) _TileVB.activateVP(i); + + // c[0..3] take the ModelViewProjection Matrix. + driver->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity); + // c[4] take useful constants. + driver->setUniform4f(IDriver::VertexProgram, program->idx().ProgramConstants0, 0, 1, 0.5f, 0); + // c[5] take RefineCenter + driver->setUniform3f(IDriver::VertexProgram, program->idx().RefineCenter, refineCenter); + // c[6] take info for Geomorph trnasition to TileNear. + driver->setUniform2f(IDriver::VertexProgram, program->idx().TileDist, CLandscapeGlobals::TileDistFarSqr, CLandscapeGlobals::OOTileDistDeltaSqr); + // c[10] take the fog vector. + driver->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CGPUProgramIndex::Fog)); + // c[12] take the current landscape Center / delta Pos to apply + driver->setUniform3f(IDriver::VertexProgram, program->idx().PZBModelPosition, _PZBModelPosition); + } } }