Browse Source

Made all inspector fields public, so that they can be easily accessed programmatically.

There's really not much reason to keep these private, as we otherwise would have added public properties that directly access them anyway.
mac-autoexp
Nico de Poel 3 years ago
parent
commit
85829949f8
  1. 8
      Assets/Scripts/Fsr2Callbacks.cs
  2. 15
      Assets/Scripts/Fsr2Controller.cs

8
Assets/Scripts/Fsr2Callbacks.cs

@ -36,6 +36,14 @@ namespace FidelityFX
Resources.UnloadAsset(shader); Resources.UnloadAsset(shader);
} }
/// <summary>
/// Apply a mipmap bias to in-game textures to prevent them from becoming blurry as the internal rendering resolution lowers.
/// This will need to be customized on a per-game basis, as there is no clear universal way to determine what are "in-game" textures.
/// The default implementation will simply apply a mipmap bias to all 2D textures, which will include things like UI textures and which might miss things like terrain texture arrays.
///
/// Depending on how your game organizes its assets, you will want to create a filter that more specifically selects the textures that need to have this mipmap bias applied.
/// You may also want to store the bias offset value and apply it to any assets that are loaded in on demand.
/// </summary>
public virtual void ApplyMipmapBias(float biasOffset) public virtual void ApplyMipmapBias(float biasOffset)
{ {
foreach (var texture in Resources.FindObjectsOfTypeAll<Texture2D>()) foreach (var texture in Resources.FindObjectsOfTypeAll<Texture2D>())

15
Assets/Scripts/Fsr2Controller.cs

@ -13,19 +13,20 @@ namespace FidelityFX
[RequireComponent(typeof(Camera))] [RequireComponent(typeof(Camera))]
public class Fsr2Controller : MonoBehaviour public class Fsr2Controller : MonoBehaviour
{ {
[SerializeField] private Fsr2.QualityMode qualityMode = Fsr2.QualityMode.Quality;
public Fsr2.QualityMode qualityMode = Fsr2.QualityMode.Quality;
[SerializeField] private bool performSharpenPass = true;
[SerializeField, Range(0, 1)] private float sharpness = 0.8f;
public bool performSharpenPass = true;
[Range(0, 1)] public float sharpness = 0.8f;
[Tooltip("Allow the use of half precision compute operations, potentially improving performance")] [Tooltip("Allow the use of half precision compute operations, potentially improving performance")]
[SerializeField] private bool enableFP16 = false;
public bool enableFP16 = false;
[Header("Reactivity, Transparency & Composition")] [Header("Reactivity, Transparency & Composition")]
[SerializeField] private Texture reactiveMask = null;
[SerializeField] private Texture transparencyAndCompositionMask = null;
[SerializeField] private bool autoGenerateReactiveMask = true;
public Texture reactiveMask = null;
public Texture transparencyAndCompositionMask = null;
public bool autoGenerateReactiveMask = true;
[SerializeField] private GenerateReactiveParameters generateReactiveParameters = new GenerateReactiveParameters(); [SerializeField] private GenerateReactiveParameters generateReactiveParameters = new GenerateReactiveParameters();
public GenerateReactiveParameters GenerateReactiveParams => generateReactiveParameters;
[System.Serializable] [System.Serializable]
public class GenerateReactiveParameters public class GenerateReactiveParameters

Loading…
Cancel
Save