mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Implementation of reflection and skylight probes.
Moves lighting math to the diffuse/specular two-channel logic.
This commit is contained in:
parent
83dd55e851
commit
2be32ad737
102 changed files with 12346 additions and 1911 deletions
|
|
@ -62,6 +62,8 @@ ImplementFeatureType( MFT_SubSurface, MFG_Lighting, 8.0f, true );
|
|||
ImplementFeatureType( MFT_VertLit, MFG_Lighting, 9.0f, true );
|
||||
ImplementFeatureType( MFT_MinnaertShading, MFG_Lighting, 10.0f, true );
|
||||
|
||||
ImplementFeatureType(MFT_ReflectionProbes, MFG_Lighting, 11.0f, true);
|
||||
|
||||
ImplementFeatureType( MFT_GlowMask, MFG_PostLighting, 1.0f, true );
|
||||
ImplementFeatureType( MFT_Visibility, MFG_PostLighting, 2.0f, true );
|
||||
ImplementFeatureType( MFT_Fog, MFG_PostProcess, 3.0f, true );
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ DeclareFeatureType( MFT_InvertSmoothness );
|
|||
DeclareFeatureType( MFT_SpecularMap );
|
||||
DeclareFeatureType( MFT_GlossMap );
|
||||
|
||||
DeclareFeatureType( MFT_ReflectionProbes );
|
||||
|
||||
/// This feature is only used to detect alpha transparency
|
||||
/// and does not have any code associtated with it.
|
||||
DeclareFeatureType( MFT_IsTranslucent );
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "console/propertyParsing.h"
|
||||
#include "gfx/util/screenspace.h"
|
||||
#include "scene/reflectionManager.h"
|
||||
#include "lighting/probeManager.h"
|
||||
|
||||
|
||||
ProcessedCustomMaterial::ProcessedCustomMaterial(Material &mat)
|
||||
|
|
@ -322,6 +323,10 @@ bool ProcessedCustomMaterial::setupPass( SceneRenderState *state, const SceneDat
|
|||
if (lm)
|
||||
lm->setLightInfo(this, NULL, sgData, state, pass, shaderConsts);
|
||||
|
||||
ProbeManager* pm = state ? PROBEMGR : NULL;
|
||||
if (pm)
|
||||
pm->setProbeInfo(this, NULL, sgData, state, pass, shaderConsts);
|
||||
|
||||
shaderConsts->setSafe(rpd->shaderHandles.mAccumTimeSC, MATMGR->getTotalTime());
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@
|
|||
#include "gfx/util/screenspace.h"
|
||||
#include "math/util/matrixSet.h"
|
||||
|
||||
#include "lighting/probeManager.h"
|
||||
|
||||
// We need to include customMaterialDefinition for ShaderConstHandles::init
|
||||
#include "materials/customMaterialDefinition.h"
|
||||
|
||||
|
|
@ -343,10 +345,16 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
|||
if ( mMaterial->mAlphaTest )
|
||||
fd.features.addFeature( MFT_AlphaTest );
|
||||
|
||||
if ( mMaterial->mEmissive[stageNum] )
|
||||
fd.features.addFeature( MFT_IsEmissive );
|
||||
if (mMaterial->mEmissive[stageNum])
|
||||
{
|
||||
fd.features.addFeature(MFT_IsEmissive);
|
||||
}
|
||||
else
|
||||
fd.features.addFeature( MFT_RTLighting );
|
||||
{
|
||||
fd.features.addFeature(MFT_RTLighting);
|
||||
if (mMaterial->isTranslucent())
|
||||
fd.features.addFeature(MFT_ReflectionProbes);
|
||||
}
|
||||
|
||||
if ( mMaterial->mAnimFlags[stageNum] )
|
||||
fd.features.addFeature( MFT_TexAnim );
|
||||
|
|
@ -357,7 +365,7 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
|||
// cubemaps only available on stage 0 for now - bramage
|
||||
if ( stageNum < 1 && mMaterial->isTranslucent() &&
|
||||
( ( mMaterial->mCubemapData && mMaterial->mCubemapData->mCubemap ) ||
|
||||
mMaterial->mDynamicCubemap ) )
|
||||
mMaterial->mDynamicCubemap ) && !features.hasFeature(MFT_ReflectionProbes))
|
||||
{
|
||||
fd.features.addFeature( MFT_CubeMap );
|
||||
}
|
||||
|
|
@ -367,6 +375,8 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
|||
fd.features.addFeature(MFT_StaticCubemap);
|
||||
fd.features.addFeature(MFT_CubeMap);
|
||||
fd.features.addFeature(MFT_SkyBox);
|
||||
|
||||
fd.features.removeFeature(MFT_ReflectionProbes);
|
||||
}
|
||||
fd.features.addFeature( MFT_Visibility );
|
||||
|
||||
|
|
@ -1296,13 +1306,15 @@ void ProcessedShaderMaterial::setSceneInfo(SceneRenderState * state, const Scene
|
|||
shaderConsts->set(handles->mEyePosSC, eyepos);
|
||||
}
|
||||
|
||||
shaderConsts->setSafe(handles->mEyeMatSC, state->getCameraTransform());
|
||||
shaderConsts->setSafe(handles->mEyeMatSC, state->getCameraTransform());
|
||||
|
||||
ShaderRenderPassData *rpd = _getRPD( pass );
|
||||
for ( U32 i=0; i < rpd->featureShaderHandles.size(); i++ )
|
||||
rpd->featureShaderHandles[i]->setConsts( state, sgData, shaderConsts );
|
||||
ShaderRenderPassData *rpd = _getRPD(pass);
|
||||
for (U32 i = 0; i < rpd->featureShaderHandles.size(); i++)
|
||||
rpd->featureShaderHandles[i]->setConsts(state, sgData, shaderConsts);
|
||||
|
||||
LIGHTMGR->setLightInfo( this, mMaterial, sgData, state, pass, shaderConsts );
|
||||
LIGHTMGR->setLightInfo(this, mMaterial, sgData, state, pass, shaderConsts);
|
||||
|
||||
PROBEMGR->setProbeInfo(this, mMaterial, sgData, state, pass, shaderConsts);
|
||||
}
|
||||
|
||||
void ProcessedShaderMaterial::setBuffers( GFXVertexBufferHandleBase *vertBuffer, GFXPrimitiveBufferHandle *primBuffer )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue