fxr plugin update and fixes

This commit is contained in:
2022-03-28 21:14:49 +03:00
parent e7d10d256e
commit 3ee7dddfd3
8 changed files with 69 additions and 10 deletions

View File

@@ -21,7 +21,9 @@
"ID": "c95a3dab492c1b2046ce2191daa2b111",
"TypeName": "Game.Q3MapImporter",
"ParentID": "194e05f445ece24ec5448d886e1334df",
"V": {}
"V": {
"mapPath": "C:\\dev\\GoakeFlax\\Assets\\Maps\\aerowalk.map"
}
},
{
"ID": "ff6b6db54b5aa08e7286ef86246149ef",
@@ -68,13 +70,13 @@
"Transform": {
"Translation": {
"X": 0.0,
"Y": 388.0,
"Y": 716.0,
"Z": 0.0
}
},
"Control": "FlaxEngine.GUI.Label",
"Data": {
"Text": "eFPS: 120\nuFPS: 120\nrFPS: 120\npFPS: 30",
"Text": "eFPS: 122\nuFPS: 120\nrFPS: 120\npFPS: 30",
"TextColor": {
"R": 1.0,
"G": 1.0,
@@ -121,7 +123,7 @@
},
"Offsets": {
"Left": 0.0,
"Right": 54.4,
"Right": 57.0,
"Top": -97.0,
"Bottom": 64.0
},
@@ -162,8 +164,8 @@
"Name": "ContainerControl 0",
"Transform": {
"Translation": {
"X": 45012.0,
"Y": -163.5,
"X": 45644.0,
"Y": 0.5,
"Z": 0.0
}
},

View File

@@ -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;
}
}
}
}
}

View File

@@ -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

View File

@@ -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.

View File

@@ -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 };
}
}