mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-19 22:53:47 +00:00
Merge pull request #943 from Azaezel/alpha403/emissiveToReciveShadows
emissive to recivesShadows
This commit is contained in:
commit
95b8028e5a
23 changed files with 80 additions and 128 deletions
|
|
@ -41,6 +41,7 @@
|
|||
#include "materials/baseMatInstance.h"
|
||||
#include "materials/sceneData.h"
|
||||
#include "environment/timeOfDay.h"
|
||||
#include "materials/materialFeatureTypes.h"
|
||||
|
||||
|
||||
ConsoleDocClass( ScatterSky,
|
||||
|
|
@ -913,7 +914,12 @@ void ScatterSky::_initMoon()
|
|||
|
||||
if (mMoonMatAsset.notNull())
|
||||
{
|
||||
mMoonMatInst = MATMGR->createMatInstance(mMoonMatAsset->getMaterialDefinitionName(), MATMGR->getDefaultFeatures(), getGFXVertexFormat<GFXVertexPCT>());
|
||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.removeFeature(MFT_RTLighting);
|
||||
features.removeFeature(MFT_Visibility);
|
||||
features.removeFeature(MFT_ReflectionProbes);
|
||||
features.addFeature(MFT_isBackground);
|
||||
mMoonMatInst = MATMGR->createMatInstance(mMoonMatAsset->getMaterialDefinitionName(), features, getGFXVertexFormat<GFXVertexPCT>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ void SkyBox::_initRender()
|
|||
mFogBandMat->mTranslucent = true;
|
||||
mFogBandMat->mVertColor[0] = true;
|
||||
mFogBandMat->mDoubleSided = true;
|
||||
mFogBandMat->mEmissive[0] = true;
|
||||
mFogBandMat->mReceiveShadows[0] = false;
|
||||
|
||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.addFeature(MFT_isBackground);
|
||||
|
|
@ -610,6 +610,7 @@ void SkyBox::_initMaterial()
|
|||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.removeFeature( MFT_RTLighting );
|
||||
features.removeFeature( MFT_Visibility );
|
||||
features.removeFeature(MFT_ReflectionProbes);
|
||||
features.addFeature(MFT_isBackground);
|
||||
features.addFeature(MFT_SkyBox);
|
||||
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ void SkySphere::_initRender()
|
|||
mFogBandMat->mTranslucent = true;
|
||||
mFogBandMat->mVertColor[0] = true;
|
||||
mFogBandMat->mDoubleSided = true;
|
||||
mFogBandMat->mEmissive[0] = true;
|
||||
mFogBandMat->mReceiveShadows[0] = false;
|
||||
|
||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.addFeature(MFT_isBackground);
|
||||
|
|
@ -608,6 +608,7 @@ void SkySphere::_initMaterial()
|
|||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.removeFeature(MFT_RTLighting);
|
||||
features.removeFeature(MFT_Visibility);
|
||||
features.removeFeature(MFT_ReflectionProbes);
|
||||
features.addFeature(MFT_isBackground);
|
||||
|
||||
// Now initialize the material.
|
||||
|
|
|
|||
|
|
@ -384,8 +384,7 @@ bool MatInstance::processMaterial()
|
|||
mUsesHardwareSkinning = finalFeatures.hasFeature( MFT_HardwareSkinning );
|
||||
|
||||
mIsForwardLit = ( custMat && custMat->mForwardLit ) ||
|
||||
( !finalFeatures.hasFeature( MFT_IsEmissive ) &&
|
||||
finalFeatures.hasFeature( MFT_ForwardShading ) );
|
||||
( finalFeatures.hasFeature( MFT_ForwardShading ) );
|
||||
|
||||
mIsHardwareSkinned = finalFeatures.hasFeature( MFT_HardwareSkinning );
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ Material::Material()
|
|||
mVertColor[i] = false;
|
||||
|
||||
mGlow[i] = false;
|
||||
mEmissive[i] = false;
|
||||
mReceiveShadows[i] = true;
|
||||
|
||||
mDetailScale[i].set(2.0f, 2.0f);
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ void Material::initPersistFields()
|
|||
addField("subSurfaceRolloff", TypeF32, Offset(mSubSurfaceRolloff, Material), MAX_STAGES,
|
||||
"The 0 to 1 rolloff factor used in the subsurface scattering approximation.");
|
||||
|
||||
addField("emissive", TypeBool, Offset(mEmissive, Material), MAX_STAGES,
|
||||
addField("receiveShadows", TypeBool, Offset(mReceiveShadows, Material), MAX_STAGES,
|
||||
"Enables emissive lighting for the material.");
|
||||
|
||||
addField("doubleSided", TypeBool, Offset(mDoubleSided, Material),
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ public:
|
|||
F32 mSeqSegSize[MAX_STAGES];
|
||||
|
||||
bool mGlow[MAX_STAGES]; // entire stage glows
|
||||
bool mEmissive[MAX_STAGES];
|
||||
bool mReceiveShadows[MAX_STAGES];
|
||||
|
||||
Point2I mCellIndex[MAX_STAGES];
|
||||
Point2I mCellLayout[MAX_STAGES];
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ ImplementFeatureType( MFT_IsBC3nm, U32(-1), -1, true );
|
|||
ImplementFeatureType( MFT_IsBC5nm, U32(-1), -1, true);
|
||||
ImplementFeatureType( MFT_IsTranslucent, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_IsTranslucentZWrite, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_IsEmissive, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_DiffuseMapAtlas, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_NormalMapAtlas, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_InterlacedDeferred, U32(-1), -1, true );
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ DeclareFeatureType( MFT_AlphaTest );
|
|||
DeclareFeatureType( MFT_NormalMap );
|
||||
DeclareFeatureType( MFT_RTLighting );
|
||||
|
||||
DeclareFeatureType( MFT_IsEmissive );
|
||||
DeclareFeatureType( MFT_SubSurface );
|
||||
DeclareFeatureType( MFT_LightMap );
|
||||
DeclareFeatureType( MFT_ToneMap );
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ BaseMatInstance * MaterialManager::createMeshDebugMatInstance(const LinearColorF
|
|||
debugMat = allocateAndRegister( meshDebugStr );
|
||||
|
||||
debugMat->mDiffuse[0] = meshColor;
|
||||
debugMat->mEmissive[0] = true;
|
||||
debugMat->mReceiveShadows[0] = false;
|
||||
}
|
||||
|
||||
BaseMatInstance *debugMatInstance = NULL;
|
||||
|
|
|
|||
|
|
@ -353,15 +353,10 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
|||
if ( mMaterial->mAlphaTest )
|
||||
fd.features.addFeature( MFT_AlphaTest );
|
||||
|
||||
if (mMaterial->mEmissive[stageNum])
|
||||
{
|
||||
fd.features.addFeature(MFT_IsEmissive);
|
||||
}
|
||||
else
|
||||
if (mMaterial->isTranslucent())
|
||||
{
|
||||
fd.features.addFeature(MFT_RTLighting);
|
||||
if (mMaterial->isTranslucent())
|
||||
fd.features.addFeature(MFT_ReflectionProbes);
|
||||
fd.features.addFeature(MFT_ReflectionProbes);
|
||||
}
|
||||
|
||||
if ( mMaterial->mAnimFlags[stageNum] )
|
||||
|
|
@ -1204,8 +1199,8 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons
|
|||
|
||||
// Deferred Shading: Determine Material Info Flags
|
||||
S32 matInfoFlags =
|
||||
(mMaterial->mEmissive[stageNum] ? 1 : 0) | //emissive
|
||||
(mMaterial->mSubSurface[stageNum] ? 2 : 0); //subsurface
|
||||
(mMaterial->mReceiveShadows[stageNum] ? 1 : 0) | //ReceiveShadows
|
||||
(mMaterial->mSubSurface[stageNum] ? 1 << 2 : 0); //subsurface
|
||||
mMaterial->mMatInfoFlags[stageNum] = matInfoFlags / 255.0f;
|
||||
shaderConsts->setSafe(handles->mMatInfoFlagsSC, mMaterial->mMatInfoFlags[stageNum]);
|
||||
if( handles->mAccuScaleSC->isValid() )
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void RenderOcclusionMgr::init()
|
|||
|
||||
mMaterial = MATMGR->allocateAndRegister( String::EmptyString );
|
||||
mMaterial->mDiffuse[0] = LinearColorF( 1, 0, 1, 1 );
|
||||
mMaterial->mEmissive[0] = true;
|
||||
mMaterial->mReceiveShadows[0] = false;
|
||||
mMaterial->mAutoGenerated = true;
|
||||
|
||||
mMatInstance = mMaterial->createMatInstance();
|
||||
|
|
@ -234,4 +234,4 @@ void RenderOcclusionMgr::render( SceneRenderState *state )
|
|||
|
||||
// Call setup one more time to end the pass.
|
||||
mMatInstance->setupPass( state, sgData );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ void TerrainBaseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig)));
|
||||
}
|
||||
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig));
|
||||
meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig));
|
||||
|
||||
output = meta;
|
||||
|
||||
|
|
@ -1109,7 +1109,7 @@ void TerrainORMMapFeatGLSL::processPix(Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
if (compositeIndex == 0)
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = vec4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig));
|
||||
meta->addStatement(new GenOp(" @ = vec4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig));
|
||||
}
|
||||
|
||||
Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));
|
||||
|
|
@ -1176,7 +1176,7 @@ void TerrainBlankInfoMapFeatGLSL::processPix(Vector<ShaderComponent*> &component
|
|||
|
||||
if (compositeIndex == 0)
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig));
|
||||
meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig));
|
||||
}
|
||||
|
||||
Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ void TerrainBaseMapFeatHLSL::processPix(Vector<ShaderComponent*>& componentList,
|
|||
meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig)));
|
||||
}
|
||||
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig));
|
||||
meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig));
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
|
@ -1191,7 +1191,7 @@ void TerrainORMMapFeatHLSL::processPix(Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
if (compositeIndex == 0)
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig));
|
||||
meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 0.0, 0.0, 0.0);\r\n", ormConfig));
|
||||
}
|
||||
|
||||
Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));
|
||||
|
|
@ -1256,7 +1256,7 @@ void TerrainBlankInfoMapFeatHLSL::processPix(Vector<ShaderComponent*> &component
|
|||
|
||||
if (compositeIndex == 0)
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig));
|
||||
meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig));
|
||||
}
|
||||
|
||||
Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue