EZGlassARRendererUtility.cs 1.3 KB

123456789101112131415161718192021222324252627282930
  1. using UnityEngine;
  2. namespace EZXR.Glass.Rendering
  3. {
  4. public class EZGlassARRendererUtility
  5. {
  6. public static RenderTexture CreateRenderTexture(int width, int height, int depth = 24, RenderTextureFormat format = RenderTextureFormat.DefaultHDR, bool usequaAnti = true)
  7. {
  8. var rt = new RenderTexture(width, height, depth, format);
  9. /*
  10. if (SystemInfo.IsFormatSupported(UnityEngine.Experimental.Rendering.GraphicsFormat.R32G32B32A32_SFloat, UnityEngine.Experimental.Rendering.FormatUsage.Render))
  11. {
  12. rt.graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.R32G32B32A32_SFloat;
  13. }
  14. if (SystemInfo.IsFormatSupported(UnityEngine.Experimental.Rendering.GraphicsFormat.D32_SFloat_S8_UInt, UnityEngine.Experimental.Rendering.FormatUsage.Render))
  15. {
  16. rt.depthStencilFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.D32_SFloat_S8_UInt;
  17. }
  18. */
  19. rt.wrapMode = TextureWrapMode.Clamp;
  20. if (QualitySettings.antiAliasing > 0 && usequaAnti)
  21. {
  22. rt.antiAliasing = QualitySettings.antiAliasing;
  23. }
  24. rt.Create();
  25. return rt;
  26. }
  27. }
  28. }