materialFlags.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. import { Engine } from "../Engines/engine.js";
  2. /**
  3. * This groups all the flags used to control the materials channel.
  4. */
  5. export class MaterialFlags {
  6. /**
  7. * Are diffuse textures enabled in the application.
  8. */
  9. static get DiffuseTextureEnabled() {
  10. return this._DiffuseTextureEnabled;
  11. }
  12. static set DiffuseTextureEnabled(value) {
  13. if (this._DiffuseTextureEnabled === value) {
  14. return;
  15. }
  16. this._DiffuseTextureEnabled = value;
  17. Engine.MarkAllMaterialsAsDirty(1);
  18. }
  19. /**
  20. * Are detail textures enabled in the application.
  21. */
  22. static get DetailTextureEnabled() {
  23. return this._DetailTextureEnabled;
  24. }
  25. static set DetailTextureEnabled(value) {
  26. if (this._DetailTextureEnabled === value) {
  27. return;
  28. }
  29. this._DetailTextureEnabled = value;
  30. Engine.MarkAllMaterialsAsDirty(1);
  31. }
  32. /**
  33. * Are decal maps enabled in the application.
  34. */
  35. static get DecalMapEnabled() {
  36. return this._DecalMapEnabled;
  37. }
  38. static set DecalMapEnabled(value) {
  39. if (this._DecalMapEnabled === value) {
  40. return;
  41. }
  42. this._DecalMapEnabled = value;
  43. Engine.MarkAllMaterialsAsDirty(1);
  44. }
  45. /**
  46. * Are ambient textures enabled in the application.
  47. */
  48. static get AmbientTextureEnabled() {
  49. return this._AmbientTextureEnabled;
  50. }
  51. static set AmbientTextureEnabled(value) {
  52. if (this._AmbientTextureEnabled === value) {
  53. return;
  54. }
  55. this._AmbientTextureEnabled = value;
  56. Engine.MarkAllMaterialsAsDirty(1);
  57. }
  58. /**
  59. * Are opacity textures enabled in the application.
  60. */
  61. static get OpacityTextureEnabled() {
  62. return this._OpacityTextureEnabled;
  63. }
  64. static set OpacityTextureEnabled(value) {
  65. if (this._OpacityTextureEnabled === value) {
  66. return;
  67. }
  68. this._OpacityTextureEnabled = value;
  69. Engine.MarkAllMaterialsAsDirty(1);
  70. }
  71. /**
  72. * Are reflection textures enabled in the application.
  73. */
  74. static get ReflectionTextureEnabled() {
  75. return this._ReflectionTextureEnabled;
  76. }
  77. static set ReflectionTextureEnabled(value) {
  78. if (this._ReflectionTextureEnabled === value) {
  79. return;
  80. }
  81. this._ReflectionTextureEnabled = value;
  82. Engine.MarkAllMaterialsAsDirty(1);
  83. }
  84. /**
  85. * Are emissive textures enabled in the application.
  86. */
  87. static get EmissiveTextureEnabled() {
  88. return this._EmissiveTextureEnabled;
  89. }
  90. static set EmissiveTextureEnabled(value) {
  91. if (this._EmissiveTextureEnabled === value) {
  92. return;
  93. }
  94. this._EmissiveTextureEnabled = value;
  95. Engine.MarkAllMaterialsAsDirty(1);
  96. }
  97. /**
  98. * Are specular textures enabled in the application.
  99. */
  100. static get SpecularTextureEnabled() {
  101. return this._SpecularTextureEnabled;
  102. }
  103. static set SpecularTextureEnabled(value) {
  104. if (this._SpecularTextureEnabled === value) {
  105. return;
  106. }
  107. this._SpecularTextureEnabled = value;
  108. Engine.MarkAllMaterialsAsDirty(1);
  109. }
  110. /**
  111. * Are bump textures enabled in the application.
  112. */
  113. static get BumpTextureEnabled() {
  114. return this._BumpTextureEnabled;
  115. }
  116. static set BumpTextureEnabled(value) {
  117. if (this._BumpTextureEnabled === value) {
  118. return;
  119. }
  120. this._BumpTextureEnabled = value;
  121. Engine.MarkAllMaterialsAsDirty(1);
  122. }
  123. /**
  124. * Are lightmap textures enabled in the application.
  125. */
  126. static get LightmapTextureEnabled() {
  127. return this._LightmapTextureEnabled;
  128. }
  129. static set LightmapTextureEnabled(value) {
  130. if (this._LightmapTextureEnabled === value) {
  131. return;
  132. }
  133. this._LightmapTextureEnabled = value;
  134. Engine.MarkAllMaterialsAsDirty(1);
  135. }
  136. /**
  137. * Are refraction textures enabled in the application.
  138. */
  139. static get RefractionTextureEnabled() {
  140. return this._RefractionTextureEnabled;
  141. }
  142. static set RefractionTextureEnabled(value) {
  143. if (this._RefractionTextureEnabled === value) {
  144. return;
  145. }
  146. this._RefractionTextureEnabled = value;
  147. Engine.MarkAllMaterialsAsDirty(1);
  148. }
  149. /**
  150. * Are color grading textures enabled in the application.
  151. */
  152. static get ColorGradingTextureEnabled() {
  153. return this._ColorGradingTextureEnabled;
  154. }
  155. static set ColorGradingTextureEnabled(value) {
  156. if (this._ColorGradingTextureEnabled === value) {
  157. return;
  158. }
  159. this._ColorGradingTextureEnabled = value;
  160. Engine.MarkAllMaterialsAsDirty(1);
  161. }
  162. /**
  163. * Are fresnels enabled in the application.
  164. */
  165. static get FresnelEnabled() {
  166. return this._FresnelEnabled;
  167. }
  168. static set FresnelEnabled(value) {
  169. if (this._FresnelEnabled === value) {
  170. return;
  171. }
  172. this._FresnelEnabled = value;
  173. Engine.MarkAllMaterialsAsDirty(4);
  174. }
  175. /**
  176. * Are clear coat textures enabled in the application.
  177. */
  178. static get ClearCoatTextureEnabled() {
  179. return this._ClearCoatTextureEnabled;
  180. }
  181. static set ClearCoatTextureEnabled(value) {
  182. if (this._ClearCoatTextureEnabled === value) {
  183. return;
  184. }
  185. this._ClearCoatTextureEnabled = value;
  186. Engine.MarkAllMaterialsAsDirty(1);
  187. }
  188. /**
  189. * Are clear coat bump textures enabled in the application.
  190. */
  191. static get ClearCoatBumpTextureEnabled() {
  192. return this._ClearCoatBumpTextureEnabled;
  193. }
  194. static set ClearCoatBumpTextureEnabled(value) {
  195. if (this._ClearCoatBumpTextureEnabled === value) {
  196. return;
  197. }
  198. this._ClearCoatBumpTextureEnabled = value;
  199. Engine.MarkAllMaterialsAsDirty(1);
  200. }
  201. /**
  202. * Are clear coat tint textures enabled in the application.
  203. */
  204. static get ClearCoatTintTextureEnabled() {
  205. return this._ClearCoatTintTextureEnabled;
  206. }
  207. static set ClearCoatTintTextureEnabled(value) {
  208. if (this._ClearCoatTintTextureEnabled === value) {
  209. return;
  210. }
  211. this._ClearCoatTintTextureEnabled = value;
  212. Engine.MarkAllMaterialsAsDirty(1);
  213. }
  214. /**
  215. * Are sheen textures enabled in the application.
  216. */
  217. static get SheenTextureEnabled() {
  218. return this._SheenTextureEnabled;
  219. }
  220. static set SheenTextureEnabled(value) {
  221. if (this._SheenTextureEnabled === value) {
  222. return;
  223. }
  224. this._SheenTextureEnabled = value;
  225. Engine.MarkAllMaterialsAsDirty(1);
  226. }
  227. /**
  228. * Are anisotropic textures enabled in the application.
  229. */
  230. static get AnisotropicTextureEnabled() {
  231. return this._AnisotropicTextureEnabled;
  232. }
  233. static set AnisotropicTextureEnabled(value) {
  234. if (this._AnisotropicTextureEnabled === value) {
  235. return;
  236. }
  237. this._AnisotropicTextureEnabled = value;
  238. Engine.MarkAllMaterialsAsDirty(1);
  239. }
  240. /**
  241. * Are thickness textures enabled in the application.
  242. */
  243. static get ThicknessTextureEnabled() {
  244. return this._ThicknessTextureEnabled;
  245. }
  246. static set ThicknessTextureEnabled(value) {
  247. if (this._ThicknessTextureEnabled === value) {
  248. return;
  249. }
  250. this._ThicknessTextureEnabled = value;
  251. Engine.MarkAllMaterialsAsDirty(1);
  252. }
  253. /**
  254. * Are refraction intensity textures enabled in the application.
  255. */
  256. static get RefractionIntensityTextureEnabled() {
  257. return this._ThicknessTextureEnabled;
  258. }
  259. static set RefractionIntensityTextureEnabled(value) {
  260. if (this._RefractionIntensityTextureEnabled === value) {
  261. return;
  262. }
  263. this._RefractionIntensityTextureEnabled = value;
  264. Engine.MarkAllMaterialsAsDirty(1);
  265. }
  266. /**
  267. * Are translucency intensity textures enabled in the application.
  268. */
  269. static get TranslucencyIntensityTextureEnabled() {
  270. return this._ThicknessTextureEnabled;
  271. }
  272. static set TranslucencyIntensityTextureEnabled(value) {
  273. if (this._TranslucencyIntensityTextureEnabled === value) {
  274. return;
  275. }
  276. this._TranslucencyIntensityTextureEnabled = value;
  277. Engine.MarkAllMaterialsAsDirty(1);
  278. }
  279. /**
  280. * Are translucency intensity textures enabled in the application.
  281. */
  282. static get IridescenceTextureEnabled() {
  283. return this._IridescenceTextureEnabled;
  284. }
  285. static set IridescenceTextureEnabled(value) {
  286. if (this._IridescenceTextureEnabled === value) {
  287. return;
  288. }
  289. this._IridescenceTextureEnabled = value;
  290. Engine.MarkAllMaterialsAsDirty(1);
  291. }
  292. }
  293. // Flags used to enable or disable a type of texture for all Standard Materials
  294. MaterialFlags._DiffuseTextureEnabled = true;
  295. MaterialFlags._DetailTextureEnabled = true;
  296. MaterialFlags._DecalMapEnabled = true;
  297. MaterialFlags._AmbientTextureEnabled = true;
  298. MaterialFlags._OpacityTextureEnabled = true;
  299. MaterialFlags._ReflectionTextureEnabled = true;
  300. MaterialFlags._EmissiveTextureEnabled = true;
  301. MaterialFlags._SpecularTextureEnabled = true;
  302. MaterialFlags._BumpTextureEnabled = true;
  303. MaterialFlags._LightmapTextureEnabled = true;
  304. MaterialFlags._RefractionTextureEnabled = true;
  305. MaterialFlags._ColorGradingTextureEnabled = true;
  306. MaterialFlags._FresnelEnabled = true;
  307. MaterialFlags._ClearCoatTextureEnabled = true;
  308. MaterialFlags._ClearCoatBumpTextureEnabled = true;
  309. MaterialFlags._ClearCoatTintTextureEnabled = true;
  310. MaterialFlags._SheenTextureEnabled = true;
  311. MaterialFlags._AnisotropicTextureEnabled = true;
  312. MaterialFlags._ThicknessTextureEnabled = true;
  313. MaterialFlags._RefractionIntensityTextureEnabled = true;
  314. MaterialFlags._TranslucencyIntensityTextureEnabled = true;
  315. MaterialFlags._IridescenceTextureEnabled = true;
  316. //# sourceMappingURL=materialFlags.js.map