mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-14 04:03:46 +00:00
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:
parent
ec63be32e3
commit
fe5a27906d
24 changed files with 95 additions and 100 deletions
|
|
@ -390,7 +390,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
Parent::processPix( componentList, fd );
|
||||
return;
|
||||
}
|
||||
else if (!fd.features[MFT_SpecularMap] )
|
||||
else if (!fd.features[MFT_PBRConfigMap] )
|
||||
{
|
||||
Var *bumpSample = (Var *)LangElement::find( "bumpSample" );
|
||||
if( bumpSample == NULL )
|
||||
|
|
@ -421,7 +421,7 @@ ShaderFeature::Resources DeferredBumpFeatGLSL::getResources( const MaterialFeatu
|
|||
return Parent::getResources( fd );
|
||||
|
||||
Resources res;
|
||||
if(!fd.features[MFT_SpecularMap])
|
||||
if(!fd.features[MFT_PBRConfigMap])
|
||||
{
|
||||
res.numTex = 1;
|
||||
res.numTexReg = 1;
|
||||
|
|
@ -464,7 +464,7 @@ void DeferredBumpFeatGLSL::setTexData( Material::StageData &stageDat,
|
|||
passData.mTexSlot[texIndex++].texObject = stageDat.getTex(MFT_DetailNormalMap);
|
||||
}
|
||||
}
|
||||
else if (!fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] &&
|
||||
else if (!fd.features[MFT_Parallax] && !fd.features[MFT_PBRConfigMap] &&
|
||||
( fd.features[MFT_DeferredConditioner]) )
|
||||
{
|
||||
passData.mTexType[ texIndex ] = Material::Bump;
|
||||
|
|
|
|||
|
|
@ -56,13 +56,13 @@ void DeferredSpecMapGLSL::processPix( Vector<ShaderComponent*> &componentList, c
|
|||
}
|
||||
|
||||
// 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( "tex2D(@, @)", 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( "tex2D(@, @)", pbrConfigMap, texCoord );
|
||||
|
||||
Var *pbrConfig = (Var*)LangElement::find("PBRConfig");
|
||||
if (!pbrConfig) pbrConfig = new Var("PBRConfig", "vec4");
|
||||
|
|
@ -97,11 +97,11 @@ void DeferredSpecMapGLSL::setTexData( Material::StageData &stageDat,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
Parent::processPix( componentList, fd );
|
||||
return;
|
||||
}
|
||||
else if (!fd.features[MFT_SpecularMap] )
|
||||
else if (!fd.features[MFT_PBRConfigMap] )
|
||||
{
|
||||
Var *bumpSample = (Var *)LangElement::find( "bumpSample" );
|
||||
if( bumpSample == NULL )
|
||||
|
|
@ -454,7 +454,7 @@ ShaderFeature::Resources DeferredBumpFeatHLSL::getResources( const MaterialFeatu
|
|||
return Parent::getResources( fd );
|
||||
|
||||
Resources res;
|
||||
if(!fd.features[MFT_SpecularMap])
|
||||
if(!fd.features[MFT_PBRConfigMap])
|
||||
{
|
||||
res.numTex = 1;
|
||||
res.numTexReg = 1;
|
||||
|
|
@ -497,7 +497,7 @@ void DeferredBumpFeatHLSL::setTexData( Material::StageData &stageDat,
|
|||
passData.mTexSlot[ texIndex++ ].texObject = stageDat.getTex( MFT_DetailNormalMap );
|
||||
}
|
||||
}
|
||||
else if ( !fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] &&
|
||||
else if ( !fd.features[MFT_Parallax] && !fd.features[MFT_PBRConfigMap] &&
|
||||
( fd.features[MFT_DeferredConditioner]) )
|
||||
{
|
||||
passData.mTexType[ texIndex ] = Material::Bump;
|
||||
|
|
|
|||
|
|
@ -56,20 +56,20 @@ void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &componentList, c
|
|||
}
|
||||
|
||||
// create texture var
|
||||
Var *specularMap = new Var;
|
||||
specularMap->setType( "SamplerState" );
|
||||
specularMap->setName( "specularMap" );
|
||||
specularMap->uniform = true;
|
||||
specularMap->sampler = true;
|
||||
specularMap->constNum = Var::getTexUnitNum();
|
||||
Var * pbrConfigMap = new Var;
|
||||
pbrConfigMap->setType( "SamplerState" );
|
||||
pbrConfigMap->setName( "PBRConfigMap" );
|
||||
pbrConfigMap->uniform = true;
|
||||
pbrConfigMap->sampler = true;
|
||||
pbrConfigMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
Var* specularMapTex = new Var;
|
||||
specularMapTex->setName("specularMapTex");
|
||||
specularMapTex->setType("Texture2D");
|
||||
specularMapTex->uniform = true;
|
||||
specularMapTex->texture = true;
|
||||
specularMapTex->constNum = specularMap->constNum;
|
||||
LangElement *texOp = new GenOp(" @.Sample(@, @)", specularMapTex, specularMap, texCoord);
|
||||
Var* pbrConfigMapTex = new Var;
|
||||
pbrConfigMapTex->setName("PBRConfigMapTex");
|
||||
pbrConfigMapTex->setType("Texture2D");
|
||||
pbrConfigMapTex->uniform = true;
|
||||
pbrConfigMapTex->texture = true;
|
||||
pbrConfigMapTex->constNum = pbrConfigMap->constNum;
|
||||
LangElement *texOp = new GenOp(" @.Sample(@, @)", pbrConfigMapTex, pbrConfigMap, texCoord);
|
||||
|
||||
Var * pbrConfig = (Var*)LangElement::find("pbrConfig");
|
||||
if (!pbrConfig) pbrConfig = new Var("pbrConfig", "float4");
|
||||
|
|
@ -103,11 +103,11 @@ void DeferredSpecMapHLSL::setTexData( Material::StageData &stageDat,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -200,4 +200,4 @@ void DeferredEmissiveHLSL::processPix(Vector<ShaderComponent*> &componentList, c
|
|||
}
|
||||
|
||||
output = new GenOp("@ = float4(@.rgb,0);", sceneColorVar, diffuseTargetVar);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,10 +272,10 @@ void Material::initPersistFields()
|
|||
"Used to scale the strength of the detail normal map when blended with the base normal map." );
|
||||
|
||||
addField("smoothness", TypeF32, Offset(mSmoothness, Material), MAX_STAGES,
|
||||
"The degree of smoothness when not using a specularMap." );
|
||||
"The degree of smoothness when not using a PBRConfigMap." );
|
||||
|
||||
addField("metalness", TypeF32, Offset(mMetalness, Material), MAX_STAGES,
|
||||
"The degree of Metalness when not using a specularMap." );
|
||||
"The degree of Metalness when not using a PBRConfigMap." );
|
||||
|
||||
addProtectedField( "accuEnabled", TYPEID< bool >(), Offset( mAccuEnabled, Material ),
|
||||
&_setAccuEnabled, &defaultProtectedGetFn, MAX_STAGES, "Accumulation texture." );
|
||||
|
|
@ -301,7 +301,7 @@ void Material::initPersistFields()
|
|||
addField("invertSmoothness", TypeBool, Offset(mInvertSmoothness, Material), MAX_STAGES,
|
||||
"Treat Smoothness as Roughness");
|
||||
|
||||
addField( "specularMap", TypeImageFilename, Offset(mSpecularMapFilename, Material), MAX_STAGES,
|
||||
addField( "specularMap", TypeImageFilename, Offset(mPBRConfigMapFilename, Material), MAX_STAGES,
|
||||
"Prepacked specular map texture. The RGB channels of this texture provide per-pixel reference values for: "
|
||||
"smoothness (R), Ambient Occlusion (G), and metalness(B)");
|
||||
|
||||
|
|
|
|||
|
|
@ -237,9 +237,9 @@ public:
|
|||
|
||||
bool mIsSRGb[MAX_STAGES];
|
||||
bool mInvertSmoothness[MAX_STAGES];
|
||||
FileName mSpecularMapFilename[MAX_STAGES];
|
||||
StringTableEntry mSpecularMapAssetId[MAX_STAGES];
|
||||
AssetPtr<ImageAsset> mSpecularMapAsset[MAX_STAGES];
|
||||
FileName mPBRConfigMapFilename[MAX_STAGES];
|
||||
StringTableEntry mPBRConfigMapAssetId[MAX_STAGES];
|
||||
AssetPtr<ImageAsset> mPBRConfigMapAsset[MAX_STAGES];
|
||||
FileName mRoughMapFilename[MAX_STAGES];
|
||||
StringTableEntry mRoughMapAssetId[MAX_STAGES];
|
||||
AssetPtr<ImageAsset> mRoughMapAsset[MAX_STAGES];
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ ImplementFeatureType( MFT_DiffuseColor, MFG_Texture, 5.0f, true );
|
|||
ImplementFeatureType( MFT_DiffuseVertColor, MFG_Texture, 6.0f, true );
|
||||
ImplementFeatureType( MFT_AlphaTest, MFG_Texture, 7.0f, true );
|
||||
ImplementFeatureType(MFT_InvertSmoothness, U32(-1), -1, true);
|
||||
ImplementFeatureType( MFT_SpecularMap, MFG_Texture, 8.0f, true );
|
||||
ImplementFeatureType( MFT_PBRConfigMap, MFG_Texture, 8.0f, true );
|
||||
ImplementFeatureType( MFT_NormalMap, MFG_Texture, 9.0f, true );
|
||||
ImplementFeatureType( MFT_DetailNormalMap, MFG_Texture, 10.0f, true );
|
||||
ImplementFeatureType( MFT_Imposter, U32(-1), -1, true );
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ DeclareFeatureType( MFT_VertLitTone );
|
|||
DeclareFeatureType( MFT_StaticCubemap );
|
||||
DeclareFeatureType( MFT_CubeMap );
|
||||
DeclareFeatureType( MFT_InvertSmoothness );
|
||||
DeclareFeatureType( MFT_SpecularMap );
|
||||
DeclareFeatureType( MFT_PBRConfigMap );
|
||||
DeclareFeatureType( MFT_GlossMap );
|
||||
|
||||
DeclareFeatureType( MFT_ReflectionProbes );
|
||||
|
|
|
|||
|
|
@ -472,12 +472,12 @@ void ProcessedMaterial::_setStageData()
|
|||
if (mMaterial->mIsSRGb[i])
|
||||
profile = &GFXStaticTextureSRGBProfile;
|
||||
|
||||
// SpecularMap
|
||||
if (mMaterial->mSpecularMapFilename[i].isNotEmpty())
|
||||
// PBRConfig
|
||||
if (mMaterial->mPBRConfigMapFilename[i].isNotEmpty())
|
||||
{
|
||||
mStages[i].setTex(MFT_SpecularMap, _createTexture(mMaterial->mSpecularMapFilename[i], profile));
|
||||
if (!mStages[i].getTex(MFT_SpecularMap))
|
||||
mMaterial->logError("Failed to load specular map %s for stage %i", _getTexturePath(mMaterial->mSpecularMapFilename[i]).c_str(), i);
|
||||
mStages[i].setTex(MFT_PBRConfigMap, _createTexture(mMaterial->mPBRConfigMapFilename[i], profile));
|
||||
if (!mStages[i].getTex(MFT_PBRConfigMap))
|
||||
mMaterial->logError("Failed to load specular map %s for stage %i", _getTexturePath(mMaterial->mPBRConfigMapFilename[i]).c_str(), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -488,11 +488,11 @@ void ProcessedMaterial::_setStageData()
|
|||
inputKey[1] = mMaterial->mAOChan[i];
|
||||
inputKey[2] = mMaterial->mMetalChan[i];
|
||||
inputKey[3] = NULL;
|
||||
mStages[i].setTex(MFT_SpecularMap, _createCompositeTexture(mMaterial->mRoughMapFilename[i], mMaterial->mAOMapFilename[i],
|
||||
mStages[i].setTex(MFT_PBRConfigMap, _createCompositeTexture(mMaterial->mRoughMapFilename[i], mMaterial->mAOMapFilename[i],
|
||||
mMaterial->mMetalMapFilename[i], "",
|
||||
inputKey, profile));
|
||||
if (!mStages[i].getTex(MFT_SpecularMap))
|
||||
mMaterial->logError("Failed to load specular map %s for stage %i", _getTexturePath(mMaterial->mSpecularMapFilename[i]).c_str(), i);
|
||||
if (!mStages[i].getTex(MFT_PBRConfigMap))
|
||||
mMaterial->logError("Failed to load specular map %s for stage %i", _getTexturePath(mMaterial->mPBRConfigMapFilename[i]).c_str(), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void ShaderConstHandles::init( GFXShader *shader, Vector<CustomShaderFeatureData
|
|||
mDiffuseColorSC = shader->getShaderConstHandle("$diffuseMaterialColor");
|
||||
mTexMatSC = shader->getShaderConstHandle(ShaderGenVars::texMat);
|
||||
mToneMapTexSC = shader->getShaderConstHandle(ShaderGenVars::toneMap);
|
||||
mSpecularColorSC = shader->getShaderConstHandle(ShaderGenVars::specularColor);
|
||||
mPBRConfigSC = shader->getShaderConstHandle(ShaderGenVars::pbrConfig);
|
||||
mSmoothnessSC = shader->getShaderConstHandle(ShaderGenVars::smoothness);
|
||||
mMetalnessSC = shader->getShaderConstHandle(ShaderGenVars::metalness);
|
||||
mAccuScaleSC = shader->getShaderConstHandle("$accuScale");
|
||||
|
|
@ -443,16 +443,16 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
|||
// Without realtime lighting and on lower end
|
||||
// shader models disable the specular map.
|
||||
if ( !fd.features[ MFT_RTLighting ] || shaderVersion == 2.0 )
|
||||
fd.features.removeFeature( MFT_SpecularMap );
|
||||
fd.features.removeFeature( MFT_PBRConfigMap );
|
||||
|
||||
// If we have a specular map then make sure we
|
||||
// have per-pixel specular enabled.
|
||||
if( fd.features[ MFT_SpecularMap ] )
|
||||
if( fd.features[ MFT_PBRConfigMap ] )
|
||||
{
|
||||
// Check for an alpha channel on the specular map. If it has one (and it
|
||||
// has values less than 255) than the artist has put the gloss map into
|
||||
// the alpha channel.
|
||||
if( mStages[stageNum].getTex( MFT_SpecularMap )->mHasTransparency )
|
||||
if( mStages[stageNum].getTex( MFT_PBRConfigMap )->mHasTransparency )
|
||||
fd.features.addFeature( MFT_GlossMap );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
GFXShaderConstHandle* mDiffuseColorSC;
|
||||
GFXShaderConstHandle* mToneMapTexSC;
|
||||
GFXShaderConstHandle* mTexMatSC;
|
||||
GFXShaderConstHandle* mSpecularColorSC;
|
||||
GFXShaderConstHandle* mPBRConfigSC;
|
||||
GFXShaderConstHandle* mSmoothnessSC;
|
||||
GFXShaderConstHandle* mMetalnessSC;
|
||||
GFXShaderConstHandle* mParallaxInfoSC;
|
||||
|
|
|
|||
|
|
@ -635,7 +635,7 @@ void ProcessedDeferredMaterial::_determineFeatures( U32 stageNum,
|
|||
newFeatures.addFeature(MFT_InvertSmoothness);
|
||||
|
||||
// Deferred Shading : Specular
|
||||
if( mStages[stageNum].getTex( MFT_SpecularMap ) )
|
||||
if( mStages[stageNum].getTex( MFT_PBRConfigMap ) )
|
||||
{
|
||||
newFeatures.addFeature( MFT_DeferredSpecMap );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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" ) );
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "gfx/gfxStructs.h"
|
||||
#include "shaderGen/shaderGen.h"
|
||||
|
||||
void SpecularMapHLSL::processVert(Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd)
|
||||
void PBRConfigMapHLSL::processVert(Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd)
|
||||
{
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
|
|
@ -43,26 +43,26 @@ void SpecularMapHLSL::processVert(Vector<ShaderComponent*> &componentList, const
|
|||
output = meta;
|
||||
}
|
||||
|
||||
void SpecularMapHLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
|
||||
void PBRConfigMapHLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
|
||||
{
|
||||
// Get the texture coord.
|
||||
Var *texCoord = getInTexCoord("texCoord", "float2", componentList);
|
||||
|
||||
// create texture var
|
||||
Var *specularMap = new Var;
|
||||
specularMap->setType( "SamplerState" );
|
||||
specularMap->setName( "specularMap" );
|
||||
specularMap->uniform = true;
|
||||
specularMap->sampler = true;
|
||||
specularMap->constNum = Var::getTexUnitNum();
|
||||
Var *pbrConfigMap = new Var;
|
||||
pbrConfigMap->setType( "SamplerState" );
|
||||
pbrConfigMap->setName( "PBRConfigMap" );
|
||||
pbrConfigMap->uniform = true;
|
||||
pbrConfigMap->sampler = true;
|
||||
pbrConfigMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
Var *specularMapTex = new Var;
|
||||
specularMapTex->setName("specularMapTex");
|
||||
specularMapTex->setType("Texture2D");
|
||||
specularMapTex->uniform = true;
|
||||
specularMapTex->texture = true;
|
||||
specularMapTex->constNum = specularMap->constNum;
|
||||
LangElement *texOp = new GenOp("@.Sample(@, @)", specularMapTex, specularMap, texCoord);
|
||||
Var *pbrConfigMapTex = new Var;
|
||||
pbrConfigMapTex->setName("PBRConfigMapTex");
|
||||
pbrConfigMapTex->setType("Texture2D");
|
||||
pbrConfigMapTex->uniform = true;
|
||||
pbrConfigMapTex->texture = true;
|
||||
pbrConfigMapTex->constNum = pbrConfigMap->constNum;
|
||||
LangElement *texOp = new GenOp("@.Sample(@, @)", pbrConfigMapTex, pbrConfigMap, texCoord);
|
||||
|
||||
|
||||
Var * pbrConfig = new Var( "PBRConfig", "float4" );
|
||||
|
|
@ -81,23 +81,23 @@ void SpecularMapHLSL::processPix( Vector<ShaderComponent*> &componentList, const
|
|||
output = meta;
|
||||
}
|
||||
|
||||
ShaderFeature::Resources SpecularMapHLSL::getResources( const MaterialFeatureData &fd )
|
||||
ShaderFeature::Resources PBRConfigMapHLSL::getResources( const MaterialFeatureData &fd )
|
||||
{
|
||||
Resources res;
|
||||
res.numTex = 1;
|
||||
return res;
|
||||
}
|
||||
|
||||
void SpecularMapHLSL::setTexData( Material::StageData &stageDat,
|
||||
void PBRConfigMapHLSL::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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
#include "shaderGen/HLSL/shaderFeatureHLSL.h"
|
||||
#endif
|
||||
|
||||
/// A texture source for the PixSpecular feature
|
||||
class SpecularMapHLSL : public ShaderFeatureHLSL
|
||||
/// A texture source for the PBRConfigMap feature
|
||||
class PBRConfigMapHLSL : public ShaderFeatureHLSL
|
||||
{
|
||||
|
||||
public:
|
||||
|
|
@ -47,7 +47,7 @@ public:
|
|||
|
||||
virtual String getName()
|
||||
{
|
||||
return "Specular Map";
|
||||
return "PBRConfig Map";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1304,7 +1304,7 @@ void LightmapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
lightMapTex->texture = true;
|
||||
lightMapTex->constNum = lightMap->constNum;
|
||||
|
||||
// argh, pixel specular should prob use this too
|
||||
// argh, PBRConfigMap should prob use this too
|
||||
if( fd.features[MFT_NormalMap] )
|
||||
{
|
||||
Var *lmColor = new Var;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ void _initShaderGenHLSL( ShaderGen *shaderGen )
|
|||
FEATUREMGR->registerFeature( MFT_IsTranslucentZWrite, new NamedFeatureHLSL( "Translucent ZWrite" ) );
|
||||
FEATUREMGR->registerFeature( MFT_Visibility, new VisibilityFeatHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_Fog, new FogFeatHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_SpecularMap, new SpecularMapHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_PBRConfigMap, new PBRConfigMapHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_AccuMap, new AccuTexFeatHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_GlossMap, new NamedFeatureHLSL( "Gloss Map" ) );
|
||||
FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureHLSL( "Lightbuffer MRT" ) );
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ const String ShaderGenVars::vectorLightDirection("$vectorLightDirection");
|
|||
const String ShaderGenVars::vectorLightColor("$vectorLightColor");
|
||||
const String ShaderGenVars::vectorLightBrightness("$vectorLightBrightness");
|
||||
|
||||
const String ShaderGenVars::specularColor("$specularColor");
|
||||
const String ShaderGenVars::pbrConfig("$pbrConfig");
|
||||
const String ShaderGenVars::smoothness("$smoothness");
|
||||
const String ShaderGenVars::metalness("$metalness");
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ struct ShaderGenVars
|
|||
const static String vectorLightColor;
|
||||
const static String vectorLightBrightness;
|
||||
|
||||
const static String specularColor;
|
||||
const static String pbrConfig;
|
||||
const static String smoothness;
|
||||
const static String metalness;
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ ColladaAppMaterial::ColladaAppMaterial(const domMaterial *pMat)
|
|||
// Get the <profile_COMMON>, <diffuse> and <specular> elements
|
||||
const domProfile_COMMON* commonProfile = ColladaUtils::findEffectCommonProfile(effect);
|
||||
const domCommon_color_or_texture_type_complexType* domDiffuse = findEffectDiffuse(effect);
|
||||
const domCommon_color_or_texture_type_complexType* domSpecular = findEffectSpecular(effect);
|
||||
|
||||
// Wrap flags
|
||||
if (effectExt->wrapU)
|
||||
|
|
@ -158,7 +157,6 @@ ColladaAppMaterial::ColladaAppMaterial(const domMaterial *pMat)
|
|||
// Get the paths for the various textures => Collada indirection at its finest!
|
||||
// <texture>.<newparam>.<sampler2D>.<source>.<newparam>.<surface>.<init_from>.<image>.<init_from>
|
||||
diffuseMap = getSamplerImagePath(effect, getTextureSampler(effect, domDiffuse));
|
||||
specularMap = getSamplerImagePath(effect, getTextureSampler(effect, domSpecular));
|
||||
normalMap = getSamplerImagePath(effect, effectExt->bumpSampler);
|
||||
|
||||
// Set the material name
|
||||
|
|
@ -218,7 +216,6 @@ Material *ColladaAppMaterial::createMaterial(const Torque::Path& path) const
|
|||
|
||||
newMat->mDiffuseMapFilename[0] = diffuseMap;
|
||||
newMat->mNormalMapFilename[0] = normalMap;
|
||||
newMat->mSpecularMapFilename[0] = specularMap;
|
||||
|
||||
newMat->mDiffuse[0] = diffuseColor;
|
||||
newMat->mSmoothness[0] = smoothness;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ public:
|
|||
// Settings extracted from the Collada file, and optionally saved to materials.cs
|
||||
String diffuseMap;
|
||||
String normalMap;
|
||||
String specularMap;
|
||||
|
||||
LinearColorF diffuseColor;
|
||||
LinearColorF specularColor;
|
||||
|
|
|
|||
|
|
@ -499,7 +499,6 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false)
|
|||
|
||||
copySketchupTexture(path, mat->mDiffuseMapFilename[0]);
|
||||
copySketchupTexture(path, mat->mNormalMapFilename[0]);
|
||||
copySketchupTexture(path, mat->mSpecularMapFilename[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue