mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
nonbreaking 'specularcolor' to 'pbrConfig' var conversion. (TODO: specularMap entries)
This commit is contained in:
parent
cd937fca30
commit
2b997d2d9c
8 changed files with 40 additions and 42 deletions
|
|
@ -508,14 +508,14 @@ void DeferredPixelSpecularGLSL::processPix( Vector<ShaderComponent*> &component
|
||||||
specular->setName( "specular" );
|
specular->setName( "specular" );
|
||||||
LangElement * specDecl = new DecOp( specular );
|
LangElement * specDecl = new DecOp( specular );
|
||||||
|
|
||||||
Var *specCol = (Var*)LangElement::find( "specularColor" );
|
Var *pbrConfig = (Var*)LangElement::find( "pbrConfig" );
|
||||||
if(specCol == NULL)
|
if(pbrConfig == NULL)
|
||||||
{
|
{
|
||||||
specCol = new Var;
|
pbrConfig = new Var;
|
||||||
specCol->setType( "vec4" );
|
pbrConfig->setType( "vec4" );
|
||||||
specCol->setName( "specularColor" );
|
pbrConfig->setName( "pbrConfig" );
|
||||||
specCol->uniform = true;
|
pbrConfig->uniform = true;
|
||||||
specCol->constSortPos = cspPotentialPrimitive;
|
pbrConfig->constSortPos = cspPotentialPrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
Var *smoothness = (Var*)LangElement::find("smoothness");
|
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
|
// If the gloss map flag is set, than the specular power is in the alpha
|
||||||
// channel of the specular map
|
// channel of the specular map
|
||||||
if (fd.features[MFT_GlossMap])
|
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
|
else
|
||||||
{
|
{
|
||||||
smoothness->uniform = true;
|
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",
|
meta->addStatement( new GenOp( " @ = pow( abs(@), max((@ / AL_ConstantSpecularPower),1.0f)) * @;\r\n",
|
||||||
specDecl, d_specular, smoothness, metalness));
|
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;
|
LangElement *final = specMul;
|
||||||
|
|
||||||
// We we have a normal map then mask the specular
|
// We we have a normal map then mask the specular
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,8 @@ void DeferredSpecMapGLSL::processPix( Vector<ShaderComponent*> &componentList, c
|
||||||
specularMap->constNum = Var::getTexUnitNum();
|
specularMap->constNum = Var::getTexUnitNum();
|
||||||
LangElement *texOp = new GenOp( "tex2D(@, @)", specularMap, texCoord );
|
LangElement *texOp = new GenOp( "tex2D(@, @)", specularMap, texCoord );
|
||||||
|
|
||||||
Var *specularColor = (Var*)LangElement::find("specularColor");
|
Var *pbrConfig = (Var*)LangElement::find("PBRConfig");
|
||||||
if (!specularColor) specularColor = new Var("specularColor", "vec4");
|
if (!pbrConfig) pbrConfig = new Var("PBRConfig", "vec4");
|
||||||
Var *metalness = (Var*)LangElement::find("metalness");
|
Var *metalness = (Var*)LangElement::find("metalness");
|
||||||
if (!metalness) metalness = new Var("metalness", "float");
|
if (!metalness) metalness = new Var("metalness", "float");
|
||||||
Var *smoothness = (Var*)LangElement::find("smoothness");
|
Var *smoothness = (Var*)LangElement::find("smoothness");
|
||||||
|
|
@ -77,9 +77,9 @@ void DeferredSpecMapGLSL::processPix( Vector<ShaderComponent*> &componentList, c
|
||||||
if (fd.features[MFT_InvertSmoothness])
|
if (fd.features[MFT_InvertSmoothness])
|
||||||
meta->addStatement(new GenOp(" @ = 1.0-@;\r\n", smoothness, smoothness));
|
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;
|
output = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -541,14 +541,14 @@ void DeferredPixelSpecularHLSL::processPix( Vector<ShaderComponent*> &component
|
||||||
specular->setName( "specular" );
|
specular->setName( "specular" );
|
||||||
LangElement * specDecl = new DecOp( specular );
|
LangElement * specDecl = new DecOp( specular );
|
||||||
|
|
||||||
Var *specCol = (Var*)LangElement::find( "specularColor" );
|
Var *pbrConfig = (Var*)LangElement::find( "pbrConfig" );
|
||||||
if(specCol == NULL)
|
if(pbrConfig == NULL)
|
||||||
{
|
{
|
||||||
specCol = new Var;
|
pbrConfig = new Var;
|
||||||
specCol->setType( "float4" );
|
pbrConfig->setType( "float4" );
|
||||||
specCol->setName( "specularColor" );
|
pbrConfig->setName( "pbrConfig" );
|
||||||
specCol->uniform = true;
|
pbrConfig->uniform = true;
|
||||||
specCol->constSortPos = cspPotentialPrimitive;
|
pbrConfig->constSortPos = cspPotentialPrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
Var *smoothness = (Var*)LangElement::find("smoothness");
|
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
|
// If the gloss map flag is set, than the specular power is in the alpha
|
||||||
// channel of the specular map
|
// channel of the specular map
|
||||||
if (fd.features[MFT_GlossMap])
|
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
|
else
|
||||||
{
|
{
|
||||||
smoothness->uniform = true;
|
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",
|
meta->addStatement( new GenOp( " @ = pow( abs(@), max((@ / AL_ConstantSpecularPower),1.0f)) * @;\r\n",
|
||||||
specDecl, d_specular, smoothness, metalness));
|
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;
|
LangElement *final = specMul;
|
||||||
|
|
||||||
// We we have a normal map then mask the specular
|
// We we have a normal map then mask the specular
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &componentList, c
|
||||||
specularMapTex->constNum = specularMap->constNum;
|
specularMapTex->constNum = specularMap->constNum;
|
||||||
LangElement *texOp = new GenOp(" @.Sample(@, @)", specularMapTex, specularMap, texCoord);
|
LangElement *texOp = new GenOp(" @.Sample(@, @)", specularMapTex, specularMap, texCoord);
|
||||||
|
|
||||||
Var *specularColor = (Var*)LangElement::find("specularColor");
|
Var * pbrConfig = (Var*)LangElement::find("pbrConfig");
|
||||||
if (!specularColor) specularColor = new Var("specularColor", "float4");
|
if (!pbrConfig) pbrConfig = new Var("pbrConfig", "float4");
|
||||||
Var *metalness = (Var*)LangElement::find("metalness");
|
Var *metalness = (Var*)LangElement::find("metalness");
|
||||||
if (!metalness) metalness = new Var("metalness", "float");
|
if (!metalness) metalness = new Var("metalness", "float");
|
||||||
Var *smoothness = (Var*)LangElement::find("smoothness");
|
Var *smoothness = (Var*)LangElement::find("smoothness");
|
||||||
|
|
@ -84,8 +84,8 @@ void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &componentList, c
|
||||||
if (fd.features[MFT_InvertSmoothness])
|
if (fd.features[MFT_InvertSmoothness])
|
||||||
meta->addStatement(new GenOp(" @ = 1.0-@;\r\n", smoothness, smoothness));
|
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 = float3(@,@.g,@);\r\n", material, smoothness, specularColor, metalness));
|
meta->addStatement(new GenOp(" @.bga = float3(@,@.g,@);\r\n", material, smoothness, pbrConfig, metalness));
|
||||||
output = meta;
|
output = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,9 @@ void PixelSpecularGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
// If we have a normal map then mask the specular
|
// If we have a normal map then mask the specular
|
||||||
if ( fd.features[MFT_SpecularMap] )
|
if ( fd.features[MFT_SpecularMap] )
|
||||||
{
|
{
|
||||||
Var *specularColor = (Var*)LangElement::find( "specularColor" );
|
Var *pbrConfig = (Var*)LangElement::find( "PBRConfig" );
|
||||||
if (specularColor)
|
if (pbrConfig)
|
||||||
final = new GenOp( "@ * @", final, specularColor );
|
final = new GenOp( "@ * @", final, pbrConfig);
|
||||||
}
|
}
|
||||||
else if ( fd.features[MFT_NormalMap] && !fd.features[MFT_IsBC3nm] && !fd.features[MFT_IsBC5nm])
|
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();
|
specularMap->constNum = Var::getTexUnitNum();
|
||||||
LangElement *texOp = new GenOp( "texture(@, @)", specularMap, texCoord );
|
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");
|
Var *metalness = (Var*)LangElement::find("metalness");
|
||||||
if (!metalness) metalness = new Var("metalness", "float");
|
if (!metalness) metalness = new Var("metalness", "float");
|
||||||
Var *smoothness = (Var*)LangElement::find("smoothness");
|
Var *smoothness = (Var*)LangElement::find("smoothness");
|
||||||
|
|
@ -152,7 +152,7 @@ void SpecularMapGLSL::processPix( Vector<ShaderComponent*> &componentList, const
|
||||||
if (fd.features[MFT_InvertSmoothness])
|
if (fd.features[MFT_InvertSmoothness])
|
||||||
meta->addStatement(new GenOp(" @ = 1.0-@;\r\n", smoothness, smoothness));
|
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;
|
output = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
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)
|
if (!matinfo)
|
||||||
{
|
{
|
||||||
Var* metalness = (Var*)LangElement::find("metalness");
|
Var* metalness = (Var*)LangElement::find("metalness");
|
||||||
|
|
@ -3009,7 +3009,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
||||||
smoothness->constSortPos = cspPotentialPrimitive;
|
smoothness->constSortPos = cspPotentialPrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
matinfo = new Var("specularColor", "vec4");
|
matinfo = new Var("PBRConfig", "vec4");
|
||||||
LangElement* colorDecl = new DecOp(matinfo);
|
LangElement* colorDecl = new DecOp(matinfo);
|
||||||
meta->addStatement(new GenOp(" @ = vec4(0.0,1.0,@,@);\r\n", colorDecl, smoothness, metalness)); //reconstruct matinfo, no ao darkening
|
meta->addStatement(new GenOp(" @ = vec4(0.0,1.0,@,@);\r\n", colorDecl, smoothness, metalness)); //reconstruct matinfo, no ao darkening
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,9 @@ void PixelSpecularHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
// If we have a normal map then mask the specular
|
// If we have a normal map then mask the specular
|
||||||
if ( fd.features[MFT_SpecularMap] )
|
if ( fd.features[MFT_SpecularMap] )
|
||||||
{
|
{
|
||||||
Var *specularColor = (Var*)LangElement::find( "specularColor" );
|
Var *pbrConfig = (Var*)LangElement::find( "PBRConfig" );
|
||||||
if (specularColor)
|
if (pbrConfig)
|
||||||
final = new GenOp( "@ * @", final, specularColor );
|
final = new GenOp( "@ * @", final, pbrConfig);
|
||||||
}
|
}
|
||||||
else if ( fd.features[MFT_NormalMap] && !fd.features[MFT_IsBC3nm] && !fd.features[MFT_IsBC5nm])
|
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);
|
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");
|
Var *metalness = (Var*)LangElement::find("metalness");
|
||||||
if (!metalness) metalness = new Var("metalness", "float");
|
if (!metalness) metalness = new Var("metalness", "float");
|
||||||
Var *smoothness = (Var*)LangElement::find("smoothness");
|
Var *smoothness = (Var*)LangElement::find("smoothness");
|
||||||
|
|
@ -163,7 +163,7 @@ void SpecularMapHLSL::processPix( Vector<ShaderComponent*> &componentList, const
|
||||||
|
|
||||||
if (fd.features[MFT_InvertSmoothness])
|
if (fd.features[MFT_InvertSmoothness])
|
||||||
meta->addStatement(new GenOp(" @ = 1.0-@;\r\n", smoothness, smoothness));
|
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;
|
output = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1851,8 +1851,6 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
{
|
{
|
||||||
if (fd.features[MFT_isDeferred])
|
if (fd.features[MFT_isDeferred])
|
||||||
glossColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1));
|
glossColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1));
|
||||||
//if (!glossColor)
|
|
||||||
//glossColor = (Var*)LangElement::find("specularColor");
|
|
||||||
if (!glossColor)
|
if (!glossColor)
|
||||||
glossColor = (Var*)LangElement::find("diffuseColor");
|
glossColor = (Var*)LangElement::find("diffuseColor");
|
||||||
if (!glossColor)
|
if (!glossColor)
|
||||||
|
|
@ -3081,7 +3079,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
||||||
|
|
||||||
Var *diffuseColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
|
Var *diffuseColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
|
||||||
|
|
||||||
Var *matinfo = (Var*)LangElement::find("specularColor");
|
Var *matinfo = (Var*)LangElement::find("PBRConfig");
|
||||||
if (!matinfo)
|
if (!matinfo)
|
||||||
{
|
{
|
||||||
Var* metalness = (Var*)LangElement::find("metalness");
|
Var* metalness = (Var*)LangElement::find("metalness");
|
||||||
|
|
@ -3100,7 +3098,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
||||||
smoothness->constSortPos = cspPotentialPrimitive;
|
smoothness->constSortPos = cspPotentialPrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
matinfo = new Var("specularColor", "float4");
|
matinfo = new Var("PBRConfig", "float4");
|
||||||
LangElement* colorDecl = new DecOp(matinfo);
|
LangElement* colorDecl = new DecOp(matinfo);
|
||||||
meta->addStatement(new GenOp(" @ = float4(0.0,1.0,@,@);\r\n", colorDecl, smoothness, metalness)); //reconstruct matinfo, no ao darkening
|
meta->addStatement(new GenOp(" @ = float4(0.0,1.0,@,@);\r\n", colorDecl, smoothness, metalness)); //reconstruct matinfo, no ao darkening
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue