KeywordsUtility.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System;
  2. using System.Collections.Generic;
  3. namespace EPOOutline
  4. {
  5. public static class KeywordsUtility
  6. {
  7. private static Dictionary<BlurType, string> BlurTypes = new Dictionary<BlurType, string>
  8. {
  9. { BlurType.Anisotropic, "ANISOTROPIC_BLUR" },
  10. { BlurType.Box, "BOX_BLUR" },
  11. { BlurType.Gaussian5x5, "GAUSSIAN5X5" },
  12. { BlurType.Gaussian9x9, "GAUSSIAN9X9" },
  13. { BlurType.Gaussian13x13, "GAUSSIAN13X13" }
  14. };
  15. private static Dictionary<DilateQuality, string> DilateQualityKeywords = new Dictionary<DilateQuality, string>
  16. {
  17. { DilateQuality.Base, "BASE_QALITY_DILATE" },
  18. { DilateQuality.High, "HIGH_QUALITY_DILATE" },
  19. { DilateQuality.Ultra, "ULTRA_QUALITY_DILATE" }
  20. };
  21. public static string GetBackKeyword(ComplexMaskingMode mode)
  22. {
  23. switch (mode)
  24. {
  25. case ComplexMaskingMode.None:
  26. return string.Empty;
  27. case ComplexMaskingMode.ObstaclesMode:
  28. return "BACK_OBSTACLE_RENDERING";
  29. case ComplexMaskingMode.MaskingMode:
  30. return "BACK_MASKING_RENDERING";
  31. default:
  32. throw new ArgumentException("Unknown rendering mode");
  33. }
  34. }
  35. public static string GetTextureArrayCutoutKeyword()
  36. {
  37. return "TEXARRAY_CUTOUT";
  38. }
  39. public static string GetDilateQualityKeyword(DilateQuality quality)
  40. {
  41. switch (quality)
  42. {
  43. case DilateQuality.Base:
  44. return "BASE_QALITY_DILATE";
  45. case DilateQuality.High:
  46. return "HIGH_QUALITY_DILATE";
  47. case DilateQuality.Ultra:
  48. return "ULTRA_QUALITY_DILATE";
  49. default:
  50. throw new System.Exception("Unknown dilate quality level");
  51. }
  52. }
  53. public static string GetEnabledInfoBufferKeyword()
  54. {
  55. return "USE_INFO_BUFFER";
  56. }
  57. public static string GetEdgeMaskKeyword()
  58. {
  59. return "EDGE_MASK";
  60. }
  61. public static string GetInfoBufferStageKeyword()
  62. {
  63. return "INFO_BUFFER_STAGE";
  64. }
  65. public static string GetBlurKeyword(BlurType type)
  66. {
  67. return BlurTypes[type];
  68. }
  69. public static string GetCutoutKeyword()
  70. {
  71. return "USE_CUTOUT";
  72. }
  73. public static void GetAllBlurKeywords(List<string> list)
  74. {
  75. list.Clear();
  76. foreach (var item in BlurTypes)
  77. list.Add(item.Value);
  78. }
  79. public static void GetAllDilateKeywords(List<string> list)
  80. {
  81. list.Clear();
  82. foreach (var item in DilateQualityKeywords)
  83. list.Add(item.Value);
  84. }
  85. }
  86. }