mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04: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
1f7cf55204
commit
b19a4b22c8
102 changed files with 12346 additions and 1911 deletions
|
|
@ -40,9 +40,10 @@
|
|||
#include "gfx/gfxDebugEvent.h"
|
||||
#include "math/util/matrixSet.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "gfx/gfxTextureManager.h"
|
||||
|
||||
const RenderInstType AdvancedLightBinManager::RIT_LightInfo( "directLighting" );
|
||||
const String AdvancedLightBinManager::smBufferName( "directLighting" );
|
||||
const RenderInstType AdvancedLightBinManager::RIT_LightInfo( "specularLighting" );
|
||||
const String AdvancedLightBinManager::smBufferName( "specularLighting" );
|
||||
|
||||
ShadowFilterMode AdvancedLightBinManager::smShadowFilterMode = ShadowFilterMode_SoftShadowHighQuality;
|
||||
bool AdvancedLightBinManager::smPSSMDebugRender = false;
|
||||
|
|
@ -180,6 +181,26 @@ bool AdvancedLightBinManager::setTargetSize(const Point2I &newTargetSize)
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool AdvancedLightBinManager::_updateTargets()
|
||||
{
|
||||
PROFILE_SCOPE(AdvancedLightBinManager_updateTargets);
|
||||
|
||||
bool ret = Parent::_updateTargets();
|
||||
|
||||
mDiffuseLightingTarget = NamedTexTarget::find("diffuseLighting");
|
||||
if (mDiffuseLightingTarget.isValid())
|
||||
{
|
||||
mDiffuseLightingTex = mDiffuseLightingTarget->getTexture();
|
||||
|
||||
for (U32 i = 0; i < mTargetChainLength; i++)
|
||||
mTargetChain[i]->attachTexture(GFXTextureTarget::Color1, mDiffuseLightingTex);
|
||||
}
|
||||
|
||||
GFX->finalizeReset();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AdvancedLightBinManager::addLight( LightInfo *light )
|
||||
{
|
||||
// Get the light type.
|
||||
|
|
|
|||
|
|
@ -90,6 +90,9 @@ public:
|
|||
// registered buffer name
|
||||
static const String smBufferName;
|
||||
|
||||
NamedTexTargetRef mDiffuseLightingTarget;
|
||||
GFXTexHandle mDiffuseLightingTex;
|
||||
|
||||
/// The shadow filter mode to use on shadowed light materials.
|
||||
static ShadowFilterMode smShadowFilterMode;
|
||||
|
||||
|
|
@ -128,6 +131,7 @@ public:
|
|||
bool MRTLightmapsDuringDeferred() const { return mMRTLightmapsDuringDeferred; }
|
||||
void MRTLightmapsDuringDeferred(bool val);
|
||||
|
||||
bool _updateTargets();
|
||||
|
||||
typedef Signal<void(SceneRenderState *, AdvancedLightBinManager *)> RenderSignal;
|
||||
static RenderSignal &getRenderSignal();
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &deferredTarget
|
|||
FEATUREMGR->registerFeature(MFT_PixSpecular, new DeferredPixelSpecularGLSL());
|
||||
FEATUREMGR->registerFeature(MFT_MinnaertShading, new DeferredMinnaertGLSL());
|
||||
FEATUREMGR->registerFeature(MFT_SubSurface, new DeferredSubSurfaceGLSL());
|
||||
FEATUREMGR->registerFeature(MFT_ReflectionProbes, new ReflectionProbeFeatGLSL);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
@ -75,6 +76,7 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &deferredTarget
|
|||
FEATUREMGR->registerFeature(MFT_PixSpecular, new DeferredPixelSpecularHLSL());
|
||||
FEATUREMGR->registerFeature(MFT_MinnaertShading, new DeferredMinnaertHLSL());
|
||||
FEATUREMGR->registerFeature(MFT_SubSurface, new DeferredSubSurfaceHLSL());
|
||||
FEATUREMGR->registerFeature(MFT_ReflectionProbes, new ReflectionProbeFeatHLSL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ void DeferredRTLightingFeatGLSL::processPix( Vector<ShaderComponent*> &component
|
|||
uvScene->setName( "uvScene" );
|
||||
LangElement *uvSceneDecl = new DecOp( uvScene );
|
||||
|
||||
String rtParamName = String::ToString( "rtParams%s", "directLightingBuffer" );
|
||||
String rtParamName = String::ToString( "rtParams%s", "diffuseLightingBuffer" );
|
||||
Var *rtParams = (Var*) LangElement::find( rtParamName );
|
||||
if( !rtParams )
|
||||
{
|
||||
|
|
@ -121,7 +121,7 @@ void DeferredRTLightingFeatGLSL::processPix( Vector<ShaderComponent*> &component
|
|||
// create texture var
|
||||
Var *lightInfoBuffer = new Var;
|
||||
lightInfoBuffer->setType( "sampler2D" );
|
||||
lightInfoBuffer->setName( "directLightingBuffer" );
|
||||
lightInfoBuffer->setName( "diffuseLightingBuffer" );
|
||||
lightInfoBuffer->uniform = true;
|
||||
lightInfoBuffer->sampler = true;
|
||||
lightInfoBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
|
@ -207,7 +207,7 @@ void DeferredRTLightingFeatGLSL::setTexData( Material::StageData &stageDat,
|
|||
mLastTexIndex = texIndex;
|
||||
|
||||
passData.mTexType[ texIndex ] = Material::TexTarget;
|
||||
passData.mSamplerNames[ texIndex ]= "directLightingBuffer";
|
||||
passData.mSamplerNames[ texIndex ]= "diffuseLightingBuffer";
|
||||
passData.mTexSlot[ texIndex++ ].texTarget = texTarget;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
uvScene->setName("uvScene");
|
||||
LangElement *uvSceneDecl = new DecOp(uvScene);
|
||||
|
||||
String rtParamName = String::ToString("rtParams%s", "directLightingBuffer");
|
||||
String rtParamName = String::ToString("rtParams%s", "diffuseLightingBuffer");
|
||||
Var *rtParams = (Var*)LangElement::find(rtParamName);
|
||||
if (!rtParams)
|
||||
{
|
||||
|
|
@ -215,7 +215,7 @@ void DeferredRTLightingFeatHLSL::setTexData( Material::StageData &stageDat,
|
|||
mLastTexIndex = texIndex;
|
||||
|
||||
passData.mTexType[ texIndex ] = Material::TexTarget;
|
||||
passData.mSamplerNames[ texIndex ]= "directLightingBuffer";
|
||||
passData.mSamplerNames[ texIndex ]= "diffuseLightingBuffer";
|
||||
passData.mTexSlot[ texIndex++ ].texTarget = texTarget;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue