mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-24 13:55:34 +00:00
strip out unused pixspecular to cut down on sources of confusion
This commit is contained in:
parent
6326147fca
commit
57ee1882fa
22 changed files with 12 additions and 534 deletions
|
|
@ -29,88 +29,6 @@
|
|||
#include "gfx/gfxStructs.h"
|
||||
#include "shaderGen/shaderGen.h"
|
||||
|
||||
PixelSpecularGLSL::PixelSpecularGLSL()
|
||||
: mDep(ShaderGen::smCommonShaderPath + String("/gl/lighting.glsl" ))
|
||||
{
|
||||
addDependency( &mDep );
|
||||
}
|
||||
|
||||
void PixelSpecularGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd )
|
||||
{
|
||||
AssertFatal( fd.features[MFT_RTLighting],
|
||||
"PixelSpecularHLSL requires RTLighting to be enabled!" );
|
||||
|
||||
// Nothing to do here... MFT_RTLighting should have
|
||||
// taken care of passing everything to the pixel shader.
|
||||
}
|
||||
|
||||
void PixelSpecularGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd )
|
||||
{
|
||||
AssertFatal( fd.features[MFT_RTLighting],
|
||||
"PixelSpecularHLSL requires RTLighting to be enabled!" );
|
||||
|
||||
// RTLighting should have spit out the 4 specular
|
||||
// powers for the 4 potential lights on this pass.
|
||||
//
|
||||
// This can sometimes be NULL if RTLighting skips out
|
||||
// on us for lightmaps or missing normals.
|
||||
Var *specular = (Var*)LangElement::find( "specular" );
|
||||
if ( !specular )
|
||||
return;
|
||||
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
LangElement *specMul = new GenOp( "@", specular );
|
||||
LangElement *final = specMul;
|
||||
|
||||
// mask out with lightmap if present
|
||||
if ( fd.features[MFT_LightMap] )
|
||||
{
|
||||
LangElement *lmColor = NULL;
|
||||
|
||||
// find lightmap color
|
||||
lmColor = LangElement::find( "lmColor" );
|
||||
|
||||
if ( !lmColor )
|
||||
{
|
||||
LangElement * lightMap = LangElement::find( "lightMap" );
|
||||
LangElement * lmCoord = LangElement::find( "texCoord2" );
|
||||
|
||||
lmColor = new GenOp( "texture(@, @)", lightMap, lmCoord );
|
||||
}
|
||||
|
||||
final = new GenOp( "@ * vec4(@.rgb,0)", specMul, lmColor );
|
||||
}
|
||||
|
||||
// If we have a normal map then mask the specular
|
||||
if ( fd.features[MFT_SpecularMap] )
|
||||
{
|
||||
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])
|
||||
{
|
||||
Var *bumpColor = (Var*)LangElement::find( "bumpNormal" );
|
||||
final = new GenOp( "@ * @.a", final, bumpColor );
|
||||
}
|
||||
|
||||
// Add the specular to the final color.
|
||||
// search for color var
|
||||
Var *color = (Var*)LangElement::find( "col" );
|
||||
meta->addStatement( new GenOp( " @.rgb += ( @ ).rgb;\r\n", color, final ) );
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
||||
ShaderFeature::Resources PixelSpecularGLSL::getResources( const MaterialFeatureData &fd )
|
||||
{
|
||||
Resources res;
|
||||
return res;
|
||||
}
|
||||
|
||||
void SpecularMapGLSL::processVert(Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd)
|
||||
{
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
|
|
|||
|
|
@ -27,32 +27,6 @@
|
|||
#include "shaderGen/GLSL/shaderFeatureGLSL.h"
|
||||
#endif
|
||||
|
||||
|
||||
/// A per-pixel specular feature.
|
||||
class PixelSpecularGLSL : public ShaderFeatureGLSL
|
||||
{
|
||||
protected:
|
||||
|
||||
ShaderIncludeDependency mDep;
|
||||
|
||||
public:
|
||||
|
||||
PixelSpecularGLSL();
|
||||
|
||||
virtual void processVert( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd );
|
||||
|
||||
virtual void processPix( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd );
|
||||
|
||||
virtual Resources getResources( const MaterialFeatureData &fd );
|
||||
|
||||
virtual String getName()
|
||||
{
|
||||
return "Pixel Specular";
|
||||
}
|
||||
};
|
||||
|
||||
/// A texture source for the PixSpecular feature
|
||||
class SpecularMapGLSL : public ShaderFeatureGLSL
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ void _initShaderGenGLSL( ShaderGen *shaderGen )
|
|||
FEATUREMGR->registerFeature( MFT_DetailMap, new DetailFeatGLSL );
|
||||
FEATUREMGR->registerFeature( MFT_StaticCubemap, new NamedFeatureGLSL( "Static Cubemap" ) );
|
||||
FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatGLSL );
|
||||
FEATUREMGR->registerFeature( MFT_PixSpecular, new PixelSpecularGLSL );
|
||||
FEATUREMGR->registerFeature( MFT_InvertSmoothness, new NamedFeatureGLSL("Roughest = 1.0"));
|
||||
FEATUREMGR->registerFeature( MFT_SpecularMap, new SpecularMapGLSL );
|
||||
FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatGLSL );
|
||||
|
|
|
|||
|
|
@ -29,92 +29,6 @@
|
|||
#include "gfx/gfxStructs.h"
|
||||
#include "shaderGen/shaderGen.h"
|
||||
|
||||
PixelSpecularHLSL::PixelSpecularHLSL()
|
||||
: mDep(ShaderGen::smCommonShaderPath + String("/lighting.hlsl" ))
|
||||
{
|
||||
addDependency( &mDep );
|
||||
}
|
||||
|
||||
void PixelSpecularHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd )
|
||||
{
|
||||
AssertFatal( fd.features[MFT_RTLighting],
|
||||
"PixelSpecularHLSL requires RTLighting to be enabled!" );
|
||||
|
||||
// Nothing to do here... MFT_RTLighting should have
|
||||
// taken care of passing everything to the pixel shader.
|
||||
}
|
||||
|
||||
void PixelSpecularHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd )
|
||||
{
|
||||
AssertFatal( fd.features[MFT_RTLighting],
|
||||
"PixelSpecularHLSL requires RTLighting to be enabled!" );
|
||||
|
||||
// RTLighting should have spit out the 4 specular
|
||||
// powers for the 4 potential lights on this pass.
|
||||
//
|
||||
// This can sometimes be NULL if RTLighting skips out
|
||||
// on us for lightmaps or missing normals.
|
||||
Var *specular = (Var*)LangElement::find( "specular" );
|
||||
if ( !specular )
|
||||
return;
|
||||
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
LangElement *specMul = new GenOp( "@", specular );
|
||||
LangElement *final = specMul;
|
||||
|
||||
// mask out with lightmap if present
|
||||
if ( fd.features[MFT_LightMap] )
|
||||
{
|
||||
LangElement *lmColor = NULL;
|
||||
|
||||
// find lightmap color
|
||||
lmColor = LangElement::find( "lmColor" );
|
||||
|
||||
if ( !lmColor )
|
||||
{
|
||||
LangElement * lightMap = LangElement::find( "lightMap" );
|
||||
LangElement * lmCoord = LangElement::find( "texCoord2" );
|
||||
LangElement * lightMapTex = LangElement::find("lightMapTex"); //used only DX11 shaders
|
||||
|
||||
if (lightMapTex)
|
||||
lmColor = new GenOp("@.Sample(@, @)", lightMapTex, lightMap, lmCoord);
|
||||
else
|
||||
lmColor = new GenOp("tex2D(@, @)", lightMap, lmCoord);
|
||||
}
|
||||
|
||||
final = new GenOp( "@ * float4(@.rgb,0)", specMul, lmColor );
|
||||
}
|
||||
|
||||
// If we have a normal map then mask the specular
|
||||
if ( fd.features[MFT_SpecularMap] )
|
||||
{
|
||||
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])
|
||||
{
|
||||
Var *bumpColor = (Var*)LangElement::find( "bumpNormal" );
|
||||
final = new GenOp( "@ * @.a", final, bumpColor );
|
||||
}
|
||||
|
||||
// Add the specular to the final color.
|
||||
// search for color var
|
||||
Var *color = (Var*)LangElement::find( "col" );
|
||||
meta->addStatement( new GenOp( " @.rgb += ( @ ).rgb;\r\n", color, final ) );
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
||||
ShaderFeature::Resources PixelSpecularHLSL::getResources( const MaterialFeatureData &fd )
|
||||
{
|
||||
Resources res;
|
||||
return res;
|
||||
}
|
||||
|
||||
void SpecularMapHLSL::processVert(Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd)
|
||||
{
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
|
|
|||
|
|
@ -27,32 +27,6 @@
|
|||
#include "shaderGen/HLSL/shaderFeatureHLSL.h"
|
||||
#endif
|
||||
|
||||
|
||||
/// A per-pixel specular feature.
|
||||
class PixelSpecularHLSL : public ShaderFeatureHLSL
|
||||
{
|
||||
protected:
|
||||
|
||||
ShaderIncludeDependency mDep;
|
||||
|
||||
public:
|
||||
|
||||
PixelSpecularHLSL();
|
||||
|
||||
virtual void processVert( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd );
|
||||
|
||||
virtual void processPix( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd );
|
||||
|
||||
virtual Resources getResources( const MaterialFeatureData &fd );
|
||||
|
||||
virtual String getName()
|
||||
{
|
||||
return "Pixel Specular";
|
||||
}
|
||||
};
|
||||
|
||||
/// A texture source for the PixSpecular feature
|
||||
class SpecularMapHLSL : public ShaderFeatureHLSL
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2952,7 +2952,6 @@ void ReflectionProbeFeatHLSL::processVert(Vector<ShaderComponent*>& componentLis
|
|||
{
|
||||
MultiLine* meta = new MultiLine;
|
||||
output = meta;
|
||||
|
||||
// Also output the worldToTanget transform which
|
||||
// we use to create the world space normal.
|
||||
getOutWorldToTangent(componentList, meta, fd);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ void _initShaderGenHLSL( ShaderGen *shaderGen )
|
|||
FEATUREMGR->registerFeature( MFT_StaticCubemap, new NamedFeatureHLSL( "Static Cubemap" ) );
|
||||
FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_ReflectionProbes, new ReflectionProbeFeatHLSL);
|
||||
FEATUREMGR->registerFeature( MFT_PixSpecular, new PixelSpecularHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_InvertSmoothness, new NamedFeatureHLSL( "Roughest = 1.0" ) );
|
||||
FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureHLSL( "Translucent" ) );
|
||||
FEATUREMGR->registerFeature( MFT_IsTranslucentZWrite, new NamedFeatureHLSL( "Translucent ZWrite" ) );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue