mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-04 21:10:32 +00:00
backend support for isSRGB and invSmooth flags, general cleanup HLSL side. left GLSL alone for sxs comparrison while we work out the kinks
This commit is contained in:
parent
f007700646
commit
29a8d5d36c
3 changed files with 26 additions and 17 deletions
|
|
@ -1112,11 +1112,9 @@ void TerrainAdditiveFeatHLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
const MaterialFeatureData &fd )
|
||||
{
|
||||
Var *color = NULL;
|
||||
Var *normal = NULL;
|
||||
if (fd.features[MFT_isDeferred])
|
||||
{
|
||||
color = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::RenderTarget1) );
|
||||
normal = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::DefaultTarget) );
|
||||
}
|
||||
else
|
||||
color = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::DefaultTarget) );
|
||||
|
|
@ -1130,9 +1128,6 @@ void TerrainAdditiveFeatHLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
meta->addStatement( new GenOp( " clip( @ - 0.0001 );\r\n", blendTotal ) );
|
||||
meta->addStatement( new GenOp( " @.a = @;\r\n", color, blendTotal ) );
|
||||
|
||||
if (normal)
|
||||
meta->addStatement(new GenOp(" @.a = @;\r\n", normal, blendTotal));
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
||||
|
|
@ -1268,22 +1263,22 @@ void TerrainCompositeMapFeatHLSL::processPix(Vector<ShaderComponent*> &component
|
|||
texOp = new GenOp("@.Sample(@, @.xy)", compositeMapTex, compositeMap, inDet);
|
||||
|
||||
// search for material var
|
||||
Var *material;
|
||||
Var * pbrConfig;
|
||||
OutputTarget targ = RenderTarget1;
|
||||
if (fd.features[MFT_isDeferred])
|
||||
{
|
||||
targ = RenderTarget2;
|
||||
}
|
||||
material = (Var*)LangElement::find(getOutputTargetVarName(targ));
|
||||
pbrConfig = (Var*)LangElement::find(getOutputTargetVarName(targ));
|
||||
|
||||
MultiLine * meta = new MultiLine;
|
||||
if (!material)
|
||||
if (!pbrConfig)
|
||||
{
|
||||
// create color var
|
||||
material = new Var;
|
||||
material->setType("fragout");
|
||||
material->setName(getOutputTargetVarName(targ));
|
||||
material->setStructName("OUT");
|
||||
pbrConfig = new Var;
|
||||
pbrConfig->setType("fragout");
|
||||
pbrConfig->setName(getOutputTargetVarName(targ));
|
||||
pbrConfig->setStructName("OUT");
|
||||
}
|
||||
|
||||
Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));
|
||||
|
|
@ -1295,15 +1290,19 @@ void TerrainCompositeMapFeatHLSL::processPix(Vector<ShaderComponent*> &component
|
|||
Var *priorComp = (Var*)LangElement::find(String::ToString("matinfoCol%d", compositeIndex - 1));
|
||||
if (priorComp)
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = @.grb*@;\r\n", new DecOp(matinfoCol), texOp, detailBlend));
|
||||
meta->addStatement(new GenOp(" @.gba += @;\r\n", material, matinfoCol));
|
||||
meta->addStatement(new GenOp(" @ = @.rgb*@;\r\n", new DecOp(matinfoCol), texOp, detailBlend));
|
||||
meta->addStatement(new GenOp(" @.bga += @;\r\n", pbrConfig, matinfoCol));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = lerp(float3(1,0,0),@.grb,@);\r\n", new DecOp(matinfoCol), texOp, detailBlend));
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0,@);\r\n", material, matinfoCol));
|
||||
meta->addStatement(new GenOp(" @ = lerp(float3(0,1,0),@.rgb,@);\r\n", new DecOp(matinfoCol), texOp, detailBlend));
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0,@);\r\n", pbrConfig, matinfoCol));
|
||||
}
|
||||
|
||||
if (!fd.features[MFT_InvertSmoothness])
|
||||
{
|
||||
meta->addStatement(new GenOp(" @.b = 1.0-@.b;\r\n", pbrConfig, pbrConfig));
|
||||
}
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue