From 3ee7dddfd34fe225f71cbae487e146732edf535d Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Mon, 28 Mar 2022 21:14:49 +0300 Subject: [PATCH] fxr plugin update and fixes --- Content/Scenes/AerowalkScene.scene | 14 ++++--- Plugins/FidelityFX-FSR | 2 +- Source/Game/Cabrito/EngineSubsystem.cs | 51 +++++++++++++++++++++++++ Source/Game/Game.Build.cs | 3 ++ Source/Game/Q3MapImporter.cs | 4 +- Source/GameEditorTarget.Build.cs | Bin 950 -> 514 bytes Source/GameTarget.Build.cs | 3 ++ Source/GoakeTestsTarget.Build.cs | 2 +- 8 files changed, 69 insertions(+), 10 deletions(-) diff --git a/Content/Scenes/AerowalkScene.scene b/Content/Scenes/AerowalkScene.scene index f21a8d6..8f4ee3c 100644 --- a/Content/Scenes/AerowalkScene.scene +++ b/Content/Scenes/AerowalkScene.scene @@ -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 } }, diff --git a/Plugins/FidelityFX-FSR b/Plugins/FidelityFX-FSR index 5db14b8..ee085aa 160000 --- a/Plugins/FidelityFX-FSR +++ b/Plugins/FidelityFX-FSR @@ -1 +1 @@ -Subproject commit 5db14b8bc98cc225e2a81a1aa8bdf9d784ba3be9 +Subproject commit ee085aae6b851e8a2ec63a93e7520bdc5c132d80 diff --git a/Source/Game/Cabrito/EngineSubsystem.cs b/Source/Game/Cabrito/EngineSubsystem.cs index 644a3bd..5c1a2e4 100644 --- a/Source/Game/Cabrito/EngineSubsystem.cs +++ b/Source/Game/Cabrito/EngineSubsystem.cs @@ -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(); + 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; + } + } + } } } \ No newline at end of file diff --git a/Source/Game/Game.Build.cs b/Source/Game/Game.Build.cs index de79123..1427abe 100644 --- a/Source/Game/Game.Build.cs +++ b/Source/Game/Game.Build.cs @@ -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 diff --git a/Source/Game/Q3MapImporter.cs b/Source/Game/Q3MapImporter.cs index f0dce7e..3e56029 100644 --- a/Source/Game/Q3MapImporter.cs +++ b/Source/Game/Q3MapImporter.cs @@ -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 diff --git a/Source/GameEditorTarget.Build.cs b/Source/GameEditorTarget.Build.cs index e28de077a0598ed1457e1cc52873d9e4486373e7..4d2aadf16b6fc3ae73f0f1c3628b25f78ee3c26e 100644 GIT binary patch literal 514 zcmZvYPfG(a5XJBL6hlw#CAo+Pt3nl51Pi4W6vRWCOuM7mq$Jt?q3m}zyX)31bdK*$ zetB=oKz0q8k$e77lF?(vHs#Wg0%c?f@GJ{_(iELvNWaDiH;pv&?i*F?JM73HjSvEE z$>!)OYNtTlH}W6UZP9zu2wO)QUM$7osPWs!HDD<`p)MU952Xxe|-hjf2x_0F*Pa9L7m!zbP|6jtKBa2AwtBQ0)Hj@vp8%p WWoq+u0-rkTQr(azhdZ0H|a)P_<|}bfg{8oH@8)0@W| zBVy&)XMXK;LDi;sOWQSmJ#(dCOg(ehL4#8|Q(>yP)Orni;xor&34P{;OuNIa3@rs7 z#@@jR`<(N*=HOrTRotrvE6@;hg!cY#2l~`unkq&$o1$*^3AK&aj%Gw_k1+%hqTl=~ zdslE$>OUl7%KDwT-uW)ho$f&{|A`K`kGt9dy=tv)Pyf$vgE7JFx9q_9!*itgI?1115M ARR910 diff --git a/Source/GameTarget.Build.cs b/Source/GameTarget.Build.cs index 6db75dd..d732d81 100644 --- a/Source/GameTarget.Build.cs +++ b/Source/GameTarget.Build.cs @@ -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 }; } } + \ No newline at end of file diff --git a/Source/GoakeTestsTarget.Build.cs b/Source/GoakeTestsTarget.Build.cs index 98be7d4..3845202 100644 --- a/Source/GoakeTestsTarget.Build.cs +++ b/Source/GoakeTestsTarget.Build.cs @@ -29,4 +29,4 @@ public class GoakeTestsTarget : Target CustomExternalProjectFilePath = System.IO.Path.Combine("Tests/GoakeTests.csproj"); } -} +}