materialFlags.ts 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. import { Engine } from "../Engines/engine";
  2. import { Constants } from "../Engines/constants";
  3. /**
  4. * This groups all the flags used to control the materials channel.
  5. */
  6. export class MaterialFlags {
  7. // Flags used to enable or disable a type of texture for all Standard Materials
  8. private static _DiffuseTextureEnabled = true;
  9. /**
  10. * Are diffuse textures enabled in the application.
  11. */
  12. public static get DiffuseTextureEnabled(): boolean {
  13. return this._DiffuseTextureEnabled;
  14. }
  15. public static set DiffuseTextureEnabled(value: boolean) {
  16. if (this._DiffuseTextureEnabled === value) {
  17. return;
  18. }
  19. this._DiffuseTextureEnabled = value;
  20. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  21. }
  22. private static _AmbientTextureEnabled = true;
  23. /**
  24. * Are ambient textures enabled in the application.
  25. */
  26. public static get AmbientTextureEnabled(): boolean {
  27. return this._AmbientTextureEnabled;
  28. }
  29. public static set AmbientTextureEnabled(value: boolean) {
  30. if (this._AmbientTextureEnabled === value) {
  31. return;
  32. }
  33. this._AmbientTextureEnabled = value;
  34. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  35. }
  36. private static _OpacityTextureEnabled = true;
  37. /**
  38. * Are opacity textures enabled in the application.
  39. */
  40. public static get OpacityTextureEnabled(): boolean {
  41. return this._OpacityTextureEnabled;
  42. }
  43. public static set OpacityTextureEnabled(value: boolean) {
  44. if (this._OpacityTextureEnabled === value) {
  45. return;
  46. }
  47. this._OpacityTextureEnabled = value;
  48. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  49. }
  50. private static _ReflectionTextureEnabled = true;
  51. /**
  52. * Are reflection textures enabled in the application.
  53. */
  54. public static get ReflectionTextureEnabled(): boolean {
  55. return this._ReflectionTextureEnabled;
  56. }
  57. public static set ReflectionTextureEnabled(value: boolean) {
  58. if (this._ReflectionTextureEnabled === value) {
  59. return;
  60. }
  61. this._ReflectionTextureEnabled = value;
  62. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  63. }
  64. private static _EmissiveTextureEnabled = true;
  65. /**
  66. * Are emissive textures enabled in the application.
  67. */
  68. public static get EmissiveTextureEnabled(): boolean {
  69. return this._EmissiveTextureEnabled;
  70. }
  71. public static set EmissiveTextureEnabled(value: boolean) {
  72. if (this._EmissiveTextureEnabled === value) {
  73. return;
  74. }
  75. this._EmissiveTextureEnabled = value;
  76. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  77. }
  78. private static _SpecularTextureEnabled = true;
  79. /**
  80. * Are specular textures enabled in the application.
  81. */
  82. public static get SpecularTextureEnabled(): boolean {
  83. return this._SpecularTextureEnabled;
  84. }
  85. public static set SpecularTextureEnabled(value: boolean) {
  86. if (this._SpecularTextureEnabled === value) {
  87. return;
  88. }
  89. this._SpecularTextureEnabled = value;
  90. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  91. }
  92. private static _BumpTextureEnabled = true;
  93. /**
  94. * Are bump textures enabled in the application.
  95. */
  96. public static get BumpTextureEnabled(): boolean {
  97. return this._BumpTextureEnabled;
  98. }
  99. public static set BumpTextureEnabled(value: boolean) {
  100. if (this._BumpTextureEnabled === value) {
  101. return;
  102. }
  103. this._BumpTextureEnabled = value;
  104. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  105. }
  106. private static _LightmapTextureEnabled = true;
  107. /**
  108. * Are lightmap textures enabled in the application.
  109. */
  110. public static get LightmapTextureEnabled(): boolean {
  111. return this._LightmapTextureEnabled;
  112. }
  113. public static set LightmapTextureEnabled(value: boolean) {
  114. if (this._LightmapTextureEnabled === value) {
  115. return;
  116. }
  117. this._LightmapTextureEnabled = value;
  118. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  119. }
  120. private static _RefractionTextureEnabled = true;
  121. /**
  122. * Are refraction textures enabled in the application.
  123. */
  124. public static get RefractionTextureEnabled(): boolean {
  125. return this._RefractionTextureEnabled;
  126. }
  127. public static set RefractionTextureEnabled(value: boolean) {
  128. if (this._RefractionTextureEnabled === value) {
  129. return;
  130. }
  131. this._RefractionTextureEnabled = value;
  132. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  133. }
  134. private static _ColorGradingTextureEnabled = true;
  135. /**
  136. * Are color grading textures enabled in the application.
  137. */
  138. public static get ColorGradingTextureEnabled(): boolean {
  139. return this._ColorGradingTextureEnabled;
  140. }
  141. public static set ColorGradingTextureEnabled(value: boolean) {
  142. if (this._ColorGradingTextureEnabled === value) {
  143. return;
  144. }
  145. this._ColorGradingTextureEnabled = value;
  146. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  147. }
  148. private static _FresnelEnabled = true;
  149. /**
  150. * Are fresnels enabled in the application.
  151. */
  152. public static get FresnelEnabled(): boolean {
  153. return this._FresnelEnabled;
  154. }
  155. public static set FresnelEnabled(value: boolean) {
  156. if (this._FresnelEnabled === value) {
  157. return;
  158. }
  159. this._FresnelEnabled = value;
  160. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_FresnelDirtyFlag);
  161. }
  162. private static _ClearCoatTextureEnabled = true;
  163. /**
  164. * Are clear coat textures enabled in the application.
  165. */
  166. public static get ClearCoatTextureEnabled(): boolean {
  167. return this._ClearCoatTextureEnabled;
  168. }
  169. public static set ClearCoatTextureEnabled(value: boolean) {
  170. if (this._ClearCoatTextureEnabled === value) {
  171. return;
  172. }
  173. this._ClearCoatTextureEnabled = value;
  174. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  175. }
  176. private static _ClearCoatBumpTextureEnabled = true;
  177. /**
  178. * Are clear coat bump textures enabled in the application.
  179. */
  180. public static get ClearCoatBumpTextureEnabled(): boolean {
  181. return this._ClearCoatBumpTextureEnabled;
  182. }
  183. public static set ClearCoatBumpTextureEnabled(value: boolean) {
  184. if (this._ClearCoatBumpTextureEnabled === value) {
  185. return;
  186. }
  187. this._ClearCoatBumpTextureEnabled = value;
  188. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  189. }
  190. private static _ClearCoatTintTextureEnabled = true;
  191. /**
  192. * Are clear coat tint textures enabled in the application.
  193. */
  194. public static get ClearCoatTintTextureEnabled(): boolean {
  195. return this._ClearCoatTintTextureEnabled;
  196. }
  197. public static set ClearCoatTintTextureEnabled(value: boolean) {
  198. if (this._ClearCoatTintTextureEnabled === value) {
  199. return;
  200. }
  201. this._ClearCoatTintTextureEnabled = value;
  202. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  203. }
  204. private static _SheenTextureEnabled = true;
  205. /**
  206. * Are sheen textures enabled in the application.
  207. */
  208. public static get SheenTextureEnabled(): boolean {
  209. return this._SheenTextureEnabled;
  210. }
  211. public static set SheenTextureEnabled(value: boolean) {
  212. if (this._SheenTextureEnabled === value) {
  213. return;
  214. }
  215. this._SheenTextureEnabled = value;
  216. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  217. }
  218. private static _AnisotropicTextureEnabled = true;
  219. /**
  220. * Are anisotropic textures enabled in the application.
  221. */
  222. public static get AnisotropicTextureEnabled(): boolean {
  223. return this._AnisotropicTextureEnabled;
  224. }
  225. public static set AnisotropicTextureEnabled(value: boolean) {
  226. if (this._AnisotropicTextureEnabled === value) {
  227. return;
  228. }
  229. this._AnisotropicTextureEnabled = value;
  230. Engine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
  231. }
  232. }