strip out unused pixspecular to cut down on sources of confusion

This commit is contained in:
AzaezelX 2019-05-05 20:10:14 -05:00
parent 8d2d357948
commit 54cf07fa94
22 changed files with 12 additions and 534 deletions

View file

@ -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;

View file

@ -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
{

View file

@ -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 );