initial config loading system, shadows cvar, assetmanager
This commit is contained in:
@@ -195,29 +195,17 @@ namespace Game
|
||||
{
|
||||
get
|
||||
{
|
||||
string workDir = Directory.GetCurrentDirectory();
|
||||
string matBasePath = Path.Combine(workDir, "Content");
|
||||
string assetPath = Path.Combine(matBasePath, "GameplayGlobals.flax");
|
||||
|
||||
GameplayGlobals globals = Content.Load<GameplayGlobals>(assetPath);
|
||||
|
||||
return ((bool)globals.GetValue("Scene Lighting") ? "1" : "0");
|
||||
return ((bool)AssetManager.Globals.GetValue("Scene Lighting") ? "1" : "0");
|
||||
}
|
||||
set
|
||||
{
|
||||
string workDir = Directory.GetCurrentDirectory();
|
||||
string matBasePath = Path.Combine(workDir, "Content");
|
||||
string assetPath = Path.Combine(matBasePath, "GameplayGlobals.flax");
|
||||
|
||||
GameplayGlobals globals = Content.Load<GameplayGlobals>(assetPath);
|
||||
|
||||
bool boolValue = false;
|
||||
if (int.TryParse(value, out int intValue))
|
||||
boolValue = intValue != 0;
|
||||
else if (float.TryParse(value, out float valueFloat))
|
||||
boolValue = valueFloat != 0f;
|
||||
|
||||
globals.SetValue("Scene Lighting", boolValue);
|
||||
AssetManager.Globals.SetValue("Scene Lighting", boolValue);
|
||||
|
||||
|
||||
PostFxVolume postFx = Level.FindActor<PostFxVolume>();
|
||||
@@ -234,10 +222,26 @@ namespace Game
|
||||
}
|
||||
|
||||
// TODO: disable GI
|
||||
Graphics.EnableGlobalSDF = boolValue;
|
||||
}
|
||||
}
|
||||
|
||||
Light[] lights = Level.GetActors<Light>();
|
||||
foreach (Light light in lights)
|
||||
light.IsActive = boolValue;
|
||||
[ConsoleVariable("r_shadows")]
|
||||
public static string SceneShadows
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((bool)AssetManager.Globals.GetValue("Scene Shadows") ? "1" : "0");
|
||||
}
|
||||
set
|
||||
{
|
||||
bool boolValue = false;
|
||||
if (int.TryParse(value, out int intValue))
|
||||
boolValue = intValue != 0;
|
||||
else if (float.TryParse(value, out float valueFloat))
|
||||
boolValue = valueFloat != 0f;
|
||||
|
||||
AssetManager.Globals.SetValue("Scene Shadows", boolValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user