Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for compiling without Advanced Lighting #331

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Engine/source/T3D/levelInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
#include "console/consoleTypes.h"
#include "core/stream/bitStream.h"
#include "scene/sceneManager.h"
#if defined(TORQUE_ADVANCED_LIGHTING)
#include "lighting/advanced/advancedLightManager.h"
#include "lighting/advanced/advancedLightBinManager.h"
#endif
#include "sfx/sfxAmbience.h"
#include "sfx/sfxSoundscape.h"
#include "sfx/sfxSystem.h"
Expand Down Expand Up @@ -101,16 +103,21 @@ LevelInfo::LevelInfo()
mAccuTextureName = "";
mAccuTexture = NULL;

#if defined(TORQUE_ADVANCED_LIGHTING)
// Register with the light manager activation signal, and we need to do it first
// so the advanced light bin manager can be instructed about MRT lightmaps
LightManager::smActivateSignal.notify(this, &LevelInfo::_onLMActivate, 0.01f);
#endif
}

//-----------------------------------------------------------------------------

LevelInfo::~LevelInfo()
{
#if defined(TORQUE_ADVANCED_LIGHTING)
LightManager::smActivateSignal.remove(this, &LevelInfo::_onLMActivate);
#endif

if (!mAccuTexture.isNull())
{
mAccuTexture.free();
Expand Down Expand Up @@ -334,7 +341,7 @@ void LevelInfo::_updateSceneGraph()
// If the level info specifies that MRT pre-pass should be used in this scene
// enable it via the appropriate light manager
// (Basic lighting doesn't do anything different right now)
#ifndef TORQUE_DEDICATED
#if !defined(TORQUE_DEDICATED) && defined(TORQUE_ADVANCED_LIGHTING)
if(isClientObject())
_onLMActivate(LIGHTMGR->getId(), true);
#endif
Expand All @@ -347,7 +354,7 @@ void LevelInfo::_updateSceneGraph()

void LevelInfo::_onLMActivate(const char *lm, bool enable)
{
#ifndef TORQUE_DEDICATED
#if !defined(TORQUE_DEDICATED) && defined(TORQUE_ADVANCED_LIGHTING)
// Advanced light manager
if(enable && String(lm) == String("ADVLM"))
{
Expand Down
4 changes: 4 additions & 0 deletions Engine/source/shaderGen/GLSL/shaderGenGLSLInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
#include "shaderGen/GLSL/accuFeatureGLSL.h"

// Deferred Shading
#if defined(TORQUE_ADVANCED_LIGHTING)
#include "lighting/advanced/glsl/deferredShadingFeaturesGLSL.h"
#endif

static ShaderGen::ShaderGenInitDelegate sInitDelegate;

Expand Down Expand Up @@ -98,12 +100,14 @@ void _initShaderGenGLSL( ShaderGen *shaderGen )
FEATUREMGR->registerFeature( MFT_ImposterVert, new ImposterVertFeatureGLSL );

// Deferred Shading
#if defined(TORQUE_ADVANCED_LIGHTING)
FEATUREMGR->registerFeature( MFT_isDeferred, new NamedFeatureGLSL( "Deferred Material" ) );
FEATUREMGR->registerFeature( MFT_PBRConfigMap, new PBRConfigMapGLSL );
FEATUREMGR->registerFeature( MFT_PBRConfigVars, new PBRConfigVarsGLSL );
FEATUREMGR->registerFeature( MFT_MatInfoFlags, new MatInfoFlagsGLSL );
FEATUREMGR->registerFeature( MFT_GlowMap, new GlowMapGLSL);
FEATUREMGR->registerFeature( MFT_isBackground, new NamedFeatureGLSL("Background Object"));
#endif
FEATUREMGR->registerFeature( MFT_SkyBox, new NamedFeatureGLSL( "skybox" ) );
FEATUREMGR->registerFeature( MFT_HardwareSkinning, new HardwareSkinningFeatureGLSL );
}
Expand Down
5 changes: 4 additions & 1 deletion Engine/source/shaderGen/HLSL/shaderGenHLSLInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
#include "materials/materialFeatureTypes.h"
#include "core/module.h"
// Deferred Shading
#if defined(TORQUE_ADVANCED_LIGHTING)
#include "lighting/advanced/hlsl/deferredShadingFeaturesHLSL.h"
#endif
#include "shaderGen/HLSL/accuFeatureHLSL.h"

static ShaderGen::ShaderGenInitDelegate sInitDelegate;
Expand Down Expand Up @@ -100,13 +102,14 @@ void _initShaderGenHLSL( ShaderGen *shaderGen )
FEATUREMGR->registerFeature( MFT_ForwardShading, new NamedFeatureHLSL( "Forward Shaded Material" ) );

FEATUREMGR->registerFeature( MFT_ImposterVert, new ImposterVertFeatureHLSL );

#if defined(TORQUE_ADVANCED_LIGHTING)
FEATUREMGR->registerFeature( MFT_isDeferred, new NamedFeatureHLSL( "Deferred Material" ) );
FEATUREMGR->registerFeature( MFT_PBRConfigMap, new PBRConfigMapHLSL);
FEATUREMGR->registerFeature( MFT_PBRConfigVars, new PBRConfigVarsHLSL);
FEATUREMGR->registerFeature( MFT_MatInfoFlags, new MatInfoFlagsHLSL );
FEATUREMGR->registerFeature( MFT_GlowMap, new GlowMapHLSL);
FEATUREMGR->registerFeature( MFT_isBackground, new NamedFeatureHLSL("Background Object"));
#endif
FEATUREMGR->registerFeature( MFT_SkyBox, new NamedFeatureHLSL( "skybox" ) );
FEATUREMGR->registerFeature( MFT_HardwareSkinning, new HardwareSkinningFeatureHLSL );
}
Expand Down