mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
shift pbrconfig to ORM
This commit is contained in:
parent
22b0785c73
commit
0c7811bd1a
54 changed files with 879 additions and 680 deletions
|
|
@ -49,7 +49,7 @@ namespace
|
|||
FEATUREMGR->registerFeature( MFT_TerrainLightMap, new TerrainLightMapFeatGLSL );
|
||||
FEATUREMGR->registerFeature( MFT_TerrainSideProject, new NamedFeatureGLSL( "Terrain Side Projection" ) );
|
||||
FEATUREMGR->registerFeature( MFT_TerrainAdditive, new TerrainAdditiveFeatGLSL );
|
||||
FEATUREMGR->registerFeature( MFT_TerrainCompositeMap, new TerrainCompositeMapFeatGLSL );
|
||||
FEATUREMGR->registerFeature( MFT_TerrainORMMap, new TerrainORMMapFeatGLSL );
|
||||
FEATUREMGR->registerFeature( MFT_DeferredTerrainBlankInfoMap, new TerrainBlankInfoMapFeatGLSL );
|
||||
}
|
||||
|
||||
|
|
@ -142,22 +142,22 @@ Var* TerrainFeatGLSL::_getNormalMapTex()
|
|||
return normalMap;
|
||||
}
|
||||
|
||||
Var* TerrainFeatGLSL::_getCompositeMapTex()
|
||||
Var* TerrainFeatGLSL::_getORMConfigMapTex()
|
||||
{
|
||||
String name(String::ToString("compositeMap%d", getProcessIndex()));
|
||||
Var *compositeMap = (Var*)LangElement::find(name);
|
||||
String name(String::ToString("ormConfigMap%d", getProcessIndex()));
|
||||
Var *ormConfigMap = (Var*)LangElement::find(name);
|
||||
|
||||
if (!compositeMap)
|
||||
if (!ormConfigMap)
|
||||
{
|
||||
compositeMap = new Var;
|
||||
compositeMap->setType("sampler2D");
|
||||
compositeMap->setName(name);
|
||||
compositeMap->uniform = true;
|
||||
compositeMap->sampler = true;
|
||||
compositeMap->constNum = Var::getTexUnitNum();
|
||||
ormConfigMap = new Var;
|
||||
ormConfigMap->setType("sampler2D");
|
||||
ormConfigMap->setName(name);
|
||||
ormConfigMap->uniform = true;
|
||||
ormConfigMap->sampler = true;
|
||||
ormConfigMap->constNum = Var::getTexUnitNum();
|
||||
}
|
||||
|
||||
return compositeMap;
|
||||
return ormConfigMap;
|
||||
}
|
||||
|
||||
Var* TerrainFeatGLSL::_getDetailIdStrengthParallax()
|
||||
|
|
@ -1140,7 +1140,7 @@ void TerrainAdditiveFeatGLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
//.b = specular strength, a= spec power.
|
||||
|
||||
|
||||
void TerrainCompositeMapFeatGLSL::processVert(Vector<ShaderComponent*> &componentList,
|
||||
void TerrainORMMapFeatGLSL::processVert(Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd)
|
||||
{
|
||||
const S32 detailIndex = getProcessIndex();
|
||||
|
|
@ -1230,12 +1230,12 @@ void TerrainCompositeMapFeatGLSL::processVert(Vector<ShaderComponent*> &componen
|
|||
output = meta;
|
||||
}
|
||||
|
||||
U32 TerrainCompositeMapFeatGLSL::getOutputTargets(const MaterialFeatureData &fd) const
|
||||
U32 TerrainORMMapFeatGLSL::getOutputTargets(const MaterialFeatureData &fd) const
|
||||
{
|
||||
return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 : ShaderFeature::RenderTarget1;
|
||||
}
|
||||
|
||||
void TerrainCompositeMapFeatGLSL::processPix(Vector<ShaderComponent*> &componentList,
|
||||
void TerrainORMMapFeatGLSL::processPix(Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd)
|
||||
{
|
||||
/// Get the texture coord.
|
||||
|
|
@ -1243,7 +1243,7 @@ void TerrainCompositeMapFeatGLSL::processPix(Vector<ShaderComponent*> &component
|
|||
Var *inTex = getVertTexCoord("texCoord");
|
||||
|
||||
const S32 compositeIndex = getProcessIndex();
|
||||
Var *compositeMap = _getCompositeMapTex();
|
||||
Var *ormConfigMap = _getORMConfigMapTex();
|
||||
// Sample the normal map.
|
||||
//
|
||||
// We take two normal samples and lerp between them for
|
||||
|
|
@ -1253,28 +1253,28 @@ void TerrainCompositeMapFeatGLSL::processPix(Vector<ShaderComponent*> &component
|
|||
if (fd.features.hasFeature(MFT_TerrainSideProject, compositeIndex))
|
||||
{
|
||||
texOp = new GenOp("lerp( tex2D( @, @.yz ), tex2D( @, @.xz ), @.z )",
|
||||
compositeMap, inDet, compositeMap, inDet, inTex);
|
||||
ormConfigMap, inDet, ormConfigMap, inDet, inTex);
|
||||
}
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @.xy)", compositeMap, inDet);
|
||||
texOp = new GenOp("tex2D(@, @.xy)", ormConfigMap, inDet);
|
||||
|
||||
// search for material var
|
||||
Var * pbrConfig;
|
||||
Var * ormConfig;
|
||||
OutputTarget targ = RenderTarget1;
|
||||
if (fd.features[MFT_isDeferred])
|
||||
{
|
||||
targ = RenderTarget2;
|
||||
}
|
||||
pbrConfig = (Var*)LangElement::find(getOutputTargetVarName(targ));
|
||||
ormConfig = (Var*)LangElement::find(getOutputTargetVarName(targ));
|
||||
|
||||
MultiLine * meta = new MultiLine;
|
||||
if (!pbrConfig)
|
||||
if (!ormConfig)
|
||||
{
|
||||
// create color var
|
||||
pbrConfig = new Var;
|
||||
pbrConfig->setType("fragout");
|
||||
pbrConfig->setName(getOutputTargetVarName(targ));
|
||||
pbrConfig->setStructName("OUT");
|
||||
ormConfig = new Var;
|
||||
ormConfig->setType("fragout");
|
||||
ormConfig->setName(getOutputTargetVarName(targ));
|
||||
ormConfig->setStructName("OUT");
|
||||
}
|
||||
|
||||
Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));
|
||||
|
|
@ -1287,23 +1287,23 @@ void TerrainCompositeMapFeatGLSL::processPix(Vector<ShaderComponent*> &component
|
|||
if (priorComp)
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = @.rgb*@;\r\n", new DecOp(matinfoCol), texOp, detailBlend));
|
||||
meta->addStatement(new GenOp(" @.bga += @;\r\n", pbrConfig, matinfoCol));
|
||||
meta->addStatement(new GenOp(" @.gba += @;\r\n", ormConfig, matinfoCol));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = lerp(vec3(0,1,0),@.rgb,@);\r\n", new DecOp(matinfoCol), texOp, detailBlend));
|
||||
meta->addStatement(new GenOp(" @ = vec4(0.0,@);\r\n", pbrConfig, matinfoCol));
|
||||
meta->addStatement(new GenOp(" @ = lerp(vec3(1.0,1.0,0.0),@.rgb,@);\r\n", new DecOp(matinfoCol), texOp, detailBlend));
|
||||
meta->addStatement(new GenOp(" @ = vec4(0.0,@);\r\n", ormConfig, matinfoCol));
|
||||
}
|
||||
|
||||
if (!fd.features[MFT_InvertSmoothness])
|
||||
if (fd.features[MFT_InvertRoughness])
|
||||
{
|
||||
meta->addStatement(new GenOp(" @.b = 1.0-@.b;\r\n", pbrConfig, pbrConfig));
|
||||
meta->addStatement(new GenOp(" @.b = 1.0-@.b;\r\n", ormConfig, ormConfig));
|
||||
}
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
||||
ShaderFeature::Resources TerrainCompositeMapFeatGLSL::getResources(const MaterialFeatureData &fd)
|
||||
ShaderFeature::Resources TerrainORMMapFeatGLSL::getResources(const MaterialFeatureData &fd)
|
||||
{
|
||||
Resources res;
|
||||
res.numTex = 1;
|
||||
|
|
@ -1340,7 +1340,7 @@ void TerrainBlankInfoMapFeatGLSL::processPix(Vector<ShaderComponent*> &component
|
|||
material->setStructName("OUT");
|
||||
}
|
||||
|
||||
meta->addStatement(new GenOp(" @ = vec4(0.0,0.0,1.0,0);\r\n", material));
|
||||
meta->addStatement(new GenOp(" @ = vec4(0.0,1.0,1.0,0.0);\r\n", material));
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
Var* _getNormalMapTex();
|
||||
|
||||
Var* _getCompositeMapTex();
|
||||
Var* _getORMConfigMapTex();
|
||||
|
||||
static Var* _getUniformVar( const char *name, const char *type, ConstantSortPosition csp );
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ public:
|
|||
virtual String getName() { return "Terrain Additive"; }
|
||||
};
|
||||
|
||||
class TerrainCompositeMapFeatGLSL : public TerrainFeatGLSL
|
||||
class TerrainORMMapFeatGLSL : public TerrainFeatGLSL
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace
|
|||
FEATUREMGR->registerFeature( MFT_TerrainLightMap, new TerrainLightMapFeatHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_TerrainSideProject, new NamedFeatureHLSL( "Terrain Side Projection" ) );
|
||||
FEATUREMGR->registerFeature( MFT_TerrainAdditive, new TerrainAdditiveFeatHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_TerrainCompositeMap, new TerrainCompositeMapFeatHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_TerrainORMMap, new TerrainORMMapFeatHLSL );
|
||||
FEATUREMGR->registerFeature( MFT_DeferredTerrainBlankInfoMap, new TerrainBlankInfoMapFeatHLSL );
|
||||
}
|
||||
};
|
||||
|
|
@ -141,22 +141,22 @@ Var* TerrainFeatHLSL::_getNormalMapTex()
|
|||
return normalMap;
|
||||
}
|
||||
|
||||
Var* TerrainFeatHLSL::_getCompositeMapTex()
|
||||
Var* TerrainFeatHLSL::_getORMConfigMapTex()
|
||||
{
|
||||
String name(String::ToString("compositeMap%d", getProcessIndex()));
|
||||
Var *compositeMap = (Var*)LangElement::find(name);
|
||||
String name(String::ToString("ormConfigMap%d", getProcessIndex()));
|
||||
Var *ormConfigMap = (Var*)LangElement::find(name);
|
||||
|
||||
if (!compositeMap)
|
||||
if (!ormConfigMap)
|
||||
{
|
||||
compositeMap = new Var;
|
||||
compositeMap->setType("SamplerState");
|
||||
compositeMap->setName(name);
|
||||
compositeMap->uniform = true;
|
||||
compositeMap->sampler = true;
|
||||
compositeMap->constNum = Var::getTexUnitNum();
|
||||
ormConfigMap = new Var;
|
||||
ormConfigMap->setType("SamplerState");
|
||||
ormConfigMap->setName(name);
|
||||
ormConfigMap->uniform = true;
|
||||
ormConfigMap->sampler = true;
|
||||
ormConfigMap->constNum = Var::getTexUnitNum();
|
||||
}
|
||||
|
||||
return compositeMap;
|
||||
return ormConfigMap;
|
||||
}
|
||||
|
||||
Var* TerrainFeatHLSL::_getDetailIdStrengthParallax()
|
||||
|
|
@ -1148,7 +1148,7 @@ void TerrainAdditiveFeatHLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
//standard matInfo map contains data of the form .r = bitflags, .g = (will contain AO),
|
||||
//.b = specular strength, a= spec power.
|
||||
|
||||
void TerrainCompositeMapFeatHLSL::processVert(Vector<ShaderComponent*> &componentList,
|
||||
void TerrainORMMapFeatHLSL::processVert(Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd)
|
||||
{
|
||||
const S32 detailIndex = getProcessIndex();
|
||||
|
|
@ -1238,12 +1238,12 @@ void TerrainCompositeMapFeatHLSL::processVert(Vector<ShaderComponent*> &componen
|
|||
output = meta;
|
||||
}
|
||||
|
||||
U32 TerrainCompositeMapFeatHLSL::getOutputTargets(const MaterialFeatureData &fd) const
|
||||
U32 TerrainORMMapFeatHLSL::getOutputTargets(const MaterialFeatureData &fd) const
|
||||
{
|
||||
return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 : ShaderFeature::DefaultTarget;
|
||||
}
|
||||
|
||||
void TerrainCompositeMapFeatHLSL::processPix(Vector<ShaderComponent*> &componentList,
|
||||
void TerrainORMMapFeatHLSL::processPix(Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd)
|
||||
{
|
||||
/// Get the texture coord.
|
||||
|
|
@ -1251,48 +1251,48 @@ void TerrainCompositeMapFeatHLSL::processPix(Vector<ShaderComponent*> &component
|
|||
Var *inTex = getVertTexCoord("texCoord");
|
||||
|
||||
const S32 compositeIndex = getProcessIndex();
|
||||
Var *compositeMap = _getCompositeMapTex();
|
||||
Var *ormConfigMap = _getORMConfigMapTex();
|
||||
// Sample the normal map.
|
||||
//
|
||||
// We take two normal samples and lerp between them for
|
||||
// side projection layers... else a single sample.
|
||||
LangElement *texOp;
|
||||
String name(String::ToString("compositeMapTex%d", getProcessIndex()));
|
||||
Var *compositeMapTex = (Var*)LangElement::find(name);
|
||||
if (!compositeMapTex)
|
||||
String name(String::ToString("ormConfigMapTex%d", getProcessIndex()));
|
||||
Var *ormConfigMapTex = (Var*)LangElement::find(name);
|
||||
if (!ormConfigMapTex)
|
||||
{
|
||||
compositeMapTex = new Var;
|
||||
compositeMapTex->setName(String::ToString("compositeMapTex%d", getProcessIndex()));
|
||||
compositeMapTex->setType("Texture2D");
|
||||
compositeMapTex->uniform = true;
|
||||
compositeMapTex->texture = true;
|
||||
compositeMapTex->constNum = compositeMap->constNum;
|
||||
ormConfigMapTex = new Var;
|
||||
ormConfigMapTex->setName(String::ToString("ormConfigMapTex%d", getProcessIndex()));
|
||||
ormConfigMapTex->setType("Texture2D");
|
||||
ormConfigMapTex->uniform = true;
|
||||
ormConfigMapTex->texture = true;
|
||||
ormConfigMapTex->constNum = ormConfigMap->constNum;
|
||||
}
|
||||
if (fd.features.hasFeature(MFT_TerrainSideProject, compositeIndex))
|
||||
{
|
||||
texOp = new GenOp("lerp( @.Sample( @, @.yz ), @.Sample( @, @.xz ), @.z )",
|
||||
compositeMapTex, compositeMap, inDet, compositeMapTex, compositeMap, inDet, inTex);
|
||||
ormConfigMapTex, ormConfigMap, inDet, ormConfigMapTex, ormConfigMap, inDet, inTex);
|
||||
}
|
||||
else
|
||||
texOp = new GenOp("@.Sample(@, @.xy)", compositeMapTex, compositeMap, inDet);
|
||||
texOp = new GenOp("@.Sample(@, @.xy)", ormConfigMapTex, ormConfigMap, inDet);
|
||||
|
||||
// search for material var
|
||||
Var * pbrConfig;
|
||||
Var * ormConfig;
|
||||
OutputTarget targ = DefaultTarget;
|
||||
if (fd.features[MFT_isDeferred])
|
||||
{
|
||||
targ = RenderTarget2;
|
||||
}
|
||||
pbrConfig = (Var*)LangElement::find(getOutputTargetVarName(targ));
|
||||
ormConfig = (Var*)LangElement::find(getOutputTargetVarName(targ));
|
||||
|
||||
MultiLine * meta = new MultiLine;
|
||||
if (!pbrConfig)
|
||||
if (!ormConfig)
|
||||
{
|
||||
// create color var
|
||||
pbrConfig = new Var;
|
||||
pbrConfig->setType("fragout");
|
||||
pbrConfig->setName(getOutputTargetVarName(targ));
|
||||
pbrConfig->setStructName("OUT");
|
||||
ormConfig = new Var;
|
||||
ormConfig->setType("fragout");
|
||||
ormConfig->setName(getOutputTargetVarName(targ));
|
||||
ormConfig->setStructName("OUT");
|
||||
}
|
||||
|
||||
Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));
|
||||
|
|
@ -1305,23 +1305,23 @@ void TerrainCompositeMapFeatHLSL::processPix(Vector<ShaderComponent*> &component
|
|||
if (priorComp)
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = @.rgb*@;\r\n", new DecOp(matinfoCol), texOp, detailBlend));
|
||||
meta->addStatement(new GenOp(" @.bga += @;\r\n", pbrConfig, matinfoCol));
|
||||
meta->addStatement(new GenOp(" @.gba += @;\r\n", ormConfig, matinfoCol));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = lerp(float3(0,1,0),@.rgb,@);\r\n", new DecOp(matinfoCol), texOp, detailBlend));
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0,@);\r\n", pbrConfig, matinfoCol));
|
||||
meta->addStatement(new GenOp(" @ = lerp(float3(1.0,1.0,0.0),@.rgb,@);\r\n", new DecOp(matinfoCol), texOp, detailBlend));
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0,@);\r\n", ormConfig, matinfoCol));
|
||||
}
|
||||
|
||||
if (!fd.features[MFT_InvertSmoothness])
|
||||
if (fd.features[MFT_InvertRoughness])
|
||||
{
|
||||
meta->addStatement(new GenOp(" @.b = 1.0-@.b;\r\n", pbrConfig, pbrConfig));
|
||||
meta->addStatement(new GenOp(" @.b = 1.0-@.b;\r\n", ormConfig, ormConfig));
|
||||
}
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
||||
ShaderFeature::Resources TerrainCompositeMapFeatHLSL::getResources(const MaterialFeatureData &fd)
|
||||
ShaderFeature::Resources TerrainORMMapFeatHLSL::getResources(const MaterialFeatureData &fd)
|
||||
{
|
||||
Resources res;
|
||||
res.numTex = 1;
|
||||
|
|
@ -1356,7 +1356,7 @@ void TerrainBlankInfoMapFeatHLSL::processPix(Vector<ShaderComponent*> &component
|
|||
material->setStructName("OUT");
|
||||
}
|
||||
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0,0.0,1.0,0);\r\n", material));
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0,1.0,1.0,0.0);\r\n", material));
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
Var* _getInMacroCoord(Vector<ShaderComponent*> &componentList );
|
||||
|
||||
Var* _getNormalMapTex();
|
||||
Var* _getCompositeMapTex();
|
||||
Var* _getORMConfigMapTex();
|
||||
|
||||
static Var* _getUniformVar( const char *name, const char *type, ConstantSortPosition csp );
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ public:
|
|||
virtual String getName() { return "Terrain Additive"; }
|
||||
};
|
||||
|
||||
class TerrainCompositeMapFeatHLSL : public TerrainFeatHLSL
|
||||
class TerrainORMMapFeatHLSL : public TerrainFeatHLSL
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ Vector<String> _initSamplerNames()
|
|||
samplerNames.push_back(avar("$normalMap%d",i));
|
||||
samplerNames.push_back(avar("$detailMap%d",i));
|
||||
//samplerNames.push_back(avar("$macroMap%d", i));
|
||||
samplerNames.push_back(avar("$compositeMap%d", i));
|
||||
samplerNames.push_back(avar("$ormConfigMap%d", i));
|
||||
}
|
||||
|
||||
return samplerNames;
|
||||
|
|
@ -151,9 +151,9 @@ void TerrainCellMaterial::_updateDefaultAnisotropy()
|
|||
desc.samplers[sampler].minFilter = GFXTextureFilterLinear;
|
||||
}
|
||||
|
||||
if (matInfo->compositeTexConst->isValid())
|
||||
if (matInfo->ormTexConst->isValid())
|
||||
{
|
||||
const S32 sampler = matInfo->compositeTexConst->getSamplerRegister();
|
||||
const S32 sampler = matInfo->ormTexConst->getSamplerRegister();
|
||||
|
||||
if (maxAnisotropy > 1)
|
||||
{
|
||||
|
|
@ -439,15 +439,15 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
|||
features.addFeature(MFT_isDeferred, featureIndex);
|
||||
features.addFeature( MFT_TerrainDetailMap, featureIndex );
|
||||
|
||||
if (!(mat->getCompositeMap().isEmpty()))
|
||||
if (!(mat->getORMConfigMap().isEmpty()))
|
||||
{
|
||||
if (deferredMat)
|
||||
features.addFeature(MFT_isDeferred, featureIndex);
|
||||
features.addFeature(MFT_TerrainCompositeMap, featureIndex);
|
||||
features.addFeature(MFT_TerrainORMMap, featureIndex);
|
||||
features.removeFeature(MFT_DeferredTerrainBlankInfoMap);
|
||||
}
|
||||
if (mat->getInvertSmoothness())
|
||||
features.addFeature(MFT_InvertSmoothness);
|
||||
if (mat->getInvertRoughness())
|
||||
features.addFeature(MFT_InvertRoughness);
|
||||
|
||||
pass->materials.push_back( (*materials)[i] );
|
||||
normalMaps.increment();
|
||||
|
|
@ -638,16 +638,16 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
|||
&GFXStaticTextureProfile, "TerrainCellMaterial::_createPass() - DetailMap" );
|
||||
}
|
||||
|
||||
matInfo->compositeTexConst = pass->shader->getShaderConstHandle(avar("$compositeMap%d", i));
|
||||
if (matInfo->compositeTexConst->isValid())
|
||||
matInfo->ormTexConst = pass->shader->getShaderConstHandle(avar("$ormConfigMap%d", i));
|
||||
if (matInfo->ormTexConst->isValid())
|
||||
{
|
||||
GFXTextureProfile* profile = &GFXStaticTextureProfile;
|
||||
if (matInfo->mat->getIsSRGB())
|
||||
profile = &GFXStaticTextureSRGBProfile;
|
||||
|
||||
matInfo->compositeTex.set(matInfo->mat->getCompositeMap(),
|
||||
matInfo->ormTex.set(matInfo->mat->getORMConfigMap(),
|
||||
profile, "TerrainCellMaterial::_createPass() - CompositeMap");
|
||||
const S32 sampler = matInfo->compositeTexConst->getSamplerRegister();
|
||||
const S32 sampler = matInfo->ormTexConst->getSamplerRegister();
|
||||
|
||||
desc.samplers[sampler] = GFXSamplerStateDesc::getWrapLinear();
|
||||
desc.samplers[sampler].magFilter = GFXTextureFilterLinear;
|
||||
|
|
@ -859,8 +859,8 @@ bool TerrainCellMaterial::setupPass( const SceneRenderState *state,
|
|||
GFX->setTexture( matInfo->macroTexConst->getSamplerRegister(), matInfo->macroTex );
|
||||
if ( matInfo->normalTexConst->isValid() )
|
||||
GFX->setTexture( matInfo->normalTexConst->getSamplerRegister(), matInfo->normalTex );
|
||||
if ( matInfo->compositeTexConst->isValid() )
|
||||
GFX->setTexture( matInfo->compositeTexConst->getSamplerRegister(), matInfo->compositeTex );
|
||||
if ( matInfo->ormTexConst->isValid() )
|
||||
GFX->setTexture( matInfo->ormTexConst->getSamplerRegister(), matInfo->ormTex );
|
||||
}
|
||||
|
||||
pass.consts->setSafe( pass.layerSizeConst, (F32)mTerrain->mLayerTex.getWidth() );
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ protected:
|
|||
|
||||
MaterialInfo()
|
||||
:mat(NULL), layerId(0), detailTexConst(NULL), macroTexConst(NULL), normalTexConst(NULL),
|
||||
compositeTexConst(NULL), detailInfoVConst(NULL), detailInfoPConst(NULL), macroInfoVConst(NULL), macroInfoPConst(NULL)
|
||||
ormTexConst(NULL), detailInfoVConst(NULL), detailInfoPConst(NULL), macroInfoVConst(NULL), macroInfoPConst(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -79,8 +79,8 @@ protected:
|
|||
GFXShaderConstHandle *normalTexConst;
|
||||
GFXTexHandle normalTex;
|
||||
|
||||
GFXShaderConstHandle *compositeTexConst;
|
||||
GFXTexHandle compositeTex;
|
||||
GFXShaderConstHandle *ormTexConst;
|
||||
GFXTexHandle ormTex;
|
||||
|
||||
GFXShaderConstHandle *detailInfoVConst;
|
||||
GFXShaderConstHandle *detailInfoPConst;
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@ ImplementFeatureType( MFT_TerrainSideProject, MFG_Texture, 106.0f, false );
|
|||
ImplementFeatureType( MFT_TerrainAdditive, MFG_PostProcess, 999.0f, false );
|
||||
//Deferred Shading
|
||||
ImplementFeatureType( MFT_DeferredTerrainBlankInfoMap, MFG_Texture, 104.1f, false);
|
||||
ImplementFeatureType( MFT_TerrainCompositeMap, MFG_Texture, 104.2f, false);
|
||||
ImplementFeatureType( MFT_TerrainORMMap, MFG_Texture, 104.2f, false);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ DeclareFeatureType( MFT_TerrainLightMap );
|
|||
DeclareFeatureType( MFT_TerrainSideProject );
|
||||
DeclareFeatureType( MFT_TerrainAdditive );
|
||||
//Deferred Shading
|
||||
DeclareFeatureType( MFT_TerrainCompositeMap );
|
||||
DeclareFeatureType( MFT_TerrainORMMap );
|
||||
DeclareFeatureType( MFT_DeferredTerrainBlankInfoMap );
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ TerrainMaterial::TerrainMaterial()
|
|||
mMacroDistance( 500.0f ),
|
||||
mParallaxScale( 0.0f ),
|
||||
mIsSRGB(false),
|
||||
mInvertSmoothness(false)
|
||||
mInvertRoughness(false)
|
||||
{
|
||||
initMapSlot(DiffuseMap);
|
||||
initMapSlot(NormalMap);
|
||||
|
|
|
|||
|
|
@ -49,13 +49,10 @@ protected:
|
|||
F32 mDiffuseSize;
|
||||
|
||||
///
|
||||
FileName mNormalMap;
|
||||
DECLARE_TEXTUREMAP(NormalMap);
|
||||
|
||||
///
|
||||
FileName mDetailMap;
|
||||
|
||||
///
|
||||
FileName mCompositeMap;
|
||||
DECLARE_TEXTUREMAP(DetailMap);
|
||||
|
||||
/// The size of the detail map in meters used
|
||||
/// to generate the texture coordinates for the
|
||||
|
|
@ -68,13 +65,19 @@ protected:
|
|||
///
|
||||
F32 mDetailDistance;
|
||||
|
||||
///
|
||||
DECLARE_TEXTUREMAP(ORMConfigMap);
|
||||
|
||||
bool mIsSRGB;
|
||||
bool mInvertRoughness;
|
||||
|
||||
/// Normally the detail is projected on to the xy
|
||||
/// coordinates of the terrain. If this flag is true
|
||||
/// then this detail is projected along the xz and yz
|
||||
/// planes.
|
||||
bool mSideProjection;
|
||||
|
||||
FileName mMacroMap;
|
||||
DECLARE_TEXTUREMAP(MacroMap);
|
||||
F32 mMacroSize;
|
||||
F32 mMacroStrength;
|
||||
F32 mMacroDistance;
|
||||
|
|
@ -82,9 +85,6 @@ protected:
|
|||
///
|
||||
F32 mParallaxScale;
|
||||
|
||||
bool mIsSRGB;
|
||||
bool mInvertSmoothness;
|
||||
|
||||
public:
|
||||
|
||||
TerrainMaterial();
|
||||
|
|
@ -124,7 +124,7 @@ public:
|
|||
|
||||
bool getIsSRGB() const { return mIsSRGB; }
|
||||
|
||||
bool getInvertSmoothness() const { return mInvertSmoothness; }
|
||||
bool getInvertRoughness() const { return mInvertRoughness; }
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue