new logo, AO and vsync console commands, GI test area

This commit is contained in:
2022-07-01 15:51:10 +03:00
parent 91df324cf1
commit 9cc8e81b33
14 changed files with 1717 additions and 1545 deletions

View File

@@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using FidelityFX;
using FlaxEditor.Content.Settings;
using FlaxEngine;
namespace Game
@@ -202,7 +203,25 @@ namespace Game
boolValue = valueFloat != 0f;
AssetManager.Globals.SetValue("Scene Lighting", boolValue);
AmbientOcclusion = value;
GlobalIllumination = value;
}
}
[ConsoleVariable("r_ambientocclusion")]
public static string AmbientOcclusion
{
get
{
return Graphics.PostProcessSettings.AmbientOcclusion.Enabled ? "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;
PostProcessSettings postProcessSettings = Graphics.PostProcessSettings;
AmbientOcclusionSettings aoSettings = postProcessSettings.AmbientOcclusion;
@@ -214,14 +233,25 @@ namespace Game
aoSettings.Enabled = boolValue;
postProcessSettings.AmbientOcclusion = aoSettings;
}
}
GlobalIlluminationSettings giSettings = postProcessSettings.GlobalIllumination;
giSettings.Mode = boolValue ? GlobalIlluminationMode.DDGI : GlobalIlluminationMode.None;
postProcessSettings.GlobalIllumination = giSettings;
[ConsoleVariable("r_vsync")]
public static string Vsync
{
get
{
return Graphics.UseVSync ? "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;
Graphics.PostProcessSettings = postProcessSettings;
//Graphics.EnableGlobalSDF = boolValue;
Graphics.UseVSync = boolValue;
}
}
@@ -241,11 +271,14 @@ namespace Game
boolValue = valueFloat != 0f;
PostProcessSettings postProcessSettings = Graphics.PostProcessSettings;
GlobalIlluminationSettings giSettings = postProcessSettings.GlobalIllumination;
giSettings.Mode = boolValue ? GlobalIlluminationMode.DDGI : GlobalIlluminationMode.None;
postProcessSettings.GlobalIllumination = giSettings;
Graphics.PostProcessSettings = postProcessSettings;
Graphics.EnableGlobalSDF = boolValue;
}
}
@@ -286,6 +319,13 @@ namespace Game
playerActor.GetScript<PlayerMovement>().SetInput(demoPath);
}
private static Action timeDemoUpdate = null;
private static void TimeDemoOnUpdate()
{
if (timeDemoUpdate != null)
timeDemoUpdate();
}
[ConsoleCommand("timedemo")]
public static void TimeDemoCommand(string[] text)
{
@@ -304,21 +344,20 @@ namespace Game
if (File.Exists(demoPath))
playerMovement.SetInput(demoPath);
Action onUpdate = () => {};
//bool lastPlaying = true;
float accumTime = 0f;
int accumTimes = 0;
onUpdate = () =>
timeDemoUpdate = () =>
{
if (playerMovement)
{
var input = playerMovement.input as PlayerInputDemo;
if (input != null)
{
if (!input.IsPlaying)
{
Console.Print($"demo ended, time: {accumTimes} frames, avg: {(accumTime/(float)accumTimes)*1000.0f}");
Scripting.Update -= onUpdate;
timeDemoUpdate = null;
return;
}
@@ -327,12 +366,12 @@ namespace Game
accumTime += Time.DeltaTime;
accumTimes++;
//input.IsPlaying
}
}
};
Scripting.Update += onUpdate;
Scripting.Update -= TimeDemoOnUpdate;
Scripting.Update += TimeDemoOnUpdate;
}
[ConsoleSubsystemInitializer]