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

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

View file

@ -508,14 +508,14 @@ void DeferredPixelSpecularGLSL::processPix( Vector<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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

View file

@ -64,8 +64,8 @@ void DeferredSpecMapGLSL::processPix( Vector<ShaderComponent*> &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<ShaderComponent*> &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;
}

View file

@ -541,14 +541,14 @@ void DeferredPixelSpecularHLSL::processPix( Vector<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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

View file

@ -71,8 +71,8 @@ void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &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<ShaderComponent*> &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;
}