diff --git a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp index f10be1b7c..d55fbcd1c 100644 --- a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp @@ -508,14 +508,14 @@ void DeferredPixelSpecularGLSL::processPix( Vector &component specular->setName( "specular" ); LangElement * specDecl = new DecOp( specular ); - Var *specCol = (Var*)LangElement::find( "specularColor" ); - if(specCol == NULL) + Var *pbrConfig = (Var*)LangElement::find( "pbrConfig" ); + if(pbrConfig == NULL) { - specCol = new Var; - specCol->setType( "vec4" ); - specCol->setName( "specularColor" ); - specCol->uniform = true; - specCol->constSortPos = cspPotentialPrimitive; + pbrConfig = new Var; + pbrConfig->setType( "vec4" ); + pbrConfig->setName( "pbrConfig" ); + pbrConfig->uniform = true; + pbrConfig->constSortPos = cspPotentialPrimitive; } Var *smoothness = (Var*)LangElement::find("smoothness"); @@ -526,7 +526,7 @@ void DeferredPixelSpecularGLSL::processPix( Vector &component // If the gloss map flag is set, than the specular power is in the alpha // channel of the specular map if (fd.features[MFT_GlossMap]) - meta->addStatement(new GenOp(" @ = @.a;\r\n", new DecOp(smoothness), specCol)); + meta->addStatement(new GenOp(" @ = @.a;\r\n", new DecOp(smoothness), pbrConfig)); else { smoothness->uniform = true; @@ -561,7 +561,7 @@ void DeferredPixelSpecularGLSL::processPix( Vector &component meta->addStatement( new GenOp( " @ = pow( abs(@), max((@ / AL_ConstantSpecularPower),1.0f)) * @;\r\n", specDecl, d_specular, smoothness, metalness)); - LangElement *specMul = new GenOp( "vec4( @.rgb, 0 ) * @", specCol, specular ); + LangElement *specMul = new GenOp( "vec4( @.rgb, 0 ) * @", pbrConfig, specular ); LangElement *final = specMul; // We we have a normal map then mask the specular diff --git a/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp b/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp index 45922e301..f63a646cf 100644 --- a/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/deferredShadingFeaturesGLSL.cpp @@ -64,8 +64,8 @@ void DeferredSpecMapGLSL::processPix( Vector &componentList, c specularMap->constNum = Var::getTexUnitNum(); LangElement *texOp = new GenOp( "tex2D(@, @)", specularMap, texCoord ); - Var *specularColor = (Var*)LangElement::find("specularColor"); - if (!specularColor) specularColor = new Var("specularColor", "vec4"); + Var *pbrConfig = (Var*)LangElement::find("PBRConfig"); + if (!pbrConfig) pbrConfig = new Var("PBRConfig", "vec4"); Var *metalness = (Var*)LangElement::find("metalness"); if (!metalness) metalness = new Var("metalness", "float"); Var *smoothness = (Var*)LangElement::find("smoothness"); @@ -77,9 +77,9 @@ void DeferredSpecMapGLSL::processPix( Vector &componentList, c if (fd.features[MFT_InvertSmoothness]) meta->addStatement(new GenOp(" @ = 1.0-@;\r\n", smoothness, smoothness)); - meta->addStatement(new GenOp(" @ = @.ggga;\r\n", new DecOp(specularColor), texOp)); + meta->addStatement(new GenOp(" @ = @.ggga;\r\n", new DecOp(pbrConfig), texOp)); - meta->addStatement(new GenOp(" @.bga = vec3(@,@.g,@);\r\n", material, smoothness, specularColor, metalness)); + meta->addStatement(new GenOp(" @.bga = vec3(@,@.g,@);\r\n", material, smoothness, pbrConfig, metalness)); output = meta; } diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp index ad426499e..6301e9f3e 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp @@ -541,14 +541,14 @@ void DeferredPixelSpecularHLSL::processPix( Vector &component specular->setName( "specular" ); LangElement * specDecl = new DecOp( specular ); - Var *specCol = (Var*)LangElement::find( "specularColor" ); - if(specCol == NULL) + Var *pbrConfig = (Var*)LangElement::find( "pbrConfig" ); + if(pbrConfig == NULL) { - specCol = new Var; - specCol->setType( "float4" ); - specCol->setName( "specularColor" ); - specCol->uniform = true; - specCol->constSortPos = cspPotentialPrimitive; + pbrConfig = new Var; + pbrConfig->setType( "float4" ); + pbrConfig->setName( "pbrConfig" ); + pbrConfig->uniform = true; + pbrConfig->constSortPos = cspPotentialPrimitive; } Var *smoothness = (Var*)LangElement::find("smoothness"); @@ -559,7 +559,7 @@ void DeferredPixelSpecularHLSL::processPix( Vector &component // If the gloss map flag is set, than the specular power is in the alpha // channel of the specular map if (fd.features[MFT_GlossMap]) - meta->addStatement(new GenOp(" @ = @.a;\r\n", new DecOp(smoothness), specCol)); + meta->addStatement(new GenOp(" @ = @.a;\r\n", new DecOp(smoothness), pbrConfig)); else { smoothness->uniform = true; @@ -596,7 +596,7 @@ void DeferredPixelSpecularHLSL::processPix( Vector &component meta->addStatement( new GenOp( " @ = pow( abs(@), max((@ / AL_ConstantSpecularPower),1.0f)) * @;\r\n", specDecl, d_specular, smoothness, metalness)); - LangElement *specMul = new GenOp( "float4( @.rgb, 0 ) * @", specCol, specular ); + LangElement *specMul = new GenOp( "float4( @.rgb, 0 ) * @", pbrConfig, specular ); LangElement *final = specMul; // We we have a normal map then mask the specular diff --git a/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp index a998b2fc4..7840a4740 100644 --- a/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp @@ -71,8 +71,8 @@ void DeferredSpecMapHLSL::processPix( Vector &componentList, c specularMapTex->constNum = specularMap->constNum; LangElement *texOp = new GenOp(" @.Sample(@, @)", specularMapTex, specularMap, texCoord); - Var *specularColor = (Var*)LangElement::find("specularColor"); - if (!specularColor) specularColor = new Var("specularColor", "float4"); + Var * pbrConfig = (Var*)LangElement::find("pbrConfig"); + if (!pbrConfig) pbrConfig = new Var("pbrConfig", "float4"); Var *metalness = (Var*)LangElement::find("metalness"); if (!metalness) metalness = new Var("metalness", "float"); Var *smoothness = (Var*)LangElement::find("smoothness"); @@ -84,8 +84,8 @@ void DeferredSpecMapHLSL::processPix( Vector &componentList, c if (fd.features[MFT_InvertSmoothness]) meta->addStatement(new GenOp(" @ = 1.0-@;\r\n", smoothness, smoothness)); - meta->addStatement(new GenOp(" @ = @.ggga;\r\n", new DecOp(specularColor), texOp)); - meta->addStatement(new GenOp(" @.bga = float3(@,@.g,@);\r\n", material, smoothness, specularColor, metalness)); + meta->addStatement(new GenOp(" @ = @.ggga;\r\n", new DecOp(pbrConfig), texOp)); + meta->addStatement(new GenOp(" @.bga = float3(@,@.g,@);\r\n", material, smoothness, pbrConfig, metalness)); output = meta; } diff --git a/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp b/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp index 0608da4fc..8b5f0d473 100644 --- a/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/pixSpecularGLSL.cpp @@ -87,9 +87,9 @@ void PixelSpecularGLSL::processPix( Vector &componentList, // If we have a normal map then mask the specular if ( fd.features[MFT_SpecularMap] ) { - Var *specularColor = (Var*)LangElement::find( "specularColor" ); - if (specularColor) - final = new GenOp( "@ * @", final, specularColor ); + Var *pbrConfig = (Var*)LangElement::find( "PBRConfig" ); + if (pbrConfig) + final = new GenOp( "@ * @", final, pbrConfig); } else if ( fd.features[MFT_NormalMap] && !fd.features[MFT_IsBC3nm] && !fd.features[MFT_IsBC5nm]) { @@ -139,7 +139,7 @@ void SpecularMapGLSL::processPix( Vector &componentList, const specularMap->constNum = Var::getTexUnitNum(); LangElement *texOp = new GenOp( "texture(@, @)", specularMap, texCoord ); - Var *specularColor = new Var( "specularColor", "vec4" ); + Var * pbrConfig = new Var( "PBRConfig", "vec4" ); Var *metalness = (Var*)LangElement::find("metalness"); if (!metalness) metalness = new Var("metalness", "float"); Var *smoothness = (Var*)LangElement::find("smoothness"); @@ -152,7 +152,7 @@ void SpecularMapGLSL::processPix( Vector &componentList, const if (fd.features[MFT_InvertSmoothness]) meta->addStatement(new GenOp(" @ = 1.0-@;\r\n", smoothness, smoothness)); - meta->addStatement(new GenOp(" @ = @.ggga;\r\n", new DecOp(specularColor), texOp)); + meta->addStatement(new GenOp(" @ = @.ggga;\r\n", new DecOp(pbrConfig), texOp)); output = meta; } diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index a511cd4ad..981288f28 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -2990,7 +2990,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector& componentList meta->addStatement(new GenOp(" @ = vec4(1.0,1.0,1.0,1.0);\r\n", colorDecl)); //default to flat white } - Var* matinfo = (Var*)LangElement::find("specularColor"); + Var* matinfo = (Var*)LangElement::find("PBRConfig"); if (!matinfo) { Var* metalness = (Var*)LangElement::find("metalness"); @@ -3009,7 +3009,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector& componentList smoothness->constSortPos = cspPotentialPrimitive; } - matinfo = new Var("specularColor", "vec4"); + matinfo = new Var("PBRConfig", "vec4"); LangElement* colorDecl = new DecOp(matinfo); meta->addStatement(new GenOp(" @ = vec4(0.0,1.0,@,@);\r\n", colorDecl, smoothness, metalness)); //reconstruct matinfo, no ao darkening } diff --git a/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp b/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp index d38d66461..abb31b71e 100644 --- a/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/pixSpecularHLSL.cpp @@ -91,9 +91,9 @@ void PixelSpecularHLSL::processPix( Vector &componentList, // If we have a normal map then mask the specular if ( fd.features[MFT_SpecularMap] ) { - Var *specularColor = (Var*)LangElement::find( "specularColor" ); - if (specularColor) - final = new GenOp( "@ * @", final, specularColor ); + Var *pbrConfig = (Var*)LangElement::find( "PBRConfig" ); + if (pbrConfig) + final = new GenOp( "@ * @", final, pbrConfig); } else if ( fd.features[MFT_NormalMap] && !fd.features[MFT_IsBC3nm] && !fd.features[MFT_IsBC5nm]) { @@ -151,7 +151,7 @@ void SpecularMapHLSL::processPix( Vector &componentList, const LangElement *texOp = new GenOp("@.Sample(@, @)", specularMapTex, specularMap, texCoord); - Var *specularColor = new Var( "specularColor", "float4" ); + Var * pbrConfig = new Var( "PBRConfig", "float4" ); Var *metalness = (Var*)LangElement::find("metalness"); if (!metalness) metalness = new Var("metalness", "float"); Var *smoothness = (Var*)LangElement::find("smoothness"); @@ -163,7 +163,7 @@ void SpecularMapHLSL::processPix( Vector &componentList, const if (fd.features[MFT_InvertSmoothness]) meta->addStatement(new GenOp(" @ = 1.0-@;\r\n", smoothness, smoothness)); - meta->addStatement(new GenOp(" @ = @.ggga;\r\n", new DecOp(specularColor), texOp)); + meta->addStatement(new GenOp(" @ = @.ggga;\r\n", new DecOp(pbrConfig), texOp)); output = meta; } diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index a7a6cfc39..3a4755b13 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -1851,8 +1851,6 @@ void ReflectCubeFeatHLSL::processPix( Vector &componentList, { if (fd.features[MFT_isDeferred]) glossColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1)); - //if (!glossColor) - //glossColor = (Var*)LangElement::find("specularColor"); if (!glossColor) glossColor = (Var*)LangElement::find("diffuseColor"); if (!glossColor) @@ -3081,7 +3079,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector &componentList Var *diffuseColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); - Var *matinfo = (Var*)LangElement::find("specularColor"); + Var *matinfo = (Var*)LangElement::find("PBRConfig"); if (!matinfo) { Var* metalness = (Var*)LangElement::find("metalness"); @@ -3100,7 +3098,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector &componentList smoothness->constSortPos = cspPotentialPrimitive; } - matinfo = new Var("specularColor", "float4"); + matinfo = new Var("PBRConfig", "float4"); LangElement* colorDecl = new DecOp(matinfo); meta->addStatement(new GenOp(" @ = float4(0.0,1.0,@,@);\r\n", colorDecl, smoothness, metalness)); //reconstruct matinfo, no ao darkening }