mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-22 04:45:31 +00:00
more misc cleanup, including cutting down on sampling the pbrconfigmap by filling that out first, and drawing the smooth and metal vars from it, and filling out an ao var in case folks wanna use that later, as well as a bit more doubled up functionality prune-down. still tracing why forward lit seems to have lost the map config feature
This commit is contained in:
parent
92efdb0d86
commit
ab613187ed
11 changed files with 38 additions and 31 deletions
|
|
@ -117,7 +117,7 @@ void PBRConfigMapGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
|
||||
// Material Info Flags -> Red ( Flags ) of Material Info Buffer.
|
||||
void DeferredMatInfoFlagsGLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
|
||||
void MatInfoFlagsGLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
|
||||
{
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
const MaterialFeatureData &fd );
|
||||
};
|
||||
|
||||
class DeferredMatInfoFlagsGLSL : public ShaderFeatureGLSL
|
||||
class MatInfoFlagsGLSL : public ShaderFeatureGLSL
|
||||
{
|
||||
public:
|
||||
virtual String getName() { return "Deferred Shading: Mat Info Flags"; }
|
||||
|
|
|
|||
|
|
@ -89,16 +89,20 @@ void PBRConfigMapHLSL::processPix( Vector<ShaderComponent*> &componentList, cons
|
|||
if (!metalness) metalness = new Var("metalness", "float");
|
||||
Var *smoothness = (Var*)LangElement::find("smoothness");
|
||||
if (!smoothness) smoothness = new Var("smoothness", "float");
|
||||
Var* ao = (Var*)LangElement::find("ao");
|
||||
if (!ao) ao = new Var("ao", "float");
|
||||
|
||||
meta->addStatement(new GenOp(" @ = @.r;\r\n", new DecOp(smoothness), texOp));
|
||||
meta->addStatement(new GenOp(" @ = @.b;\r\n", new DecOp(metalness), texOp));
|
||||
|
||||
meta->addStatement(new GenOp(" @.bga = @.rgb;\r\n", pbrConfig, texOp));
|
||||
|
||||
meta->addStatement(new GenOp(" @ = @.b;\r\n", new DecOp(smoothness), pbrConfig));
|
||||
if (fd.features[MFT_InvertSmoothness])
|
||||
{
|
||||
meta->addStatement(new GenOp(" @.b = 1.0-@.b;\r\n", pbrConfig, pbrConfig));
|
||||
meta->addStatement(new GenOp(" @ = 1.0-@;\r\n", smoothness, smoothness));
|
||||
|
||||
if (!fd.features[MFT_isDeferred])
|
||||
meta->addStatement(new GenOp(" @ = @.ggga;\r\n", pbrConfig, texOp));
|
||||
meta->addStatement(new GenOp(" @.bga = float3(@,@.g,@);\r\n", pbrConfig, smoothness, pbrConfig, metalness));
|
||||
}
|
||||
meta->addStatement(new GenOp(" @ = @.g;\r\n", new DecOp(ao), pbrConfig));
|
||||
meta->addStatement(new GenOp(" @ = @.a;\r\n", new DecOp(metalness), pbrConfig));
|
||||
output = meta;
|
||||
}
|
||||
|
||||
|
|
@ -137,8 +141,13 @@ void PBRConfigMapHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
output = meta;
|
||||
}
|
||||
|
||||
U32 MatInfoFlagsHLSL::getOutputTargets(const MaterialFeatureData& fd) const
|
||||
{
|
||||
return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 : ShaderFeature::DefaultTarget;
|
||||
}
|
||||
|
||||
// Material Info Flags -> Red ( Flags ) of Material Info Buffer.
|
||||
void DeferredMatInfoFlagsHLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
|
||||
void MatInfoFlagsHLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
|
||||
{
|
||||
// search for material var
|
||||
Var* pbrConfig;
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ public:
|
|||
const MaterialFeatureData &fd );
|
||||
};
|
||||
|
||||
class DeferredMatInfoFlagsHLSL : public ShaderFeatureHLSL
|
||||
class MatInfoFlagsHLSL : public ShaderFeatureHLSL
|
||||
{
|
||||
public:
|
||||
virtual String getName() { return "Deferred Shading: Mat Info Flags"; }
|
||||
|
||||
virtual void processPix( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd );
|
||||
|
||||
virtual U32 getOutputTargets( const MaterialFeatureData &fd ) const { return ShaderFeature::RenderTarget2; }
|
||||
|
||||
virtual U32 getOutputTargets(const MaterialFeatureData& fd) const;
|
||||
};
|
||||
|
||||
class PBRConfigVarsHLSL : public ShaderFeatureHLSL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue