nonbreaking 'specularcolor' to 'pbrConfig' var conversion. (TODO: specularMap entries)

This commit is contained in:
AzaezelX 2019-04-29 19:40:22 -05:00
parent d519479562
commit 98a3ff604a
8 changed files with 40 additions and 42 deletions

View file

@ -87,9 +87,9 @@ void PixelSpecularGLSL::processPix( Vector<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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;
}

View file

@ -2990,7 +2990,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& 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<ShaderComponent*>& 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
}

View file

@ -91,9 +91,9 @@ void PixelSpecularHLSL::processPix( Vector<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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;
}

View file

@ -1851,8 +1851,6 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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
}