fxr plugin update and fixes
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FlaxEngine;
|
||||
using FidelityFX;
|
||||
|
||||
namespace Cabrito
|
||||
{
|
||||
@@ -121,5 +122,55 @@ namespace Cabrito
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static FSR _fsrPlugin;
|
||||
public static FSR FsrPlugin
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_fsrPlugin == null)
|
||||
_fsrPlugin = PluginManager.GetPlugin<FSR>();
|
||||
return _fsrPlugin;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: r_upscaling
|
||||
[ConsoleVariable("r_fsr_enabled")]
|
||||
public static string FsrEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return FsrPlugin.PostFx.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;
|
||||
|
||||
FsrPlugin.PostFx.Enabled = boolValue;
|
||||
}
|
||||
}
|
||||
|
||||
[ConsoleVariable("r_fsr_sharpness")]
|
||||
public static string FsrSharpness
|
||||
{
|
||||
get
|
||||
{
|
||||
// In shader, the value of 0 is the max sharpness...
|
||||
float sharpness = 2.0f - FsrPlugin.PostFx.Sharpness;
|
||||
return sharpness.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (float.TryParse(value, out float valueFloat))
|
||||
{
|
||||
valueFloat = Mathf.Clamp(valueFloat, 0f, 2.0f);
|
||||
FsrPlugin.PostFx.Sharpness = 2.0f - valueFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,9 @@ public class Game : GameModule
|
||||
options.ScriptingAPI.IgnoreMissingDocumentationWarnings = true;
|
||||
//options.CompileEnv.PreprocessorDefinitions.Add("COMPILE_WITH_CSG_BUILDER");
|
||||
//options.PublicDefinitions.Add("COMPILE_WITH_CSG_BUILDER");
|
||||
|
||||
options.PublicDependencies.Add("FidelityFXFSR");
|
||||
|
||||
base.Setup(options);
|
||||
|
||||
// Here you can modify the build options for your game module
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using FlaxEditor;
|
||||
using FlaxEditor.Windows;
|
||||
using FlaxEngine.Assertions;
|
||||
using Console = Cabrito.Console;
|
||||
using Stopwatch = System.Diagnostics.Stopwatch;
|
||||
@@ -190,6 +189,7 @@ namespace Game
|
||||
vertices = new Vector3[0];
|
||||
}
|
||||
|
||||
#if FLAX_EDITOR
|
||||
[OnSerializing]
|
||||
internal void OnSerializing(StreamingContext context)
|
||||
{
|
||||
@@ -213,7 +213,7 @@ namespace Game
|
||||
{
|
||||
Debug.Log("OnDeserialized: " + Editor.IsPlayMode);
|
||||
}
|
||||
|
||||
#endif
|
||||
public override void OnStart()
|
||||
{
|
||||
#if false
|
||||
|
||||
Binary file not shown.
@@ -11,8 +11,11 @@ public class GameTarget : GameProjectTarget
|
||||
|
||||
// Reference the modules for game
|
||||
Modules.Add("Game");
|
||||
Modules.Add("FidelityFXFSR");
|
||||
|
||||
//Modules.Add("Cabrito");
|
||||
Architectures = new TargetArchitecture[] { TargetArchitecture.x64 };
|
||||
Platforms = new TargetPlatform[] { TargetPlatform.Windows };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,4 +29,4 @@ public class GoakeTestsTarget : Target
|
||||
|
||||
CustomExternalProjectFilePath = System.IO.Path.Combine("Tests/GoakeTests.csproj");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user