mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
from @rextimmy new isbackground shader feature. used the same z=w trick we've done before to force things to render behind everything else. applied to fog
This commit is contained in:
parent
dda0cc9aa7
commit
454192ed02
8 changed files with 15 additions and 4 deletions
|
|
@ -575,8 +575,10 @@ void SkyBox::_initRender()
|
||||||
mFogBandMat->mDoubleSided = true;
|
mFogBandMat->mDoubleSided = true;
|
||||||
mFogBandMat->mEmissive[0] = true;
|
mFogBandMat->mEmissive[0] = true;
|
||||||
|
|
||||||
|
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||||
|
features.addFeature(MFT_isBackground);
|
||||||
mFogBandMatInst = mFogBandMat->createMatInstance();
|
mFogBandMatInst = mFogBandMat->createMatInstance();
|
||||||
mFogBandMatInst->init( MATMGR->getDefaultFeatures(), getGFXVertexFormat<GFXVertexPC>() );
|
mFogBandMatInst->init(features, getGFXVertexFormat<GFXVertexPC>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyBox::onStaticModified( const char *slotName, const char *newValue )
|
void SkyBox::onStaticModified( const char *slotName, const char *newValue )
|
||||||
|
|
@ -609,6 +611,7 @@ void SkyBox::_initMaterial()
|
||||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||||
features.removeFeature( MFT_RTLighting );
|
features.removeFeature( MFT_RTLighting );
|
||||||
features.removeFeature( MFT_Visibility );
|
features.removeFeature( MFT_Visibility );
|
||||||
|
features.addFeature(MFT_isBackground);
|
||||||
features.addFeature(MFT_SkyBox);
|
features.addFeature(MFT_SkyBox);
|
||||||
|
|
||||||
// Now initialize the material.
|
// Now initialize the material.
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ ImplementFeatureType( MFT_ImposterVert, MFG_PreTransform, 1.0, false );
|
||||||
|
|
||||||
// Deferred Shading
|
// Deferred Shading
|
||||||
ImplementFeatureType( MFT_isDeferred, U32(-1), -1, true );
|
ImplementFeatureType( MFT_isDeferred, U32(-1), -1, true );
|
||||||
ImplementFeatureType( MFT_SkyBox, MFG_Transform, 1.0f, false );
|
ImplementFeatureType( MFT_isBackground, MFG_Transform, 1.0f, false );
|
||||||
|
ImplementFeatureType( MFT_SkyBox, MFG_Transform, 2.0f, false );
|
||||||
ImplementFeatureType( MFT_HardwareSkinning, MFG_Transform,-2.0, false );
|
ImplementFeatureType( MFT_HardwareSkinning, MFG_Transform,-2.0, false );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,7 @@ DeclareFeatureType( MFT_HardwareSkinning );
|
||||||
|
|
||||||
// Deferred Shading
|
// Deferred Shading
|
||||||
DeclareFeatureType( MFT_isDeferred );
|
DeclareFeatureType( MFT_isDeferred );
|
||||||
|
DeclareFeatureType( MFT_isBackground );
|
||||||
DeclareFeatureType( MFT_SkyBox );
|
DeclareFeatureType( MFT_SkyBox );
|
||||||
DeclareFeatureType( MFT_MatInfoFlags );
|
DeclareFeatureType( MFT_MatInfoFlags );
|
||||||
#endif // _MATERIALFEATURETYPES_H_
|
#endif // _MATERIALFEATURETYPES_H_
|
||||||
|
|
|
||||||
|
|
@ -452,6 +452,10 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
||||||
// Deferred Shading : Material Info Flags
|
// Deferred Shading : Material Info Flags
|
||||||
fd.features.addFeature(MFT_MatInfoFlags);
|
fd.features.addFeature(MFT_MatInfoFlags);
|
||||||
|
|
||||||
|
if (features.hasFeature(MFT_isBackground))
|
||||||
|
{
|
||||||
|
fd.features.addFeature(MFT_isBackground);
|
||||||
|
}
|
||||||
if (features.hasFeature(MFT_SkyBox))
|
if (features.hasFeature(MFT_SkyBox))
|
||||||
{
|
{
|
||||||
fd.features.addFeature(MFT_StaticCubemap);
|
fd.features.addFeature(MFT_StaticCubemap);
|
||||||
|
|
|
||||||
|
|
@ -1743,7 +1743,7 @@ void VertPositionGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||||
|
|
||||||
meta->addStatement( new GenOp( " @ = tMul(@, vec4(@.xyz,1));\r\n",
|
meta->addStatement( new GenOp( " @ = tMul(@, vec4(@.xyz,1));\r\n",
|
||||||
outPosition, modelview, inPosition ) );
|
outPosition, modelview, inPosition ) );
|
||||||
if (fd.materialFeatures[MFT_SkyBox])
|
if (fd.materialFeatures[MFT_isBackground])
|
||||||
{
|
{
|
||||||
meta->addStatement(new GenOp(" @ = @.xyww;\r\n", outPosition, outPosition));
|
meta->addStatement(new GenOp(" @ = @.xyww;\r\n", outPosition, outPosition));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ void _initShaderGenGLSL( ShaderGen *shaderGen )
|
||||||
FEATUREMGR->registerFeature( MFT_PBRConfigVars, new PBRConfigVarsGLSL );
|
FEATUREMGR->registerFeature( MFT_PBRConfigVars, new PBRConfigVarsGLSL );
|
||||||
FEATUREMGR->registerFeature( MFT_MatInfoFlags, new MatInfoFlagsGLSL );
|
FEATUREMGR->registerFeature( MFT_MatInfoFlags, new MatInfoFlagsGLSL );
|
||||||
FEATUREMGR->registerFeature( MFT_GlowMap, new GlowMapGLSL);
|
FEATUREMGR->registerFeature( MFT_GlowMap, new GlowMapGLSL);
|
||||||
|
FEATUREMGR->registerFeature( MFT_isBackground, new NamedFeatureGLSL("Background Object"));
|
||||||
FEATUREMGR->registerFeature( MFT_SkyBox, new NamedFeatureGLSL( "skybox" ) );
|
FEATUREMGR->registerFeature( MFT_SkyBox, new NamedFeatureGLSL( "skybox" ) );
|
||||||
FEATUREMGR->registerFeature( MFT_HardwareSkinning, new HardwareSkinningFeatureGLSL );
|
FEATUREMGR->registerFeature( MFT_HardwareSkinning, new HardwareSkinningFeatureGLSL );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1781,7 +1781,7 @@ void VertPositionHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||||
meta->addStatement( new GenOp( " @ = mul(@, float4(@.xyz,1));\r\n",
|
meta->addStatement( new GenOp( " @ = mul(@, float4(@.xyz,1));\r\n",
|
||||||
outPosition, modelview, inPosition ) );
|
outPosition, modelview, inPosition ) );
|
||||||
|
|
||||||
if (fd.materialFeatures[MFT_SkyBox])
|
if (fd.materialFeatures[MFT_isBackground])
|
||||||
{
|
{
|
||||||
meta->addStatement(new GenOp(" @ = @.xyww;\r\n", outPosition, outPosition));
|
meta->addStatement(new GenOp(" @ = @.xyww;\r\n", outPosition, outPosition));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ void _initShaderGenHLSL( ShaderGen *shaderGen )
|
||||||
FEATUREMGR->registerFeature( MFT_PBRConfigVars, new PBRConfigVarsHLSL);
|
FEATUREMGR->registerFeature( MFT_PBRConfigVars, new PBRConfigVarsHLSL);
|
||||||
FEATUREMGR->registerFeature( MFT_MatInfoFlags, new MatInfoFlagsHLSL );
|
FEATUREMGR->registerFeature( MFT_MatInfoFlags, new MatInfoFlagsHLSL );
|
||||||
FEATUREMGR->registerFeature( MFT_GlowMap, new GlowMapHLSL);
|
FEATUREMGR->registerFeature( MFT_GlowMap, new GlowMapHLSL);
|
||||||
|
FEATUREMGR->registerFeature( MFT_isBackground, new NamedFeatureHLSL("Background Object"));
|
||||||
FEATUREMGR->registerFeature( MFT_SkyBox, new NamedFeatureHLSL( "skybox" ) );
|
FEATUREMGR->registerFeature( MFT_SkyBox, new NamedFeatureHLSL( "skybox" ) );
|
||||||
FEATUREMGR->registerFeature( MFT_HardwareSkinning, new HardwareSkinningFeatureHLSL );
|
FEATUREMGR->registerFeature( MFT_HardwareSkinning, new HardwareSkinningFeatureHLSL );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue