From 88c179ab82d9ece6af398ed4d35ecd69b14f382f Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Fri, 12 Oct 2012 19:18:36 -0400 Subject: [PATCH] fixed the realtime preview for the case where a subset of objects having the same material uses face normals --- src/libhw/vpl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libhw/vpl.cpp b/src/libhw/vpl.cpp index d0e1f049..a114b0c7 100644 --- a/src/libhw/vpl.cpp +++ b/src/libhw/vpl.cpp @@ -563,6 +563,7 @@ void VPLShaderManager::unbind() { void VPLShaderManager::drawAllGeometryForVPL(const VPL &vpl, const Sensor *sensor) { const Emitter *currentEmitter = NULL; const BSDF *currentBSDF = NULL; + bool currentHasNormals = false; m_renderer->setDepthTest(true); @@ -579,12 +580,12 @@ void VPLShaderManager::drawAllGeometryForVPL(const VPL &vpl, const Sensor *senso const Matrix4x4 &trafo = (*it).second; const BSDF *bsdf = geo->getTriMesh()->getBSDF(); const Emitter *emitter = geo->getTriMesh()->getEmitter(); + bool hasNormals = !geo->getTriMesh()->hasVertexNormals(); nTriangles += geo->getTriMesh()->getTriangleCount(); - if (emitter != currentEmitter || bsdf != currentBSDF) { - bool hasNormals = !geo->getTriMesh()->hasVertexNormals(); - currentBSDF = bsdf; currentEmitter = emitter; + if (emitter != currentEmitter || bsdf != currentBSDF || hasNormals != currentHasNormals) { + currentBSDF = bsdf; currentEmitter = emitter; currentHasNormals = hasNormals; if (m_currentProgram.program) { m_currentProgram.program->unbind();