SvrOverrideSettings.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Events;
  5. public static class SvrOverrideSettings
  6. {
  7. public enum eAntiAliasing
  8. {
  9. NoOverride = -1,
  10. k1 = 1,
  11. k2 = 2,
  12. k4 = 4,
  13. };
  14. public enum eDepth
  15. {
  16. NoOverride = -1,
  17. k16 = 16,
  18. k24 = 24
  19. };
  20. public enum eChromaticAberrationCorrection
  21. {
  22. NoOverride = -1,
  23. kDisable = 0,
  24. kEnable = 1
  25. };
  26. public enum eVSyncCount
  27. {
  28. NoOverride = -1,
  29. k1 = 1,
  30. k2 = 2,
  31. };
  32. public enum eMasterTextureLimit
  33. {
  34. NoOverride = -1,
  35. k0 = 0, // full size
  36. k1 = 1, // half size
  37. k2 = 2, // quarter size
  38. k3 = 3, // ...
  39. k4 = 4 // ...
  40. };
  41. public enum ePerfLevel
  42. {
  43. NoOverride = -1,
  44. System = 0,
  45. Minimum = 1,
  46. Medium = 2,
  47. Maximum = 3
  48. };
  49. public delegate void OnAntiAliasingChangedCallback(eAntiAliasing antiAliasing);
  50. public delegate void OnDepthChangedCallback(eDepth depth);
  51. public delegate void OnResolutionScaleFactorChangedCallback(float resolutionScaleFactor);
  52. public delegate void OnChromaticAberrationCorrectionChangedCallback(eChromaticAberrationCorrection chromaticAberrationCorrection);
  53. public delegate void OnVSyncCountChangedCallback(eVSyncCount vSyncCount);
  54. public delegate void OnMasterTextureLimitChangedCallback(eMasterTextureLimit masterTextureLimit);
  55. public delegate void OnPerfLevelChangedCallback(ePerfLevel cpuPerfLevel, ePerfLevel gpuPerfLevel);
  56. public delegate void OnFoveateChangedCallback(Vector2 gain, float area, float minimum);
  57. public static OnAntiAliasingChangedCallback OnEyeAntiAliasingChangedEvent;
  58. public static OnDepthChangedCallback OnEyeDepthChangedEvent;
  59. public static OnResolutionScaleFactorChangedCallback OnEyeResolutionScaleFactorChangedEvent;
  60. public static OnAntiAliasingChangedCallback OnOverlayAntiAliasingChangedEvent;
  61. public static OnDepthChangedCallback OnOverlayDepthChangedEvent;
  62. public static OnResolutionScaleFactorChangedCallback OnOverlayResolutionScaleFactorChangedEvent;
  63. public static OnChromaticAberrationCorrectionChangedCallback OnChromaticAberrationCorrectionChangedEvent;
  64. public static OnVSyncCountChangedCallback OnVSyncCountChangedEvent;
  65. public static OnMasterTextureLimitChangedCallback OnMasterTextureLimitChangedEvent;
  66. public static OnPerfLevelChangedCallback OnPerfLevelChangedEvent;
  67. public static OnFoveateChangedCallback OnFoveateChangedEvent;
  68. private static eAntiAliasing eyeAntiAliasing = eAntiAliasing.NoOverride;
  69. private static eDepth eyeDepth = eDepth.NoOverride;
  70. private static float eyeResolutionScaleFactor = 0.0f; // NoOverride
  71. private static eAntiAliasing overlayAntiAliasing = eAntiAliasing.NoOverride;
  72. private static eDepth overlayDepth = eDepth.NoOverride;
  73. private static float overlayResolutionScaleFactor = 0.0f; // NoOverride
  74. private static eChromaticAberrationCorrection chromaticAberrationCorrection = eChromaticAberrationCorrection.NoOverride;
  75. private static eVSyncCount vSyncCount = SvrOverrideSettings.eVSyncCount.NoOverride;
  76. private static eMasterTextureLimit masterTextureLimit = eMasterTextureLimit.NoOverride;
  77. private static ePerfLevel cpuPerfLevel = ePerfLevel.NoOverride;
  78. private static ePerfLevel gpuPerfLevel = ePerfLevel.NoOverride;
  79. private static Vector2 foveateGain = Vector3.zero;
  80. private static float foveateArea = 0;
  81. private static float foveateMinimum = 0;
  82. public static eAntiAliasing EyeAntiAliasing
  83. {
  84. get { return eyeAntiAliasing; }
  85. set { eyeAntiAliasing = value; OnEyeAntiAliasingChangedEvent.Invoke(eyeAntiAliasing); }
  86. }
  87. public static eDepth EyeDepth
  88. {
  89. get { return eyeDepth; }
  90. set { eyeDepth = value; OnEyeDepthChangedEvent.Invoke(eyeDepth); }
  91. }
  92. public static float EyeResolutionScaleFactor
  93. {
  94. get { return eyeResolutionScaleFactor; }
  95. set {eyeResolutionScaleFactor = value; OnEyeResolutionScaleFactorChangedEvent.Invoke(eyeResolutionScaleFactor); }
  96. }
  97. public static eAntiAliasing OverlayAntiAliasing
  98. {
  99. get { return overlayAntiAliasing; }
  100. set { overlayAntiAliasing = value; OnOverlayAntiAliasingChangedEvent.Invoke(overlayAntiAliasing); }
  101. }
  102. public static eDepth OverlayDepth
  103. {
  104. get { return overlayDepth; }
  105. set { overlayDepth = value; OnOverlayDepthChangedEvent.Invoke(overlayDepth); }
  106. }
  107. public static float OverlayResolutionScaleFactor
  108. {
  109. get { return overlayResolutionScaleFactor; }
  110. set { overlayResolutionScaleFactor = value; OnOverlayResolutionScaleFactorChangedEvent.Invoke(overlayResolutionScaleFactor); }
  111. }
  112. public static eChromaticAberrationCorrection ChromaticAberrationCorrection
  113. {
  114. get { return chromaticAberrationCorrection; }
  115. set { chromaticAberrationCorrection = value; OnChromaticAberrationCorrectionChangedEvent.Invoke(chromaticAberrationCorrection); }
  116. }
  117. public static eVSyncCount VSyncCount
  118. {
  119. get { return vSyncCount; }
  120. set { vSyncCount = value; OnVSyncCountChangedEvent.Invoke(vSyncCount); }
  121. }
  122. public static eMasterTextureLimit MasterTextureLimit
  123. {
  124. get { return masterTextureLimit; }
  125. set { masterTextureLimit = value; OnMasterTextureLimitChangedEvent.Invoke(masterTextureLimit); }
  126. }
  127. public static ePerfLevel CpuPerfLevel
  128. {
  129. get { return cpuPerfLevel; }
  130. set { cpuPerfLevel = value; OnPerfLevelChangedEvent.Invoke(cpuPerfLevel, gpuPerfLevel); }
  131. }
  132. public static ePerfLevel GpuPerfLevel
  133. {
  134. get { return gpuPerfLevel; }
  135. set { gpuPerfLevel = value; OnPerfLevelChangedEvent.Invoke(cpuPerfLevel, gpuPerfLevel); }
  136. }
  137. public static Vector2 FoveateGain
  138. {
  139. get { return foveateGain; }
  140. set { foveateGain = value; OnFoveateChangedEvent.Invoke(foveateGain, foveateArea, foveateMinimum); }
  141. }
  142. public static float FoveateArea
  143. {
  144. get { return foveateArea; }
  145. set { foveateArea = value; OnFoveateChangedEvent.Invoke(foveateGain, foveateArea, foveateMinimum); }
  146. }
  147. public static float FoveateMinimum
  148. {
  149. get { return foveateMinimum; }
  150. set { foveateMinimum = value; OnFoveateChangedEvent.Invoke(foveateGain, foveateArea, foveateMinimum); }
  151. }
  152. }