mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-20 11:55:33 +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
e621e362f4
commit
65cbf49c4a
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue