mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 05:50:31 +00:00
Goes and replaces the references/names that use Prepass to be Deferred, since we're actually using deferred.
This commit is contained in:
parent
b052a1f970
commit
af8fbf0e3a
122 changed files with 641 additions and 641 deletions
|
|
@ -29,7 +29,7 @@
|
|||
#include "lighting/shadowMap/shadowMapPass.h"
|
||||
#include "lighting/shadowMap/lightShadowMap.h"
|
||||
#include "lighting/common/lightMapParams.h"
|
||||
#include "renderInstance/renderPrePassMgr.h"
|
||||
#include "renderInstance/renderDeferredMgr.h"
|
||||
#include "gfx/gfxTransformSaver.h"
|
||||
#include "scene/sceneManager.h"
|
||||
#include "scene/sceneRenderState.h"
|
||||
|
|
@ -130,7 +130,7 @@ AdvancedLightBinManager::AdvancedLightBinManager( AdvancedLightManager *lm /* =
|
|||
// We want a full-resolution buffer
|
||||
mTargetSizeType = RenderTexTargetBinManager::WindowSize;
|
||||
|
||||
mMRTLightmapsDuringPrePass = false;
|
||||
mMRTLightmapsDuringDeferred = false;
|
||||
|
||||
Con::NotifyDelegate callback( this, &AdvancedLightBinManager::_deleteLightMaterials );
|
||||
Con::addVariableNotify( "$pref::Shadows::filterMode", callback );
|
||||
|
|
@ -253,7 +253,7 @@ void AdvancedLightBinManager::render( SceneRenderState *state )
|
|||
return;
|
||||
|
||||
// Clear as long as there isn't MRT population of light buffer with lightmap data
|
||||
if ( !MRTLightmapsDuringPrePass() )
|
||||
if ( !MRTLightmapsDuringDeferred() )
|
||||
GFX->clear(GFXClearTarget, ColorI(0, 0, 0, 0), 1.0f, 0);
|
||||
|
||||
// Restore transforms
|
||||
|
|
@ -550,23 +550,23 @@ void AdvancedLightBinManager::setupSGData( SceneData &data, const SceneRenderSta
|
|||
}
|
||||
}
|
||||
|
||||
void AdvancedLightBinManager::MRTLightmapsDuringPrePass( bool val )
|
||||
void AdvancedLightBinManager::MRTLightmapsDuringDeferred( bool val )
|
||||
{
|
||||
// Do not enable if the GFX device can't do MRT's
|
||||
if ( GFX->getNumRenderTargets() < 2 )
|
||||
val = false;
|
||||
|
||||
if ( mMRTLightmapsDuringPrePass != val )
|
||||
if ( mMRTLightmapsDuringDeferred != val )
|
||||
{
|
||||
mMRTLightmapsDuringPrePass = val;
|
||||
mMRTLightmapsDuringDeferred = val;
|
||||
|
||||
// Reload materials to cause a feature recalculation on prepass materials
|
||||
// Reload materials to cause a feature recalculation on deferred materials
|
||||
if(mLightManager->isActive())
|
||||
MATMGR->flushAndReInitInstances();
|
||||
|
||||
RenderPrePassMgr *prepass;
|
||||
if ( Sim::findObject( "AL_PrePassBin", prepass ) && prepass->getTargetTexture( 0 ) )
|
||||
prepass->updateTargets();
|
||||
RenderDeferredMgr *deferred;
|
||||
if ( Sim::findObject( "AL_DeferredBin", deferred ) && deferred->getTargetTexture( 0 ) )
|
||||
deferred->updateTargets();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -834,21 +834,21 @@ bool LightMatInstance::init( const FeatureSet &features, const GFXVertexFormat *
|
|||
// in the same way.
|
||||
litState.separateAlphaBlendDefined = true;
|
||||
litState.separateAlphaBlendEnable = false;
|
||||
litState.stencilMask = RenderPrePassMgr::OpaqueDynamicLitMask | RenderPrePassMgr::OpaqueStaticLitMask;
|
||||
litState.stencilMask = RenderDeferredMgr::OpaqueDynamicLitMask | RenderDeferredMgr::OpaqueStaticLitMask;
|
||||
mLitState[DynamicLight] = GFX->createStateBlock(litState);
|
||||
|
||||
// StaticLightNonLMGeometry State: This will treat non-lightmapped geometry
|
||||
// in the usual way, but will not effect lightmapped geometry.
|
||||
litState.separateAlphaBlendDefined = true;
|
||||
litState.separateAlphaBlendEnable = false;
|
||||
litState.stencilMask = RenderPrePassMgr::OpaqueDynamicLitMask;
|
||||
litState.stencilMask = RenderDeferredMgr::OpaqueDynamicLitMask;
|
||||
mLitState[StaticLightNonLMGeometry] = GFX->createStateBlock(litState);
|
||||
|
||||
// StaticLightLMGeometry State: This will add specular information (alpha) but
|
||||
// multiply-darken color information.
|
||||
litState.blendDest = GFXBlendSrcColor;
|
||||
litState.blendSrc = GFXBlendZero;
|
||||
litState.stencilMask = RenderPrePassMgr::OpaqueStaticLitMask;
|
||||
litState.stencilMask = RenderDeferredMgr::OpaqueStaticLitMask;
|
||||
litState.separateAlphaBlendDefined = true;
|
||||
litState.separateAlphaBlendEnable = true;
|
||||
litState.separateAlphaBlendSrc = GFXBlendOne;
|
||||
|
|
|
|||
|
|
@ -121,8 +121,8 @@ public:
|
|||
// ConsoleObject interface
|
||||
DECLARE_CONOBJECT(AdvancedLightBinManager);
|
||||
|
||||
bool MRTLightmapsDuringPrePass() const { return mMRTLightmapsDuringPrePass; }
|
||||
void MRTLightmapsDuringPrePass(bool val);
|
||||
bool MRTLightmapsDuringDeferred() const { return mMRTLightmapsDuringDeferred; }
|
||||
void MRTLightmapsDuringDeferred(bool val);
|
||||
|
||||
|
||||
typedef Signal<void(SceneRenderState *, AdvancedLightBinManager *)> RenderSignal;
|
||||
|
|
@ -195,7 +195,7 @@ protected:
|
|||
Vector<LightBinEntry> mLightBin;
|
||||
typedef Vector<LightBinEntry>::iterator LightBinIterator;
|
||||
|
||||
bool mMRTLightmapsDuringPrePass;
|
||||
bool mMRTLightmapsDuringDeferred;
|
||||
|
||||
/// Used in setupSGData to set the object transform.
|
||||
MatrixF mLightMat;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include "lighting/common/sceneLighting.h"
|
||||
#include "lighting/common/lightMapParams.h"
|
||||
#include "core/util/safeDelete.h"
|
||||
#include "renderInstance/renderPrePassMgr.h"
|
||||
#include "renderInstance/renderDeferredMgr.h"
|
||||
#include "materials/materialManager.h"
|
||||
#include "math/util/sphereMesh.h"
|
||||
#include "console/consoleTypes.h"
|
||||
|
|
@ -115,27 +115,27 @@ void AdvancedLightManager::activate( SceneManager *sceneManager )
|
|||
mLightBinManager = new AdvancedLightBinManager( this, SHADOWMGR, blendTargetFormat );
|
||||
mLightBinManager->assignName( "AL_LightBinMgr" );
|
||||
|
||||
// First look for the prepass bin...
|
||||
RenderPrePassMgr *prePassBin = _findPrePassRenderBin();
|
||||
// First look for the deferred bin...
|
||||
RenderDeferredMgr *prePassBin = _findDeferredRenderBin();
|
||||
|
||||
// If we didn't find the prepass bin then add one.
|
||||
// If we didn't find the deferred bin then add one.
|
||||
if ( !prePassBin )
|
||||
{
|
||||
prePassBin = new RenderPrePassMgr( true, blendTargetFormat );
|
||||
prePassBin->assignName( "AL_PrePassBin" );
|
||||
prePassBin = new RenderDeferredMgr( true, blendTargetFormat );
|
||||
prePassBin->assignName( "AL_DeferredBin" );
|
||||
prePassBin->registerObject();
|
||||
getSceneManager()->getDefaultRenderPass()->addManager( prePassBin );
|
||||
mPrePassRenderBin = prePassBin;
|
||||
mDeferredRenderBin = prePassBin;
|
||||
}
|
||||
|
||||
// Tell the material manager that prepass is enabled.
|
||||
MATMGR->setPrePassEnabled( true );
|
||||
// Tell the material manager that deferred is enabled.
|
||||
MATMGR->setDeferredEnabled( true );
|
||||
|
||||
// Insert our light bin manager.
|
||||
mLightBinManager->setRenderOrder( prePassBin->getRenderOrder() + 0.01f );
|
||||
getSceneManager()->getDefaultRenderPass()->addManager( mLightBinManager );
|
||||
|
||||
AdvancedLightingFeatures::registerFeatures(mPrePassRenderBin->getTargetFormat(), mLightBinManager->getTargetFormat());
|
||||
AdvancedLightingFeatures::registerFeatures(mDeferredRenderBin->getTargetFormat(), mLightBinManager->getTargetFormat());
|
||||
|
||||
// Last thing... let everyone know we're active.
|
||||
smActivateSignal.trigger( getId(), true );
|
||||
|
|
@ -151,14 +151,14 @@ void AdvancedLightManager::deactivate()
|
|||
// removing itself from the render passes.
|
||||
if( mLightBinManager )
|
||||
{
|
||||
mLightBinManager->MRTLightmapsDuringPrePass(false);
|
||||
mLightBinManager->MRTLightmapsDuringDeferred(false);
|
||||
mLightBinManager->deleteObject();
|
||||
}
|
||||
mLightBinManager = NULL;
|
||||
|
||||
if ( mPrePassRenderBin )
|
||||
mPrePassRenderBin->deleteObject();
|
||||
mPrePassRenderBin = NULL;
|
||||
if ( mDeferredRenderBin )
|
||||
mDeferredRenderBin->deleteObject();
|
||||
mDeferredRenderBin = NULL;
|
||||
|
||||
SHADOWMGR->deactivate();
|
||||
|
||||
|
|
@ -348,8 +348,8 @@ void AdvancedLightManager::setLightInfo( ProcessedMaterial *pmat,
|
|||
U32 pass,
|
||||
GFXShaderConstBuffer *shaderConsts)
|
||||
{
|
||||
// Skip this if we're rendering from the prepass bin.
|
||||
if ( sgData.binType == SceneData::PrePassBin )
|
||||
// Skip this if we're rendering from the deferred bin.
|
||||
if ( sgData.binType == SceneData::DeferredBin )
|
||||
return;
|
||||
|
||||
PROFILE_SCOPE(AdvancedLightManager_setLightInfo);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
class AvailableSLInterfaces;
|
||||
class AdvancedLightBinManager;
|
||||
class RenderPrePassMgr;
|
||||
class RenderDeferredMgr;
|
||||
class BaseMatInstance;
|
||||
class MaterialParameters;
|
||||
class MaterialParameterHandle;
|
||||
|
|
@ -115,7 +115,7 @@ protected:
|
|||
|
||||
SimObjectPtr<AdvancedLightBinManager> mLightBinManager;
|
||||
|
||||
SimObjectPtr<RenderPrePassMgr> mPrePassRenderBin;
|
||||
SimObjectPtr<RenderDeferredMgr> mDeferredRenderBin;
|
||||
|
||||
LightConstantMap mConstantLookup;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
bool AdvancedLightingFeatures::smFeaturesRegistered = false;
|
||||
|
||||
void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetFormat, const GFXFormat &lightInfoTargetFormat )
|
||||
void AdvancedLightingFeatures::registerFeatures( const GFXFormat &deferredTargetFormat, const GFXFormat &lightInfoTargetFormat )
|
||||
{
|
||||
AssertFatal( !smFeaturesRegistered, "AdvancedLightingFeatures::registerFeatures() - Features already registered. Bad!" );
|
||||
|
||||
|
|
@ -56,8 +56,8 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF
|
|||
if(GFX->getAdapterType() == OpenGL)
|
||||
{
|
||||
#if defined( TORQUE_OPENGL )
|
||||
cond = new GBufferConditionerGLSL( prepassTargetFormat, GBufferConditionerGLSL::ViewSpace );
|
||||
FEATUREMGR->registerFeature(MFT_PrePassConditioner, cond);
|
||||
cond = new GBufferConditionerGLSL( deferredTargetFormat, GBufferConditionerGLSL::ViewSpace );
|
||||
FEATUREMGR->registerFeature(MFT_DeferredConditioner, cond);
|
||||
FEATUREMGR->registerFeature(MFT_RTLighting, new DeferredRTLightingFeatGLSL());
|
||||
FEATUREMGR->registerFeature(MFT_NormalMap, new DeferredBumpFeatGLSL());
|
||||
FEATUREMGR->registerFeature(MFT_PixSpecular, new DeferredPixelSpecularGLSL());
|
||||
|
|
@ -68,8 +68,8 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF
|
|||
else
|
||||
{
|
||||
#if defined( TORQUE_OS_WIN )
|
||||
cond = new GBufferConditionerHLSL( prepassTargetFormat, GBufferConditionerHLSL::ViewSpace );
|
||||
FEATUREMGR->registerFeature(MFT_PrePassConditioner, cond);
|
||||
cond = new GBufferConditionerHLSL( deferredTargetFormat, GBufferConditionerHLSL::ViewSpace );
|
||||
FEATUREMGR->registerFeature(MFT_DeferredConditioner, cond);
|
||||
FEATUREMGR->registerFeature(MFT_RTLighting, new DeferredRTLightingFeatHLSL());
|
||||
FEATUREMGR->registerFeature(MFT_NormalMap, new DeferredBumpFeatHLSL());
|
||||
FEATUREMGR->registerFeature(MFT_PixSpecular, new DeferredPixelSpecularHLSL());
|
||||
|
|
@ -78,7 +78,7 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF
|
|||
#endif
|
||||
}
|
||||
|
||||
NamedTexTarget *target = NamedTexTarget::find( "prepass" );
|
||||
NamedTexTarget *target = NamedTexTarget::find( "deferred" );
|
||||
if ( target )
|
||||
target->setConditioner( cond );
|
||||
|
||||
|
|
@ -87,11 +87,11 @@ void AdvancedLightingFeatures::registerFeatures( const GFXFormat &prepassTargetF
|
|||
|
||||
void AdvancedLightingFeatures::unregisterFeatures()
|
||||
{
|
||||
NamedTexTarget *target = NamedTexTarget::find( "prepass" );
|
||||
NamedTexTarget *target = NamedTexTarget::find( "deferred" );
|
||||
if ( target )
|
||||
target->setConditioner( NULL );
|
||||
|
||||
FEATUREMGR->unregisterFeature(MFT_PrePassConditioner);
|
||||
FEATUREMGR->unregisterFeature(MFT_DeferredConditioner);
|
||||
FEATUREMGR->unregisterFeature(MFT_RTLighting);
|
||||
FEATUREMGR->unregisterFeature(MFT_NormalMap);
|
||||
FEATUREMGR->unregisterFeature(MFT_PixSpecular);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class AdvancedLightingFeatures
|
|||
{
|
||||
public:
|
||||
|
||||
static void registerFeatures( const GFXFormat &prepassTargetFormat, const GFXFormat &lightInfoTargetFormat );
|
||||
static void registerFeatures( const GFXFormat &deferredTargetFormat, const GFXFormat &lightInfoTargetFormat );
|
||||
static void unregisterFeatures();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "shaderGen/langElement.h"
|
||||
#include "shaderGen/shaderOp.h"
|
||||
#include "shaderGen/conditionerFeature.h"
|
||||
#include "renderInstance/renderPrePassMgr.h"
|
||||
#include "renderInstance/renderDeferredMgr.h"
|
||||
#include "materials/processedMaterial.h"
|
||||
#include "materials/materialFeatureTypes.h"
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ void DeferredRTLightingFeatGLSL::processPix( Vector<ShaderComponent*> &component
|
|||
unconditionLightInfo.c_str() ), lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular ) );
|
||||
|
||||
// If this has an interlaced pre-pass, do averaging here
|
||||
if( fd.features[MFT_InterlacedPrePass] )
|
||||
if( fd.features[MFT_InterlacedDeferred] )
|
||||
{
|
||||
Var *oneOverTargetSize = (Var*) LangElement::find( "oneOverTargetSize" );
|
||||
if( !oneOverTargetSize )
|
||||
|
|
@ -216,7 +216,7 @@ void DeferredRTLightingFeatGLSL::setTexData( Material::StageData &stageDat,
|
|||
void DeferredBumpFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd )
|
||||
{
|
||||
if( fd.features[MFT_PrePassConditioner] )
|
||||
if( fd.features[MFT_DeferredConditioner] )
|
||||
{
|
||||
// There is an output conditioner active, so we need to supply a transform
|
||||
// to the pixel shader.
|
||||
|
|
@ -264,7 +264,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// NULL output in case nothing gets handled
|
||||
output = NULL;
|
||||
|
||||
if( fd.features[MFT_PrePassConditioner] )
|
||||
if( fd.features[MFT_DeferredConditioner] )
|
||||
{
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
|
||||
// This var is read from GBufferConditionerGLSL and
|
||||
// used in the prepass output.
|
||||
// used in the deferred output.
|
||||
//
|
||||
// By using the 'half' type here we get a bunch of partial
|
||||
// precision optimized code on further operations on the normal
|
||||
|
|
@ -425,7 +425,7 @@ ShaderFeature::Resources DeferredBumpFeatGLSL::getResources( const MaterialFeatu
|
|||
res.numTex = 1;
|
||||
res.numTexReg = 1;
|
||||
|
||||
if ( fd.features[MFT_PrePassConditioner] &&
|
||||
if ( fd.features[MFT_DeferredConditioner] &&
|
||||
fd.features.hasFeature( MFT_DetailNormalMap ) )
|
||||
{
|
||||
res.numTex += 1;
|
||||
|
|
@ -450,7 +450,7 @@ void DeferredBumpFeatGLSL::setTexData( Material::StageData &stageDat,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!fd.features[MFT_PrePassConditioner] && fd.features[MFT_AccuMap])
|
||||
if (!fd.features[MFT_DeferredConditioner] && fd.features[MFT_AccuMap])
|
||||
{
|
||||
passData.mTexType[texIndex] = Material::Bump;
|
||||
passData.mSamplerNames[texIndex] = "bumpMap";
|
||||
|
|
@ -464,14 +464,14 @@ void DeferredBumpFeatGLSL::setTexData( Material::StageData &stageDat,
|
|||
}
|
||||
}
|
||||
else if (!fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] &&
|
||||
( fd.features[MFT_PrePassConditioner] ||
|
||||
( fd.features[MFT_DeferredConditioner] ||
|
||||
fd.features[MFT_PixSpecular] ) )
|
||||
{
|
||||
passData.mTexType[ texIndex ] = Material::Bump;
|
||||
passData.mSamplerNames[ texIndex ] = "bumpMap";
|
||||
passData.mTexSlot[ texIndex++ ].texObject = stageDat.getTex( MFT_NormalMap );
|
||||
|
||||
if ( fd.features[MFT_PrePassConditioner] &&
|
||||
if ( fd.features[MFT_DeferredConditioner] &&
|
||||
fd.features.hasFeature( MFT_DetailNormalMap ) )
|
||||
{
|
||||
passData.mTexType[ texIndex ] = Material::DetailBump;
|
||||
|
|
@ -604,11 +604,11 @@ void DeferredMinnaertGLSL::setTexData( Material::StageData &stageDat,
|
|||
{
|
||||
if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] )
|
||||
{
|
||||
NamedTexTarget *texTarget = NamedTexTarget::find(RenderPrePassMgr::BufferName);
|
||||
NamedTexTarget *texTarget = NamedTexTarget::find(RenderDeferredMgr::BufferName);
|
||||
if ( texTarget )
|
||||
{
|
||||
passData.mTexType[texIndex] = Material::TexTarget;
|
||||
passData.mSamplerNames[texIndex] = "prepassBuffer";
|
||||
passData.mSamplerNames[texIndex] = "deferredBuffer";
|
||||
passData.mTexSlot[ texIndex++ ].texTarget = texTarget;
|
||||
}
|
||||
}
|
||||
|
|
@ -620,11 +620,11 @@ void DeferredMinnaertGLSL::processPixMacros( Vector<GFXShaderMacro> ¯os,
|
|||
if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] )
|
||||
{
|
||||
// Pull in the uncondition method for the g buffer
|
||||
NamedTexTarget *texTarget = NamedTexTarget::find( RenderPrePassMgr::BufferName );
|
||||
NamedTexTarget *texTarget = NamedTexTarget::find( RenderDeferredMgr::BufferName );
|
||||
if ( texTarget && texTarget->getConditioner() )
|
||||
{
|
||||
ConditionerMethodDependency *unconditionMethod = texTarget->getConditioner()->getConditionerMethodDependency(ConditionerFeature::UnconditionMethod);
|
||||
unconditionMethod->createMethodMacro( String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition", macros );
|
||||
unconditionMethod->createMethodMacro( String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition", macros );
|
||||
addDependency(unconditionMethod);
|
||||
}
|
||||
}
|
||||
|
|
@ -664,12 +664,12 @@ void DeferredMinnaertGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
minnaertConstant->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
// create texture var
|
||||
Var *prepassBuffer = new Var;
|
||||
prepassBuffer->setType( "sampler2D" );
|
||||
prepassBuffer->setName( "prepassBuffer" );
|
||||
prepassBuffer->uniform = true;
|
||||
prepassBuffer->sampler = true;
|
||||
prepassBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
Var *deferredBuffer = new Var;
|
||||
deferredBuffer->setType( "sampler2D" );
|
||||
deferredBuffer->setName( "deferredBuffer" );
|
||||
deferredBuffer->uniform = true;
|
||||
deferredBuffer->sampler = true;
|
||||
deferredBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
// Texture coord
|
||||
Var *uvScene = (Var*) LangElement::find( "uvScene" );
|
||||
|
|
@ -680,11 +680,11 @@ void DeferredMinnaertGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// Get the world space view vector.
|
||||
Var *wsViewVec = getWsView( getInWsPosition( componentList ), meta );
|
||||
|
||||
String unconditionPrePassMethod = String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition";
|
||||
String unconditionDeferredMethod = String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition";
|
||||
|
||||
Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" );
|
||||
|
||||
meta->addStatement( new GenOp( avar( " vec4 normalDepth = %s(@, @);\r\n", unconditionPrePassMethod.c_str() ), prepassBuffer, uvScene ) );
|
||||
meta->addStatement( new GenOp( avar( " vec4 normalDepth = %s(@, @);\r\n", unconditionDeferredMethod.c_str() ), deferredBuffer, uvScene ) );
|
||||
meta->addStatement( new GenOp( " float vDotN = dot(normalDepth.xyz, @);\r\n", wsViewVec ) );
|
||||
meta->addStatement( new GenOp( " float Minnaert = pow( @, @) * pow(vDotN, 1.0 - @);\r\n", d_NL_Att, minnaertConstant, minnaertConstant ) );
|
||||
meta->addStatement( new GenOp( " @;\r\n", assignColor( new GenOp( "vec4(Minnaert, Minnaert, Minnaert, 1.0)" ), Material::Mul ) ) );
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@
|
|||
class ConditionerMethodDependency;
|
||||
|
||||
|
||||
/// Lights the pixel by sampling from the light prepass
|
||||
/// Lights the pixel by sampling from the light deferred
|
||||
/// buffer. It will fall back to forward lighting
|
||||
/// functionality for non-deferred rendered surfaces.
|
||||
///
|
||||
/// Also note that this feature is only used in the
|
||||
/// forward rendering pass. It is not used during the
|
||||
/// prepass step.
|
||||
/// deferred step.
|
||||
///
|
||||
class DeferredRTLightingFeatGLSL : public RTLightingFeatGLSL
|
||||
{
|
||||
|
|
@ -103,7 +103,7 @@ public:
|
|||
|
||||
|
||||
/// Generates specular highlights in the forward pass
|
||||
/// from the light prepass buffer.
|
||||
/// from the light deferred buffer.
|
||||
class DeferredPixelSpecularGLSL : public PixelSpecularGLSL
|
||||
{
|
||||
typedef PixelSpecularGLSL Parent;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "shaderGen/langElement.h"
|
||||
#include "shaderGen/shaderOp.h"
|
||||
#include "shaderGen/conditionerFeature.h"
|
||||
#include "renderInstance/renderPrePassMgr.h"
|
||||
#include "renderInstance/renderDeferredMgr.h"
|
||||
#include "materials/processedMaterial.h"
|
||||
#include "materials/materialFeatureTypes.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ void GBufferConditionerGLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
|
||||
LangElement *outputDecl = new DecOp( unconditionedOut );
|
||||
|
||||
// If we're doing prepass blending then we need
|
||||
// If we're doing deferred blending then we need
|
||||
// to steal away the alpha channel before the
|
||||
// conditioner stomps on it.
|
||||
Var *alphaVal = NULL;
|
||||
|
|
@ -174,7 +174,7 @@ void GBufferConditionerGLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
}
|
||||
|
||||
// If using interlaced normals, invert the normal
|
||||
if(fd.features[MFT_InterlacedPrePass])
|
||||
if(fd.features[MFT_InterlacedDeferred])
|
||||
{
|
||||
// NOTE: Its safe to not call ShaderFeatureGLSL::addOutVpos() in the vertex
|
||||
// shader as for SM 3.0 nothing is needed there.
|
||||
|
|
@ -190,7 +190,7 @@ void GBufferConditionerGLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
meta->addStatement( new GenOp(" @ = @;", outputDecl, new GenOp( "float4(normalize(@), @)", gbNormal, depth ) ) );
|
||||
meta->addStatement( assignOutput( unconditionedOut ) );
|
||||
|
||||
// If we have an alpha var then we're doing prepass lerp blending.
|
||||
// If we have an alpha var then we're doing deferred lerp blending.
|
||||
if ( alphaVal )
|
||||
{
|
||||
Var *outColor = (Var*)LangElement::find( getOutputTargetVarName( DefaultTarget ) );
|
||||
|
|
@ -227,10 +227,10 @@ Var* GBufferConditionerGLSL::printMethodHeader( MethodType methodType, const Str
|
|||
methodVar->setType("float4");
|
||||
DecOp *methodDecl = new DecOp(methodVar);
|
||||
|
||||
Var *prepassSampler = new Var;
|
||||
prepassSampler->setName("prepassSamplerVar");
|
||||
prepassSampler->setType("sampler2D");
|
||||
DecOp *prepassSamplerDecl = new DecOp(prepassSampler);
|
||||
Var *deferredSampler = new Var;
|
||||
deferredSampler->setName("deferredSamplerVar");
|
||||
deferredSampler->setType("sampler2D");
|
||||
DecOp *deferredSamplerDecl = new DecOp(deferredSampler);
|
||||
|
||||
Var *screenUV = new Var;
|
||||
screenUV->setName("screenUVVar");
|
||||
|
|
@ -242,7 +242,7 @@ Var* GBufferConditionerGLSL::printMethodHeader( MethodType methodType, const Str
|
|||
bufferSample->setType("float4");
|
||||
DecOp *bufferSampleDecl = new DecOp(bufferSample);
|
||||
|
||||
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, prepassSamplerDecl, screenUVDecl ) );
|
||||
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, deferredSamplerDecl, screenUVDecl ) );
|
||||
|
||||
meta->addStatement( new GenOp( "{\r\n" ) );
|
||||
|
||||
|
|
@ -250,14 +250,14 @@ Var* GBufferConditionerGLSL::printMethodHeader( MethodType methodType, const Str
|
|||
|
||||
#ifdef TORQUE_OS_XENON
|
||||
meta->addStatement( new GenOp( " @;\r\n", bufferSampleDecl ) );
|
||||
meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, prepassSampler ) );
|
||||
meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, deferredSampler ) );
|
||||
#else
|
||||
// The gbuffer has no mipmaps, so use tex2dlod when
|
||||
// possible so that the shader compiler can optimize.
|
||||
meta->addStatement( new GenOp( " #if TORQUE_SM >= 30\r\n" ) );
|
||||
meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, prepassSampler, screenUV ) );
|
||||
meta->addStatement( new GenOp( " @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, deferredSampler, screenUV ) );
|
||||
meta->addStatement( new GenOp( " #else\r\n" ) );
|
||||
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV ) );
|
||||
meta->addStatement( new GenOp( " @ = tex2D(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV ) );
|
||||
meta->addStatement( new GenOp( " #endif\r\n\r\n" ) );
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "shaderGen/langElement.h"
|
||||
#include "shaderGen/shaderOp.h"
|
||||
#include "shaderGen/conditionerFeature.h"
|
||||
#include "renderInstance/renderPrePassMgr.h"
|
||||
#include "renderInstance/renderDeferredMgr.h"
|
||||
#include "materials/processedMaterial.h"
|
||||
#include "materials/materialFeatureTypes.h"
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
unconditionLightInfo.c_str()), lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular));
|
||||
|
||||
// If this has an interlaced pre-pass, do averaging here
|
||||
if( fd.features[MFT_InterlacedPrePass] )
|
||||
if( fd.features[MFT_InterlacedDeferred] )
|
||||
{
|
||||
Var *oneOverTargetSize = (Var*) LangElement::find( "oneOverTargetSize" );
|
||||
if( !oneOverTargetSize )
|
||||
|
|
@ -236,7 +236,7 @@ void DeferredRTLightingFeatHLSL::setTexData( Material::StageData &stageDat,
|
|||
void DeferredBumpFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd )
|
||||
{
|
||||
if( fd.features[MFT_PrePassConditioner] )
|
||||
if( fd.features[MFT_DeferredConditioner] )
|
||||
{
|
||||
// There is an output conditioner active, so we need to supply a transform
|
||||
// to the pixel shader.
|
||||
|
|
@ -284,7 +284,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// NULL output in case nothing gets handled
|
||||
output = NULL;
|
||||
|
||||
if( fd.features[MFT_PrePassConditioner] )
|
||||
if( fd.features[MFT_DeferredConditioner] )
|
||||
{
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
|
||||
// This var is read from GBufferConditionerHLSL and
|
||||
// used in the prepass output.
|
||||
// used in the deferred output.
|
||||
//
|
||||
// By using the 'half' type here we get a bunch of partial
|
||||
// precision optimized code on further operations on the normal
|
||||
|
|
@ -500,7 +500,7 @@ ShaderFeature::Resources DeferredBumpFeatHLSL::getResources( const MaterialFeatu
|
|||
res.numTex = 1;
|
||||
res.numTexReg = 1;
|
||||
|
||||
if ( fd.features[MFT_PrePassConditioner] &&
|
||||
if ( fd.features[MFT_DeferredConditioner] &&
|
||||
fd.features.hasFeature( MFT_DetailNormalMap ) )
|
||||
{
|
||||
res.numTex += 1;
|
||||
|
|
@ -525,7 +525,7 @@ void DeferredBumpFeatHLSL::setTexData( Material::StageData &stageDat,
|
|||
return;
|
||||
}
|
||||
|
||||
if ( !fd.features[MFT_PrePassConditioner] && fd.features[MFT_AccuMap] )
|
||||
if ( !fd.features[MFT_DeferredConditioner] && fd.features[MFT_AccuMap] )
|
||||
{
|
||||
passData.mTexType[ texIndex ] = Material::Bump;
|
||||
passData.mSamplerNames[ texIndex ] = "bumpMap";
|
||||
|
|
@ -539,14 +539,14 @@ void DeferredBumpFeatHLSL::setTexData( Material::StageData &stageDat,
|
|||
}
|
||||
}
|
||||
else if ( !fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] &&
|
||||
( fd.features[MFT_PrePassConditioner] ||
|
||||
( fd.features[MFT_DeferredConditioner] ||
|
||||
fd.features[MFT_PixSpecular] ) )
|
||||
{
|
||||
passData.mTexType[ texIndex ] = Material::Bump;
|
||||
passData.mSamplerNames[ texIndex ] = "bumpMap";
|
||||
passData.mTexSlot[ texIndex++ ].texObject = stageDat.getTex( MFT_NormalMap );
|
||||
|
||||
if ( fd.features[MFT_PrePassConditioner] &&
|
||||
if ( fd.features[MFT_DeferredConditioner] &&
|
||||
fd.features.hasFeature( MFT_DetailNormalMap ) )
|
||||
{
|
||||
passData.mTexType[ texIndex ] = Material::DetailBump;
|
||||
|
|
@ -681,11 +681,11 @@ void DeferredMinnaertHLSL::setTexData( Material::StageData &stageDat,
|
|||
{
|
||||
if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] )
|
||||
{
|
||||
NamedTexTarget *texTarget = NamedTexTarget::find(RenderPrePassMgr::BufferName);
|
||||
NamedTexTarget *texTarget = NamedTexTarget::find(RenderDeferredMgr::BufferName);
|
||||
if ( texTarget )
|
||||
{
|
||||
passData.mTexType[texIndex] = Material::TexTarget;
|
||||
passData.mSamplerNames[texIndex] = "prepassBuffer";
|
||||
passData.mSamplerNames[texIndex] = "deferredBuffer";
|
||||
passData.mTexSlot[ texIndex++ ].texTarget = texTarget;
|
||||
}
|
||||
}
|
||||
|
|
@ -697,11 +697,11 @@ void DeferredMinnaertHLSL::processPixMacros( Vector<GFXShaderMacro> ¯os,
|
|||
if( !fd.features[MFT_ForwardShading] && fd.features[MFT_RTLighting] )
|
||||
{
|
||||
// Pull in the uncondition method for the g buffer
|
||||
NamedTexTarget *texTarget = NamedTexTarget::find( RenderPrePassMgr::BufferName );
|
||||
NamedTexTarget *texTarget = NamedTexTarget::find( RenderDeferredMgr::BufferName );
|
||||
if ( texTarget && texTarget->getConditioner() )
|
||||
{
|
||||
ConditionerMethodDependency *unconditionMethod = texTarget->getConditioner()->getConditionerMethodDependency(ConditionerFeature::UnconditionMethod);
|
||||
unconditionMethod->createMethodMacro( String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition", macros );
|
||||
unconditionMethod->createMethodMacro( String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition", macros );
|
||||
addDependency(unconditionMethod);
|
||||
}
|
||||
}
|
||||
|
|
@ -741,23 +741,23 @@ void DeferredMinnaertHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
minnaertConstant->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
// create texture var
|
||||
Var *prepassBuffer = new Var;
|
||||
prepassBuffer->setType( "sampler2D" );
|
||||
prepassBuffer->setName( "prepassBuffer" );
|
||||
prepassBuffer->uniform = true;
|
||||
prepassBuffer->sampler = true;
|
||||
prepassBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
Var *deferredBuffer = new Var;
|
||||
deferredBuffer->setType( "sampler2D" );
|
||||
deferredBuffer->setName( "deferredBuffer" );
|
||||
deferredBuffer->uniform = true;
|
||||
deferredBuffer->sampler = true;
|
||||
deferredBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* prePassTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
prepassBuffer->setType("SamplerState");
|
||||
deferredBuffer->setType("SamplerState");
|
||||
prePassTex = new Var;
|
||||
prePassTex->setName("prePassTex");
|
||||
prePassTex->setType("Texture2D");
|
||||
prePassTex->uniform = true;
|
||||
prePassTex->texture = true;
|
||||
prePassTex->constNum = prepassBuffer->constNum;
|
||||
prePassTex->constNum = deferredBuffer->constNum;
|
||||
}
|
||||
|
||||
// Texture coord
|
||||
|
|
@ -769,14 +769,14 @@ void DeferredMinnaertHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// Get the world space view vector.
|
||||
Var *wsViewVec = getWsView( getInWsPosition( componentList ), meta );
|
||||
|
||||
String unconditionPrePassMethod = String::ToLower(RenderPrePassMgr::BufferName) + "Uncondition";
|
||||
String unconditionDeferredMethod = String::ToLower(RenderDeferredMgr::BufferName) + "Uncondition";
|
||||
|
||||
Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" );
|
||||
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionPrePassMethod.c_str()), prepassBuffer, prePassTex, uvScene));
|
||||
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, prePassTex, uvScene));
|
||||
else
|
||||
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, @);\r\n", unconditionPrePassMethod.c_str()), prepassBuffer, uvScene));
|
||||
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, uvScene));
|
||||
|
||||
meta->addStatement( new GenOp( " float vDotN = dot(normalDepth.xyz, @);\r\n", wsViewVec ) );
|
||||
meta->addStatement( new GenOp( " float Minnaert = pow( @, @) * pow(vDotN, 1.0 - @);\r\n", d_NL_Att, minnaertConstant, minnaertConstant ) );
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@
|
|||
class ConditionerMethodDependency;
|
||||
|
||||
|
||||
/// Lights the pixel by sampling from the light prepass
|
||||
/// Lights the pixel by sampling from the light deferred
|
||||
/// buffer. It will fall back to forward lighting
|
||||
/// functionality for non-deferred rendered surfaces.
|
||||
///
|
||||
/// Also note that this feature is only used in the
|
||||
/// forward rendering pass. It is not used during the
|
||||
/// prepass step.
|
||||
/// deferred step.
|
||||
///
|
||||
class DeferredRTLightingFeatHLSL : public RTLightingFeatHLSL
|
||||
{
|
||||
|
|
@ -103,7 +103,7 @@ public:
|
|||
|
||||
|
||||
/// Generates specular highlights in the forward pass
|
||||
/// from the light prepass buffer.
|
||||
/// from the light deferred buffer.
|
||||
class DeferredPixelSpecularHLSL : public PixelSpecularHLSL
|
||||
{
|
||||
typedef PixelSpecularHLSL Parent;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "shaderGen/langElement.h"
|
||||
#include "shaderGen/shaderOp.h"
|
||||
#include "shaderGen/conditionerFeature.h"
|
||||
#include "renderInstance/renderPrePassMgr.h"
|
||||
#include "renderInstance/renderDeferredMgr.h"
|
||||
#include "materials/processedMaterial.h"
|
||||
#include "materials/materialFeatureTypes.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ void GBufferConditionerHLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
|
||||
LangElement *outputDecl = new DecOp( unconditionedOut );
|
||||
|
||||
// If we're doing prepass blending then we need
|
||||
// If we're doing deferred blending then we need
|
||||
// to steal away the alpha channel before the
|
||||
// conditioner stomps on it.
|
||||
Var *alphaVal = NULL;
|
||||
|
|
@ -174,7 +174,7 @@ void GBufferConditionerHLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
}
|
||||
|
||||
// If using interlaced normals, invert the normal
|
||||
if(fd.features[MFT_InterlacedPrePass])
|
||||
if(fd.features[MFT_InterlacedDeferred])
|
||||
{
|
||||
// NOTE: Its safe to not call ShaderFeatureHLSL::addOutVpos() in the vertex
|
||||
// shader as for SM 3.0 nothing is needed there.
|
||||
|
|
@ -190,7 +190,7 @@ void GBufferConditionerHLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
meta->addStatement( new GenOp(" @ = @;", outputDecl, new GenOp( "float4(normalize(@), @)", gbNormal, depth ) ) );
|
||||
meta->addStatement( assignOutput( unconditionedOut ) );
|
||||
|
||||
// If we have an alpha var then we're doing prepass lerp blending.
|
||||
// If we have an alpha var then we're doing deferred lerp blending.
|
||||
if ( alphaVal )
|
||||
{
|
||||
Var *outColor = (Var*)LangElement::find( getOutputTargetVarName( DefaultTarget ) );
|
||||
|
|
@ -228,27 +228,27 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
|
|||
methodVar->setType("inline float4");
|
||||
DecOp *methodDecl = new DecOp(methodVar);
|
||||
|
||||
Var *prepassSampler = new Var;
|
||||
prepassSampler->setName("prepassSamplerVar");
|
||||
prepassSampler->setType("sampler2D");
|
||||
DecOp *prepassSamplerDecl = new DecOp(prepassSampler);
|
||||
Var *deferredSampler = new Var;
|
||||
deferredSampler->setName("deferredSamplerVar");
|
||||
deferredSampler->setType("sampler2D");
|
||||
DecOp *deferredSamplerDecl = new DecOp(deferredSampler);
|
||||
|
||||
Var *screenUV = new Var;
|
||||
screenUV->setName("screenUVVar");
|
||||
screenUV->setType("float2");
|
||||
DecOp *screenUVDecl = new DecOp(screenUV);
|
||||
|
||||
Var *prepassTex = NULL;
|
||||
DecOp *prepassTexDecl = NULL;
|
||||
Var *deferredTex = NULL;
|
||||
DecOp *deferredTexDecl = NULL;
|
||||
if (isDirect3D11)
|
||||
{
|
||||
prepassSampler->setType("SamplerState");
|
||||
prepassTex = new Var;
|
||||
prepassTex->setName("prepassTexVar");
|
||||
prepassTex->setType("Texture2D");
|
||||
prepassTex->texture = true;
|
||||
prepassTex->constNum = prepassSampler->constNum;
|
||||
prepassTexDecl = new DecOp(prepassTex);
|
||||
deferredSampler->setType("SamplerState");
|
||||
deferredTex = new Var;
|
||||
deferredTex->setName("deferredTexVar");
|
||||
deferredTex->setType("Texture2D");
|
||||
deferredTex->texture = true;
|
||||
deferredTex->constNum = deferredSampler->constNum;
|
||||
deferredTexDecl = new DecOp(deferredTex);
|
||||
}
|
||||
|
||||
Var *bufferSample = new Var;
|
||||
|
|
@ -257,9 +257,9 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
|
|||
DecOp *bufferSampleDecl = new DecOp(bufferSample);
|
||||
|
||||
if (isDirect3D11)
|
||||
meta->addStatement(new GenOp("@(@, @, @)\r\n", methodDecl, prepassSamplerDecl, prepassTexDecl, screenUVDecl));
|
||||
meta->addStatement(new GenOp("@(@, @, @)\r\n", methodDecl, deferredSamplerDecl, deferredTexDecl, screenUVDecl));
|
||||
else
|
||||
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, prepassSamplerDecl, screenUVDecl ) );
|
||||
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, deferredSamplerDecl, screenUVDecl ) );
|
||||
|
||||
meta->addStatement( new GenOp( "{\r\n" ) );
|
||||
|
||||
|
|
@ -267,18 +267,18 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
|
|||
|
||||
#ifdef TORQUE_OS_XENON
|
||||
meta->addStatement( new GenOp( " @;\r\n", bufferSampleDecl ) );
|
||||
meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, prepassSampler ) );
|
||||
meta->addStatement( new GenOp( " asm { tfetch2D @, @, @, MagFilter = point, MinFilter = point, MipFilter = point };\r\n", bufferSample, screenUV, deferredSampler ) );
|
||||
#else
|
||||
// The gbuffer has no mipmaps, so use tex2dlod when
|
||||
// possible so that the shader compiler can optimize.
|
||||
meta->addStatement( new GenOp( " #if TORQUE_SM >= 30\r\n" ) );
|
||||
if (isDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.SampleLevel(@, @,0);\r\n", bufferSampleDecl, prepassTex, prepassSampler, screenUV));
|
||||
meta->addStatement(new GenOp(" @ = @.SampleLevel(@, @,0);\r\n", bufferSampleDecl, deferredTex, deferredSampler, screenUV));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, prepassSampler, screenUV));
|
||||
meta->addStatement(new GenOp(" @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, deferredSampler, screenUV));
|
||||
|
||||
meta->addStatement(new GenOp(" #else\r\n"));
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", bufferSampleDecl, prepassSampler, screenUV));
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV));
|
||||
meta->addStatement(new GenOp(" #endif\r\n\r\n"));
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#include "materials/materialFeatureTypes.h"
|
||||
#include "math/util/frustum.h"
|
||||
#include "scene/sceneObject.h"
|
||||
#include "renderInstance/renderPrePassMgr.h"
|
||||
#include "renderInstance/renderDeferredMgr.h"
|
||||
#include "shaderGen/featureMgr.h"
|
||||
#include "shaderGen/HLSL/shaderFeatureHLSL.h"
|
||||
#include "shaderGen/HLSL/bumpHLSL.h"
|
||||
|
|
@ -184,8 +184,8 @@ void BasicLightManager::activate( SceneManager *sceneManager )
|
|||
FEATUREMGR->unregisterFeature( MFT_MinnaertShading );
|
||||
FEATUREMGR->unregisterFeature( MFT_SubSurface );
|
||||
|
||||
// First look for the prepass bin...
|
||||
RenderPrePassMgr *prePassBin = _findPrePassRenderBin();
|
||||
// First look for the deferred bin...
|
||||
RenderDeferredMgr *prePassBin = _findDeferredRenderBin();
|
||||
|
||||
/*
|
||||
// If you would like to use forward shading, and have a linear depth pre-pass
|
||||
|
|
@ -204,19 +204,19 @@ void BasicLightManager::activate( SceneManager *sceneManager )
|
|||
// Uncomment this for a no-color-write z-fill pass.
|
||||
//linearDepthFormat = GFXFormat_COUNT;
|
||||
|
||||
prePassBin = new RenderPrePassMgr( linearDepthFormat != GFXFormat_COUNT, linearDepthFormat );
|
||||
prePassBin = new RenderDeferredMgr( linearDepthFormat != GFXFormat_COUNT, linearDepthFormat );
|
||||
prePassBin->registerObject();
|
||||
rpm->addManager( prePassBin );
|
||||
}
|
||||
*/
|
||||
mPrePassRenderBin = prePassBin;
|
||||
mDeferredRenderBin = prePassBin;
|
||||
|
||||
// If there is a prepass bin
|
||||
MATMGR->setPrePassEnabled( mPrePassRenderBin.isValid() );
|
||||
sceneManager->setPostEffectFog( mPrePassRenderBin.isValid() && mPrePassRenderBin->getTargetChainLength() > 0 );
|
||||
// If there is a deferred bin
|
||||
MATMGR->setDeferredEnabled( mDeferredRenderBin.isValid() );
|
||||
sceneManager->setPostEffectFog( mDeferredRenderBin.isValid() && mDeferredRenderBin->getTargetChainLength() > 0 );
|
||||
|
||||
// Tell the material manager that we don't use prepass.
|
||||
MATMGR->setPrePassEnabled( false );
|
||||
// Tell the material manager that we don't use deferred.
|
||||
MATMGR->setDeferredEnabled( false );
|
||||
|
||||
GFXShader::addGlobalMacro( "TORQUE_BASIC_LIGHTING" );
|
||||
|
||||
|
|
@ -241,9 +241,9 @@ void BasicLightManager::deactivate()
|
|||
}
|
||||
mConstantLookup.clear();
|
||||
|
||||
if ( mPrePassRenderBin )
|
||||
mPrePassRenderBin->deleteObject();
|
||||
mPrePassRenderBin = NULL;
|
||||
if ( mDeferredRenderBin )
|
||||
mDeferredRenderBin->deleteObject();
|
||||
mDeferredRenderBin = NULL;
|
||||
|
||||
GFXShader::removeGlobalMacro( "TORQUE_BASIC_LIGHTING" );
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
class AvailableSLInterfaces;
|
||||
class GFXShaderConstHandle;
|
||||
class RenderPrePassMgr;
|
||||
class RenderDeferredMgr;
|
||||
class PlatformTimer;
|
||||
|
||||
class blTerrainSystem;
|
||||
|
|
@ -77,7 +77,7 @@ protected:
|
|||
BasicLightManager();
|
||||
virtual ~BasicLightManager();
|
||||
|
||||
SimObjectPtr<RenderPrePassMgr> mPrePassRenderBin;
|
||||
SimObjectPtr<RenderDeferredMgr> mDeferredRenderBin;
|
||||
|
||||
struct LightingShaderConstants
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#include "T3D/gameBase/gameConnection.h"
|
||||
#include "gfx/gfxStringEnumTranslate.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "renderInstance/renderPrePassMgr.h"
|
||||
#include "renderInstance/renderDeferredMgr.h"
|
||||
|
||||
|
||||
Signal<void(const char*,bool)> LightManager::smActivateSignal;
|
||||
|
|
@ -419,15 +419,15 @@ bool LightManager::lightScene( const char* callback, const char* param )
|
|||
return sl->lightScene( callback, flags );
|
||||
}
|
||||
|
||||
RenderPrePassMgr* LightManager::_findPrePassRenderBin()
|
||||
RenderDeferredMgr* LightManager::_findDeferredRenderBin()
|
||||
{
|
||||
RenderPassManager* rpm = getSceneManager()->getDefaultRenderPass();
|
||||
for( U32 i = 0; i < rpm->getManagerCount(); i++ )
|
||||
{
|
||||
RenderBinManager *bin = rpm->getManager( i );
|
||||
if( bin->getRenderInstType() == RenderPrePassMgr::RIT_PrePass )
|
||||
if( bin->getRenderInstType() == RenderDeferredMgr::RIT_Deferred )
|
||||
{
|
||||
return ( RenderPrePassMgr* ) bin;
|
||||
return ( RenderDeferredMgr* ) bin;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class GFXShaderConstBuffer;
|
|||
class GFXShaderConstHandle;
|
||||
class ShaderConstHandles;
|
||||
class SceneRenderState;
|
||||
class RenderPrePassMgr;
|
||||
class RenderDeferredMgr;
|
||||
class Frustum;
|
||||
|
||||
///
|
||||
|
|
@ -167,7 +167,7 @@ protected:
|
|||
static LightManager *smActiveLM;
|
||||
|
||||
/// Find the pre-pass render bin on the scene's default render pass.
|
||||
RenderPrePassMgr* _findPrePassRenderBin();
|
||||
RenderDeferredMgr* _findDeferredRenderBin();
|
||||
|
||||
/// This helper function sets the shader constansts
|
||||
/// for the stock 4 light forward lighting code.
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ void LightingShaderConstants::init(GFXShader* shader)
|
|||
mLightSpotParamsSC = shader->getShaderConstHandle("$lightSpotParams");
|
||||
|
||||
// NOTE: These are the shader constants used for doing lighting
|
||||
// during the forward pass. Do not confuse these for the prepass
|
||||
// during the forward pass. Do not confuse these for the deferred
|
||||
// lighting constants which are used from AdvancedLightBinManager.
|
||||
mLightPositionSC = shader->getShaderConstHandle( ShaderGenVars::lightPosition );
|
||||
mLightDiffuseSC = shader->getShaderConstHandle( ShaderGenVars::lightDiffuse );
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ struct LightingShaderConstants
|
|||
|
||||
// NOTE: These are the shader constants used for doing
|
||||
// lighting during the forward pass. Do not confuse
|
||||
// these for the prepass lighting constants which are
|
||||
// these for the deferred lighting constants which are
|
||||
// used from AdvancedLightBinManager.
|
||||
GFXShaderConstHandle *mLightPositionSC;
|
||||
GFXShaderConstHandle *mLightDiffuseSC;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ void ShadowMaterialHook::init( BaseMatInstance *inMat )
|
|||
forced.setBlend( false );
|
||||
forced.setAlphaTest( false );
|
||||
|
||||
// We should force on zwrite as the prepass
|
||||
// We should force on zwrite as the deferred
|
||||
// will disable it by default.
|
||||
forced.setZReadWrite( true, true );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue