Fixed bug causing incorrect specular value to be assigned to a material when a mesh is rendered using the same shader as the previously rendered material.

--HG--
extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%4095
This commit is contained in:
kearwood
2012-09-11 08:50:25 +00:00
parent c6417c151d
commit 763e8b8fe7
2 changed files with 5 additions and 7 deletions

View File

@@ -231,9 +231,10 @@ void KRMaterial::bind(KRMaterial **prevBoundMaterial, char *szPrevShaderKey, KRC
bool bSameShader = strcmp(pShader->getKey(), szPrevShaderKey) == 0;
if(!bSameShader) {
pShader->bind(pCamera, matModelToView, mvpMatrix, cameraPosition, lightDirection, pShadowMatrices, shadowDepthTextures, cShadowBuffers, renderPass);
glUniform1f(pShader->m_uniforms[KRShader::KRENGINE_UNIFORM_MATERIAL_SHININESS], pCamera->bDebugSuperShiny ? 20.0 : m_ns );
strcpy(szPrevShaderKey, pShader->getKey());
}
glUniform1f(pShader->m_uniforms[KRShader::KRENGINE_UNIFORM_MATERIAL_SHININESS], pCamera->bDebugSuperShiny ? 20.0 : m_ns );
bool bSameAmbient = false;
bool bSameDiffuse = false;

View File

@@ -146,20 +146,17 @@ void KRScene::render(KROctreeNode *pOctreeNode, std::set<KRAABB> &visibleBounds,
KRAABB octreeBounds = pOctreeNode->getBounds();
//KRBoundingVolume frustrumVolumeNoNearClip = KRBoundingVolume(viewMatrix, pCamera->perspective_fov, pCamera->m_viewportSize.x / pCamera->m_viewportSize.y, 0.0, pCamera->perspective_farz);
KRBoundingVolume frustrumVolumeNoNearClip = KRBoundingVolume(viewMatrix, pCamera->perspective_fov, pCamera->m_viewportSize.x / pCamera->m_viewportSize.y, 0.0, pCamera->perspective_farz);
if(true) {
//if(pOctreeNode->getBounds().visible(viewMatrix * projectionMatrix)) { // Only recurse deeper if within the view frustrum
//if(frustrumVolumeNoNearClip.test_intersect(pOctreeNode->getBounds())) { // Only recurse deeper if within the view frustrum
bool can_occlusion_test = renderPass == KRNode::RENDER_PASS_FORWARD_OPAQUE || renderPass == KRNode::RENDER_PASS_DEFERRED_GBUFFER || renderPass == KRNode::RENDER_PASS_FORWARD_TRANSPARENT;
bool can_occlusion_test = renderPass == KRNode::RENDER_PASS_FORWARD_OPAQUE || renderPass == KRNode::RENDER_PASS_DEFERRED_GBUFFER/* || renderPass == KRNode::RENDER_PASS_FORWARD_TRANSPARENT*/;
bool bVisible = true;
// bool bVisible = renderPass != KRNode::RENDER_PASS_DEFERRED_OPAQUE;
// if(!bVisible) {
// bVisible = visibleBounds.find(octreeBounds) != visibleBounds.end();
// }
//bool bVisible = visibleBounds.find(octreeBounds) != visibleBounds.end();
if(bVisible) {
if(can_occlusion_test) {