backend specularMap to PBRConfigMap alts.

left:
     addField( "specularMap", TypeImageFilename, Offset(mPBRConfigMapFilename, Material), MAX_STAGES,
scripthook till last since that *will* break all current materials.
This commit is contained in:
AzaezelX 2019-10-16 15:51:02 -05:00
parent ec63be32e3
commit fe5a27906d
24 changed files with 95 additions and 100 deletions

View file

@ -29,7 +29,7 @@
#include "gfx/gfxStructs.h"
#include "shaderGen/shaderGen.h"
void SpecularMapGLSL::processVert(Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd)
void PBRConfigMapGLSL::processVert(Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd)
{
MultiLine *meta = new MultiLine;
@ -43,19 +43,19 @@ void SpecularMapGLSL::processVert(Vector<ShaderComponent*> &componentList, const
output = meta;
}
void SpecularMapGLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
void PBRConfigMapGLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
{
// Get the texture coord.
Var *texCoord = getInTexCoord( "texCoord", "vec2", componentList );
// create texture var
Var *specularMap = new Var;
specularMap->setType( "sampler2D" );
specularMap->setName( "specularMap" );
specularMap->uniform = true;
specularMap->sampler = true;
specularMap->constNum = Var::getTexUnitNum();
LangElement *texOp = new GenOp( "texture(@, @)", specularMap, texCoord );
Var *pbrConfigMap = new Var;
pbrConfigMap->setType( "sampler2D" );
pbrConfigMap->setName( "PBRConfigMap" );
pbrConfigMap->uniform = true;
pbrConfigMap->sampler = true;
pbrConfigMap->constNum = Var::getTexUnitNum();
LangElement *texOp = new GenOp( "texture(@, @)", pbrConfigMap, texCoord );
Var * pbrConfig = new Var( "PBRConfig", "vec4" );
Var *metalness = (Var*)LangElement::find("metalness");
@ -74,23 +74,23 @@ void SpecularMapGLSL::processPix( Vector<ShaderComponent*> &componentList, const
output = meta;
}
ShaderFeature::Resources SpecularMapGLSL::getResources( const MaterialFeatureData &fd )
ShaderFeature::Resources PBRConfigMapGLSL::getResources( const MaterialFeatureData &fd )
{
Resources res;
res.numTex = 1;
return res;
}
void SpecularMapGLSL::setTexData( Material::StageData &stageDat,
void PBRConfigMapGLSL::setTexData( Material::StageData &stageDat,
const MaterialFeatureData &fd,
RenderPassData &passData,
U32 &texIndex )
{
GFXTextureObject *tex = stageDat.getTex( MFT_SpecularMap );
GFXTextureObject *tex = stageDat.getTex( MFT_PBRConfigMap );
if ( tex )
{
passData.mTexType[ texIndex ] = Material::Standard;
passData.mSamplerNames[ texIndex ] = "specularMap";
passData.mSamplerNames[ texIndex ] = "PBRConfigMap";
passData.mTexSlot[ texIndex++ ].texObject = tex;
}
}

View file

@ -28,7 +28,7 @@
#endif
/// A texture source for the PixSpecular feature
class SpecularMapGLSL : public ShaderFeatureGLSL
class PBRConfigMapGLSL : public ShaderFeatureGLSL
{
public:
@ -47,7 +47,7 @@ public:
virtual String getName()
{
return "Specular Map";
return "PBRConfig Map";
}
};

View file

@ -66,7 +66,7 @@ void _initShaderGenGLSL( ShaderGen *shaderGen )
FEATUREMGR->registerFeature( MFT_StaticCubemap, new NamedFeatureGLSL( "Static Cubemap" ) );
FEATUREMGR->registerFeature( MFT_CubeMap, new ReflectCubeFeatGLSL );
FEATUREMGR->registerFeature( MFT_InvertSmoothness, new NamedFeatureGLSL("Roughest = 1.0"));
FEATUREMGR->registerFeature( MFT_SpecularMap, new SpecularMapGLSL );
FEATUREMGR->registerFeature( MFT_PBRConfigMap, new PBRConfigMapGLSL );
FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatGLSL );
FEATUREMGR->registerFeature( MFT_GlossMap, new NamedFeatureGLSL( "Gloss Map" ) );
FEATUREMGR->registerFeature( MFT_IsTranslucent, new NamedFeatureGLSL( "Translucent" ) );