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:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user