Skip to content

Commit 1fe61c4

Browse files
committed
GITechDemo:
*fixed bug with BRDF model switching
1 parent 8c2adbd commit 1fe61c4

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/DirectionalLightPass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ void DirectionalLightPass::Update(const float fDeltaTime)
9393

9494
texIrradianceMap = IrradianceTexture.GetTextureIndex();
9595
texEnvMap = EnvironmentTexture.GetTextureIndex();
96-
97-
nBRDFModel = gmtl::Math::clamp(nBRDFModel.GetCurrentValue(), (int)BLINN_PHONG, (int)BRDF_MODEL_MAX - 1);
9896
}
9997

10098
void DirectionalLightPass::Draw()

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/GBufferPass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ void GBufferPass::Update(const float fDeltaTime)
9999
ResourceMgr->GetTexture(HyperbolicQuarterDepthBuffer.GetRenderTarget()->GetColorBuffer())->SetFilter(SF_MIN_MAG_POINT_MIP_NONE);
100100

101101
DIFFUSE_ANISOTROPY = Math::clamp(DIFFUSE_ANISOTROPY, 1, (int)MAX_ANISOTROPY);
102+
nBRDFModel = gmtl::Math::clamp(nBRDFModel.GetCurrentValue(), (int)BLINN_PHONG, (int)BRDF_MODEL_MAX - 1);
102103
}
103104

104105
void GBufferPass::Draw()
@@ -159,7 +160,7 @@ void GBufferPass::Draw()
159160
const unsigned int matTexIdx = SponzaScene.GetTexture(Synesthesia3D::Model::TextureDesc::TT_AMBIENT, SponzaScene.GetModel()->arrMesh[mesh]->nMaterialIdx);
160161
const unsigned int roughnessTexIdx = SponzaScene.GetTexture(Synesthesia3D::Model::TextureDesc::TT_SHININESS, SponzaScene.GetModel()->arrMesh[mesh]->nMaterialIdx);
161162

162-
if (diffuseTexIdx != ~0u && ((texMatType != ~0u && texRoughness != ~0u) || nBRDFModel == BLINN_PHONG))
163+
if (diffuseTexIdx != ~0u && ((matTexIdx != ~0u && roughnessTexIdx != ~0u) || nBRDFModel == BLINN_PHONG))
163164
{
164165
RenderContext->GetResourceManager()->GetTexture(diffuseTexIdx)->SetAnisotropy((unsigned int)DIFFUSE_ANISOTROPY);
165166

0 commit comments

Comments
 (0)