@onerjs/materials 8.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/cell/cell.fragment.d.ts +19 -0
  2. package/cell/cell.fragment.js +100 -0
  3. package/cell/cell.fragment.js.map +1 -0
  4. package/cell/cell.vertex.d.ts +21 -0
  5. package/cell/cell.vertex.js +96 -0
  6. package/cell/cell.vertex.js.map +1 -0
  7. package/cell/cellMaterial.d.ts +37 -0
  8. package/cell/cellMaterial.js +312 -0
  9. package/cell/cellMaterial.js.map +1 -0
  10. package/cell/index.d.ts +1 -0
  11. package/cell/index.js +2 -0
  12. package/cell/index.js.map +1 -0
  13. package/custom/customMaterial.d.ts +280 -0
  14. package/custom/customMaterial.js +355 -0
  15. package/custom/customMaterial.js.map +1 -0
  16. package/custom/index.d.ts +2 -0
  17. package/custom/index.js +3 -0
  18. package/custom/index.js.map +1 -0
  19. package/custom/pbrCustomMaterial.d.ts +299 -0
  20. package/custom/pbrCustomMaterial.js +397 -0
  21. package/custom/pbrCustomMaterial.js.map +1 -0
  22. package/fire/fire.fragment.d.ts +13 -0
  23. package/fire/fire.fragment.js +65 -0
  24. package/fire/fire.fragment.js.map +1 -0
  25. package/fire/fire.vertex.d.ts +18 -0
  26. package/fire/fire.vertex.js +80 -0
  27. package/fire/fire.vertex.js.map +1 -0
  28. package/fire/fireMaterial.d.ts +38 -0
  29. package/fire/fireMaterial.js +342 -0
  30. package/fire/fireMaterial.js.map +1 -0
  31. package/fire/index.d.ts +1 -0
  32. package/fire/index.js +2 -0
  33. package/fire/index.js.map +1 -0
  34. package/fur/fur.fragment.d.ts +19 -0
  35. package/fur/fur.fragment.js +94 -0
  36. package/fur/fur.fragment.js.map +1 -0
  37. package/fur/fur.vertex.d.ts +21 -0
  38. package/fur/fur.vertex.js +126 -0
  39. package/fur/fur.vertex.js.map +1 -0
  40. package/fur/furMaterial.d.ts +57 -0
  41. package/fur/furMaterial.js +505 -0
  42. package/fur/furMaterial.js.map +1 -0
  43. package/fur/index.d.ts +1 -0
  44. package/fur/index.js +2 -0
  45. package/fur/index.js.map +1 -0
  46. package/gradient/gradient.fragment.d.ts +19 -0
  47. package/gradient/gradient.fragment.js +80 -0
  48. package/gradient/gradient.fragment.js.map +1 -0
  49. package/gradient/gradient.vertex.d.ts +21 -0
  50. package/gradient/gradient.vertex.js +87 -0
  51. package/gradient/gradient.vertex.js.map +1 -0
  52. package/gradient/gradientMaterial.d.ts +37 -0
  53. package/gradient/gradientMaterial.js +283 -0
  54. package/gradient/gradientMaterial.js.map +1 -0
  55. package/gradient/index.d.ts +1 -0
  56. package/gradient/index.js +2 -0
  57. package/gradient/index.js.map +1 -0
  58. package/grid/grid.fragment.d.ts +12 -0
  59. package/grid/grid.fragment.js +79 -0
  60. package/grid/grid.fragment.js.map +1 -0
  61. package/grid/grid.vertex.d.ts +15 -0
  62. package/grid/grid.vertex.js +60 -0
  63. package/grid/grid.vertex.js.map +1 -0
  64. package/grid/gridMaterial.d.ts +85 -0
  65. package/grid/gridMaterial.js +308 -0
  66. package/grid/gridMaterial.js.map +1 -0
  67. package/grid/index.d.ts +1 -0
  68. package/grid/index.js +2 -0
  69. package/grid/index.js.map +1 -0
  70. package/index.d.ts +15 -0
  71. package/index.js +17 -0
  72. package/index.js.map +1 -0
  73. package/lava/index.d.ts +1 -0
  74. package/lava/index.js +2 -0
  75. package/lava/index.js.map +1 -0
  76. package/lava/lava.fragment.d.ts +19 -0
  77. package/lava/lava.fragment.js +89 -0
  78. package/lava/lava.fragment.js.map +1 -0
  79. package/lava/lava.vertex.d.ts +21 -0
  80. package/lava/lava.vertex.js +113 -0
  81. package/lava/lava.vertex.js.map +1 -0
  82. package/lava/lavaMaterial.d.ts +45 -0
  83. package/lava/lavaMaterial.js +402 -0
  84. package/lava/lavaMaterial.js.map +1 -0
  85. package/legacy/legacy-cell.d.ts +1 -0
  86. package/legacy/legacy-cell.js +14 -0
  87. package/legacy/legacy-cell.js.map +1 -0
  88. package/legacy/legacy-custom.d.ts +1 -0
  89. package/legacy/legacy-custom.js +14 -0
  90. package/legacy/legacy-custom.js.map +1 -0
  91. package/legacy/legacy-fire.d.ts +1 -0
  92. package/legacy/legacy-fire.js +14 -0
  93. package/legacy/legacy-fire.js.map +1 -0
  94. package/legacy/legacy-fur.d.ts +1 -0
  95. package/legacy/legacy-fur.js +14 -0
  96. package/legacy/legacy-fur.js.map +1 -0
  97. package/legacy/legacy-gradient.d.ts +1 -0
  98. package/legacy/legacy-gradient.js +14 -0
  99. package/legacy/legacy-gradient.js.map +1 -0
  100. package/legacy/legacy-grid.d.ts +1 -0
  101. package/legacy/legacy-grid.js +14 -0
  102. package/legacy/legacy-grid.js.map +1 -0
  103. package/legacy/legacy-lava.d.ts +1 -0
  104. package/legacy/legacy-lava.js +14 -0
  105. package/legacy/legacy-lava.js.map +1 -0
  106. package/legacy/legacy-mix.d.ts +1 -0
  107. package/legacy/legacy-mix.js +14 -0
  108. package/legacy/legacy-mix.js.map +1 -0
  109. package/legacy/legacy-normal.d.ts +1 -0
  110. package/legacy/legacy-normal.js +14 -0
  111. package/legacy/legacy-normal.js.map +1 -0
  112. package/legacy/legacy-shadowOnly.d.ts +1 -0
  113. package/legacy/legacy-shadowOnly.js +14 -0
  114. package/legacy/legacy-shadowOnly.js.map +1 -0
  115. package/legacy/legacy-simple.d.ts +1 -0
  116. package/legacy/legacy-simple.js +14 -0
  117. package/legacy/legacy-simple.js.map +1 -0
  118. package/legacy/legacy-sky.d.ts +1 -0
  119. package/legacy/legacy-sky.js +14 -0
  120. package/legacy/legacy-sky.js.map +1 -0
  121. package/legacy/legacy-terrain.d.ts +1 -0
  122. package/legacy/legacy-terrain.js +14 -0
  123. package/legacy/legacy-terrain.js.map +1 -0
  124. package/legacy/legacy-triPlanar.d.ts +1 -0
  125. package/legacy/legacy-triPlanar.js +14 -0
  126. package/legacy/legacy-triPlanar.js.map +1 -0
  127. package/legacy/legacy-water.d.ts +1 -0
  128. package/legacy/legacy-water.js +14 -0
  129. package/legacy/legacy-water.js.map +1 -0
  130. package/legacy/legacy.d.ts +1 -0
  131. package/legacy/legacy.js +17 -0
  132. package/legacy/legacy.js.map +1 -0
  133. package/license.md +71 -0
  134. package/mix/index.d.ts +1 -0
  135. package/mix/index.js +2 -0
  136. package/mix/index.js.map +1 -0
  137. package/mix/mix.fragment.d.ts +19 -0
  138. package/mix/mix.fragment.js +106 -0
  139. package/mix/mix.fragment.js.map +1 -0
  140. package/mix/mix.vertex.d.ts +21 -0
  141. package/mix/mix.vertex.js +96 -0
  142. package/mix/mix.vertex.js.map +1 -0
  143. package/mix/mixMaterial.d.ts +65 -0
  144. package/mix/mixMaterial.js +508 -0
  145. package/mix/mixMaterial.js.map +1 -0
  146. package/normal/index.d.ts +1 -0
  147. package/normal/index.js +2 -0
  148. package/normal/index.js.map +1 -0
  149. package/normal/normal.fragment.d.ts +19 -0
  150. package/normal/normal.fragment.js +85 -0
  151. package/normal/normal.fragment.js.map +1 -0
  152. package/normal/normal.vertex.d.ts +20 -0
  153. package/normal/normal.vertex.js +88 -0
  154. package/normal/normal.vertex.js.map +1 -0
  155. package/normal/normalMaterial.d.ts +36 -0
  156. package/normal/normalMaterial.js +345 -0
  157. package/normal/normalMaterial.js.map +1 -0
  158. package/package.json +47 -0
  159. package/readme.md +30 -0
  160. package/shadowOnly/index.d.ts +1 -0
  161. package/shadowOnly/index.js +2 -0
  162. package/shadowOnly/index.js.map +1 -0
  163. package/shadowOnly/shadowOnly.fragment.d.ts +20 -0
  164. package/shadowOnly/shadowOnly.fragment.js +60 -0
  165. package/shadowOnly/shadowOnly.fragment.js.map +1 -0
  166. package/shadowOnly/shadowOnly.vertex.d.ts +22 -0
  167. package/shadowOnly/shadowOnly.vertex.js +69 -0
  168. package/shadowOnly/shadowOnly.vertex.js.map +1 -0
  169. package/shadowOnly/shadowOnlyMaterial.d.ts +30 -0
  170. package/shadowOnly/shadowOnlyMaterial.js +243 -0
  171. package/shadowOnly/shadowOnlyMaterial.js.map +1 -0
  172. package/simple/index.d.ts +1 -0
  173. package/simple/index.js +2 -0
  174. package/simple/index.js.map +1 -0
  175. package/simple/simple.fragment.d.ts +19 -0
  176. package/simple/simple.fragment.js +81 -0
  177. package/simple/simple.fragment.js.map +1 -0
  178. package/simple/simple.vertex.d.ts +21 -0
  179. package/simple/simple.vertex.js +96 -0
  180. package/simple/simple.vertex.js.map +1 -0
  181. package/simple/simpleMaterial.d.ts +35 -0
  182. package/simple/simpleMaterial.js +303 -0
  183. package/simple/simpleMaterial.js.map +1 -0
  184. package/sky/index.d.ts +1 -0
  185. package/sky/index.js +2 -0
  186. package/sky/index.js.map +1 -0
  187. package/sky/sky.fragment.d.ts +13 -0
  188. package/sky/sky.fragment.js +81 -0
  189. package/sky/sky.fragment.js.map +1 -0
  190. package/sky/sky.vertex.d.ts +11 -0
  191. package/sky/sky.vertex.js +47 -0
  192. package/sky/sky.vertex.js.map +1 -0
  193. package/sky/skyMaterial.d.ts +151 -0
  194. package/sky/skyMaterial.js +367 -0
  195. package/sky/skyMaterial.js.map +1 -0
  196. package/terrain/index.d.ts +1 -0
  197. package/terrain/index.js +2 -0
  198. package/terrain/index.js.map +1 -0
  199. package/terrain/terrain.fragment.d.ts +19 -0
  200. package/terrain/terrain.fragment.js +110 -0
  201. package/terrain/terrain.fragment.js.map +1 -0
  202. package/terrain/terrain.vertex.d.ts +21 -0
  203. package/terrain/terrain.vertex.js +96 -0
  204. package/terrain/terrain.vertex.js.map +1 -0
  205. package/terrain/terrainMaterial.d.ts +50 -0
  206. package/terrain/terrainMaterial.js +445 -0
  207. package/terrain/terrainMaterial.js.map +1 -0
  208. package/triPlanar/index.d.ts +1 -0
  209. package/triPlanar/index.js +2 -0
  210. package/triPlanar/index.js.map +1 -0
  211. package/triPlanar/triPlanarMaterial.d.ts +49 -0
  212. package/triPlanar/triPlanarMaterial.js +421 -0
  213. package/triPlanar/triPlanarMaterial.js.map +1 -0
  214. package/triPlanar/triplanar.fragment.d.ts +19 -0
  215. package/triPlanar/triplanar.fragment.js +126 -0
  216. package/triPlanar/triplanar.fragment.js.map +1 -0
  217. package/triPlanar/triplanar.vertex.d.ts +22 -0
  218. package/triPlanar/triplanar.vertex.js +101 -0
  219. package/triPlanar/triplanar.vertex.js.map +1 -0
  220. package/water/index.d.ts +1 -0
  221. package/water/index.js +2 -0
  222. package/water/index.js.map +1 -0
  223. package/water/water.fragment.d.ts +19 -0
  224. package/water/water.fragment.js +160 -0
  225. package/water/water.fragment.js.map +1 -0
  226. package/water/water.vertex.d.ts +21 -0
  227. package/water/water.vertex.js +125 -0
  228. package/water/water.vertex.js.map +1 -0
  229. package/water/waterMaterial.d.ts +141 -0
  230. package/water/waterMaterial.js +729 -0
  231. package/water/waterMaterial.js.map +1 -0
@@ -0,0 +1,19 @@
1
+ import "@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js";
2
+ import "@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js";
3
+ import "@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js";
4
+ import "@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js";
5
+ import "@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.js";
6
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js";
7
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
8
+ import "@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js";
9
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js";
10
+ import "@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js";
11
+ import "@babylonjs/core/Shaders/ShadersInclude/lightFragment.js";
12
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js";
13
+ import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
14
+ import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
15
+ /** @internal */
16
+ export declare const normalPixelShader: {
17
+ name: string;
18
+ shader: string;
19
+ };
@@ -0,0 +1,85 @@
1
+ // Do not edit.
2
+ import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
+ import "@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js";
4
+ import "@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js";
5
+ import "@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js";
6
+ import "@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js";
7
+ import "@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.js";
8
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js";
9
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
10
+ import "@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js";
11
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js";
12
+ import "@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js";
13
+ import "@babylonjs/core/Shaders/ShadersInclude/lightFragment.js";
14
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js";
15
+ import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
16
+ import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
17
+ const name = "normalPixelShader";
18
+ const shader = `precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;
19
+ #ifdef NORMAL
20
+ varying vec3 vNormalW;
21
+ #endif
22
+ #ifdef LIGHTING
23
+ #include<helperFunctions>
24
+ #include<__decl__lightFragment>[0]
25
+ #include<__decl__lightFragment>[1]
26
+ #include<__decl__lightFragment>[2]
27
+ #include<__decl__lightFragment>[3]
28
+ #include<lightsFragmentFunctions>
29
+ #include<shadowsFragmentFunctions>
30
+ #endif
31
+ #ifdef DIFFUSE
32
+ varying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;
33
+ #endif
34
+ #include<clipPlaneFragmentDeclaration>
35
+ #ifdef LOGARITHMICDEPTH
36
+ #extension GL_EXT_frag_depth : enable
37
+ #endif
38
+ #include<logDepthDeclaration>
39
+ #include<fogFragmentDeclaration>
40
+ #define CUSTOM_FRAGMENT_DEFINITIONS
41
+ void main(void) {
42
+ #define CUSTOM_FRAGMENT_MAIN_BEGIN
43
+ #include<clipPlaneFragment>
44
+ vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;
45
+ #ifdef DIFFUSE
46
+ baseColor=texture2D(diffuseSampler,vDiffuseUV);
47
+ #ifdef ALPHATEST
48
+ if (baseColor.a<0.4)
49
+ discard;
50
+ #endif
51
+ #include<depthPrePass>
52
+ baseColor.rgb*=vDiffuseInfos.y;
53
+ #endif
54
+ #ifdef NORMAL
55
+ baseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);
56
+ #endif
57
+ #ifdef NORMAL
58
+ vec3 normalW=normalize(vNormalW);
59
+ #else
60
+ vec3 normalW=vec3(1.0,1.0,1.0);
61
+ #endif
62
+ #ifdef LIGHTING
63
+ vec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;
64
+ #include<lightFragment>[0]
65
+ #include<lightFragment>[1]
66
+ #include<lightFragment>[2]
67
+ #include<lightFragment>[3]
68
+ vec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;
69
+ #else
70
+ vec3 finalDiffuse= baseColor.rgb;
71
+ #endif
72
+ vec4 color=vec4(finalDiffuse,alpha);
73
+ #include<logDepthFragment>
74
+ #include<fogFragment>
75
+ gl_FragColor=color;
76
+ #include<imageProcessingCompatibility>
77
+ #define CUSTOM_FRAGMENT_MAIN_END
78
+ }`;
79
+ // Sideeffect
80
+ if (!ShaderStore.ShadersStore[name]) {
81
+ ShaderStore.ShadersStore[name] = shader;
82
+ }
83
+ /** @internal */
84
+ export const normalPixelShader = { name, shader };
85
+ //# sourceMappingURL=normal.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normal.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/normal/normal.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,mEAAqD;AACrD,4EAA8D;AAC9D,uEAAyD;AACzD,2EAA6D;AAC7D,4EAA8D;AAC9D,gFAAkE;AAClE,uEAAyD;AACzD,0EAA4D;AAC5D,qEAAuD;AACvD,gEAAkD;AAClD,iEAAmD;AACnD,oEAAsD;AACtD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4Db,CAAC;AACH,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/helperFunctions\";\nimport \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"core/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"core/Shaders/ShadersInclude/depthPrePass\";\nimport \"core/Shaders/ShadersInclude/lightFragment\";\nimport \"core/Shaders/ShadersInclude/logDepthFragment\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"normalPixelShader\";\nconst shader = `precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef LIGHTING\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#endif\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef LIGHTING\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;float aggShadow=0.;float numLights=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse= baseColor.rgb;\n#endif\nvec4 color=vec4(finalDiffuse,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const normalPixelShader = { name, shader };\n"]}
@@ -0,0 +1,20 @@
1
+ import "@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js";
2
+ import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js";
3
+ import "@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js";
4
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
5
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
6
+ import "@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js";
7
+ import "@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js";
8
+ import "@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js";
9
+ import "@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js";
10
+ import "@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js";
11
+ import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js";
12
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
13
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js";
14
+ import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
15
+ import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
16
+ /** @internal */
17
+ export declare const normalVertexShader: {
18
+ name: string;
19
+ shader: string;
20
+ };
@@ -0,0 +1,88 @@
1
+ // Do not edit.
2
+ import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
+ import "@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js";
4
+ import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js";
5
+ import "@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js";
6
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
7
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
8
+ import "@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js";
9
+ import "@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js";
10
+ import "@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js";
11
+ import "@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js";
12
+ import "@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js";
13
+ import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js";
14
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
15
+ import "@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js";
16
+ import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
17
+ import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
18
+ const name = "normalVertexShader";
19
+ const shader = `precision highp float;attribute vec3 position;
20
+ #ifdef NORMAL
21
+ attribute vec3 normal;
22
+ #endif
23
+ #ifdef UV1
24
+ attribute vec2 uv;
25
+ #endif
26
+ #ifdef UV2
27
+ attribute vec2 uv2;
28
+ #endif
29
+ #ifdef VERTEXCOLOR
30
+ attribute vec4 color;
31
+ #endif
32
+ #include<bonesDeclaration>
33
+ #include<bakedVertexAnimationDeclaration>
34
+ #include<instancesDeclaration>
35
+ uniform mat4 view;uniform mat4 viewProjection;
36
+ #ifdef DIFFUSE
37
+ varying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;
38
+ #endif
39
+ #ifdef POINTSIZE
40
+ uniform float pointSize;
41
+ #endif
42
+ varying vec3 vPositionW;
43
+ #ifdef NORMAL
44
+ varying vec3 vNormalW;
45
+ #endif
46
+ #include<clipPlaneVertexDeclaration>
47
+ #include<logDepthDeclaration>
48
+ #include<fogVertexDeclaration>
49
+ #include<__decl__lightFragment>[0..maxSimultaneousLights]
50
+ #define CUSTOM_VERTEX_DEFINITIONS
51
+ void main(void) {
52
+ #define CUSTOM_VERTEX_MAIN_BEGIN
53
+ #include<instancesVertex>
54
+ #include<bonesVertex>
55
+ #include<bakedVertexAnimation>
56
+ vec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);
57
+ #ifdef NORMAL
58
+ vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
59
+ #endif
60
+ #ifndef UV1
61
+ vec2 uv=vec2(0.,0.);
62
+ #endif
63
+ #ifndef UV2
64
+ vec2 uv2=vec2(0.,0.);
65
+ #endif
66
+ #ifdef DIFFUSE
67
+ if (vDiffuseInfos.x==0.)
68
+ {vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}
69
+ else
70
+ {vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}
71
+ #endif
72
+ #include<clipPlaneVertex>
73
+ #include<logDepthVertex>
74
+ #include<fogVertex>
75
+ #include<shadowsVertex>[0..maxSimultaneousLights]
76
+ #if defined(POINTSIZE) && !defined(WEBGPU)
77
+ gl_PointSize=pointSize;
78
+ #endif
79
+ #define CUSTOM_VERTEX_MAIN_END
80
+ }
81
+ `;
82
+ // Sideeffect
83
+ if (!ShaderStore.ShadersStore[name]) {
84
+ ShaderStore.ShadersStore[name] = shader;
85
+ }
86
+ /** @internal */
87
+ export const normalVertexShader = { name, shader };
88
+ //# sourceMappingURL=normal.vertex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normal.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/normal/normal.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,uEAAyD;AACzD,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,kEAAoD;AACpD,6DAA+C;AAC/C,iEAAmD;AAEnD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Dd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesVertex\";\nimport \"core/Shaders/ShadersInclude/bonesVertex\";\nimport \"core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"core/Shaders/ShadersInclude/logDepthVertex\";\nimport \"core/Shaders/ShadersInclude/fogVertex\";\nimport \"core/Shaders/ShadersInclude/shadowsVertex\";\n\nconst name = \"normalVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const normalVertexShader = { name, shader };\n"]}
@@ -0,0 +1,36 @@
1
+ import type { Nullable } from "@babylonjs/core/types.js";
2
+ import type { Matrix } from "@babylonjs/core/Maths/math.vector.js";
3
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
4
+ import type { IAnimatable } from "@babylonjs/core/Animations/animatable.interface.js";
5
+ import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
6
+ import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
7
+ import type { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
8
+ import type { SubMesh } from "@babylonjs/core/Meshes/subMesh.js";
9
+ import type { Mesh } from "@babylonjs/core/Meshes/mesh.js";
10
+ import { Scene } from "@babylonjs/core/scene.js";
11
+ import "./normal.fragment.js";
12
+ import "./normal.vertex.js";
13
+ export declare class NormalMaterial extends PushMaterial {
14
+ private _diffuseTexture;
15
+ diffuseTexture: BaseTexture;
16
+ diffuseColor: Color3;
17
+ private _disableLighting;
18
+ disableLighting: boolean;
19
+ private _maxSimultaneousLights;
20
+ maxSimultaneousLights: number;
21
+ constructor(name: string, scene?: Scene);
22
+ needAlphaBlending(): boolean;
23
+ needAlphaBlendingForMesh(mesh: AbstractMesh): boolean;
24
+ needAlphaTesting(): boolean;
25
+ getAlphaTestTexture(): Nullable<BaseTexture>;
26
+ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
27
+ bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
28
+ getAnimatables(): IAnimatable[];
29
+ getActiveTextures(): BaseTexture[];
30
+ hasTexture(texture: BaseTexture): boolean;
31
+ dispose(forceDisposeEffect?: boolean): void;
32
+ clone(name: string): NormalMaterial;
33
+ serialize(): any;
34
+ getClassName(): string;
35
+ static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial;
36
+ }
@@ -0,0 +1,345 @@
1
+ import { __decorate } from "@babylonjs/core/tslib.es6.js";
2
+ import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
3
+ import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
4
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
5
+ import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
6
+ import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
7
+ import { MaterialFlags } from "@babylonjs/core/Materials/materialFlags.js";
8
+ import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
9
+ import { Scene } from "@babylonjs/core/scene.js";
10
+ import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
11
+ import "./normal.fragment.js";
12
+ import "./normal.vertex.js";
13
+ import { EffectFallbacks } from "@babylonjs/core/Materials/effectFallbacks.js";
14
+ import { AddClipPlaneUniforms, BindClipPlane } from "@babylonjs/core/Materials/clipPlaneMaterialHelper.js";
15
+ import { BindBonesParameters, BindFogParameters, BindLights, BindLogDepth, HandleFallbacksForShadows, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForMisc, PrepareUniformsAndSamplersList, } from "@babylonjs/core/Materials/materialHelper.functions.js";
16
+ class NormalMaterialDefines extends MaterialDefines {
17
+ constructor() {
18
+ super();
19
+ this.DIFFUSE = false;
20
+ this.CLIPPLANE = false;
21
+ this.CLIPPLANE2 = false;
22
+ this.CLIPPLANE3 = false;
23
+ this.CLIPPLANE4 = false;
24
+ this.CLIPPLANE5 = false;
25
+ this.CLIPPLANE6 = false;
26
+ this.ALPHATEST = false;
27
+ this.DEPTHPREPASS = false;
28
+ this.POINTSIZE = false;
29
+ this.FOG = false;
30
+ this.LIGHT0 = false;
31
+ this.LIGHT1 = false;
32
+ this.LIGHT2 = false;
33
+ this.LIGHT3 = false;
34
+ this.SPOTLIGHT0 = false;
35
+ this.SPOTLIGHT1 = false;
36
+ this.SPOTLIGHT2 = false;
37
+ this.SPOTLIGHT3 = false;
38
+ this.HEMILIGHT0 = false;
39
+ this.HEMILIGHT1 = false;
40
+ this.HEMILIGHT2 = false;
41
+ this.HEMILIGHT3 = false;
42
+ this.DIRLIGHT0 = false;
43
+ this.DIRLIGHT1 = false;
44
+ this.DIRLIGHT2 = false;
45
+ this.DIRLIGHT3 = false;
46
+ this.POINTLIGHT0 = false;
47
+ this.POINTLIGHT1 = false;
48
+ this.POINTLIGHT2 = false;
49
+ this.POINTLIGHT3 = false;
50
+ this.SHADOW0 = false;
51
+ this.SHADOW1 = false;
52
+ this.SHADOW2 = false;
53
+ this.SHADOW3 = false;
54
+ this.SHADOWS = false;
55
+ this.SHADOWESM0 = false;
56
+ this.SHADOWESM1 = false;
57
+ this.SHADOWESM2 = false;
58
+ this.SHADOWESM3 = false;
59
+ this.SHADOWPOISSON0 = false;
60
+ this.SHADOWPOISSON1 = false;
61
+ this.SHADOWPOISSON2 = false;
62
+ this.SHADOWPOISSON3 = false;
63
+ this.SHADOWPCF0 = false;
64
+ this.SHADOWPCF1 = false;
65
+ this.SHADOWPCF2 = false;
66
+ this.SHADOWPCF3 = false;
67
+ this.SHADOWPCSS0 = false;
68
+ this.SHADOWPCSS1 = false;
69
+ this.SHADOWPCSS2 = false;
70
+ this.SHADOWPCSS3 = false;
71
+ this.NORMAL = false;
72
+ this.UV1 = false;
73
+ this.UV2 = false;
74
+ this.NUM_BONE_INFLUENCERS = 0;
75
+ this.BonesPerMesh = 0;
76
+ this.INSTANCES = false;
77
+ this.THIN_INSTANCES = false;
78
+ this.LIGHTING = false;
79
+ this.IMAGEPROCESSINGPOSTPROCESS = false;
80
+ this.SKIPFINALCOLORCLAMP = false;
81
+ this.LOGARITHMICDEPTH = false;
82
+ this.AREALIGHTSUPPORTED = true;
83
+ this.AREALIGHTNOROUGHTNESS = true;
84
+ this.rebuild();
85
+ }
86
+ }
87
+ export class NormalMaterial extends PushMaterial {
88
+ constructor(name, scene) {
89
+ super(name, scene);
90
+ this.diffuseColor = new Color3(1, 1, 1);
91
+ this._disableLighting = false;
92
+ this._maxSimultaneousLights = 4;
93
+ }
94
+ needAlphaBlending() {
95
+ return this.alpha < 1.0;
96
+ }
97
+ needAlphaBlendingForMesh(mesh) {
98
+ return this.needAlphaBlending() || mesh.visibility < 1.0;
99
+ }
100
+ needAlphaTesting() {
101
+ return false;
102
+ }
103
+ getAlphaTestTexture() {
104
+ return null;
105
+ }
106
+ // Methods
107
+ isReadyForSubMesh(mesh, subMesh, useInstances) {
108
+ const drawWrapper = subMesh._drawWrapper;
109
+ if (this.isFrozen) {
110
+ if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {
111
+ return true;
112
+ }
113
+ }
114
+ if (!subMesh.materialDefines) {
115
+ subMesh.materialDefines = new NormalMaterialDefines();
116
+ }
117
+ const defines = subMesh.materialDefines;
118
+ const scene = this.getScene();
119
+ if (this._isReadyForSubMesh(subMesh)) {
120
+ return true;
121
+ }
122
+ const engine = scene.getEngine();
123
+ // Textures
124
+ if (defines._areTexturesDirty) {
125
+ defines._needUVs = false;
126
+ if (scene.texturesEnabled) {
127
+ if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {
128
+ if (!this._diffuseTexture.isReady()) {
129
+ return false;
130
+ }
131
+ else {
132
+ defines._needUVs = true;
133
+ defines.DIFFUSE = true;
134
+ }
135
+ }
136
+ }
137
+ }
138
+ // Misc.
139
+ PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this.needAlphaTestingForMesh(mesh), defines);
140
+ // Lights
141
+ defines._needNormals = true;
142
+ PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
143
+ // Values that need to be evaluated on every frame
144
+ PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false, null, subMesh.getRenderingMesh().hasThinInstances);
145
+ defines.LIGHTING = !this._disableLighting;
146
+ // Attribs
147
+ PrepareDefinesForAttributes(mesh, defines, true, true);
148
+ // Get correct effect
149
+ if (defines.isDirty) {
150
+ defines.markAsProcessed();
151
+ scene.resetCachedMaterial();
152
+ // Fallbacks
153
+ const fallbacks = new EffectFallbacks();
154
+ if (defines.FOG) {
155
+ fallbacks.addFallback(1, "FOG");
156
+ }
157
+ HandleFallbacksForShadows(defines, fallbacks);
158
+ if (defines.NUM_BONE_INFLUENCERS > 0) {
159
+ fallbacks.addCPUSkinningFallback(0, mesh);
160
+ }
161
+ defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
162
+ //Attributes
163
+ const attribs = [VertexBuffer.PositionKind];
164
+ if (defines.NORMAL) {
165
+ attribs.push(VertexBuffer.NormalKind);
166
+ }
167
+ if (defines.UV1) {
168
+ attribs.push(VertexBuffer.UVKind);
169
+ }
170
+ if (defines.UV2) {
171
+ attribs.push(VertexBuffer.UV2Kind);
172
+ }
173
+ PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
174
+ PrepareAttributesForInstances(attribs, defines);
175
+ const shaderName = "normal";
176
+ const join = defines.toString();
177
+ const uniforms = [
178
+ "world",
179
+ "view",
180
+ "viewProjection",
181
+ "vEyePosition",
182
+ "vLightsType",
183
+ "vDiffuseColor",
184
+ "vFogInfos",
185
+ "vFogColor",
186
+ "pointSize",
187
+ "vDiffuseInfos",
188
+ "mBones",
189
+ "diffuseMatrix",
190
+ "logarithmicDepthConstant",
191
+ ];
192
+ const samplers = ["diffuseSampler", "areaLightsLTC1Sampler", "areaLightsLTC2Sampler"];
193
+ const uniformBuffers = [];
194
+ AddClipPlaneUniforms(uniforms);
195
+ PrepareUniformsAndSamplersList({
196
+ uniformsNames: uniforms,
197
+ uniformBuffersNames: uniformBuffers,
198
+ samplers: samplers,
199
+ defines: defines,
200
+ maxSimultaneousLights: 4,
201
+ });
202
+ subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
203
+ attributes: attribs,
204
+ uniformsNames: uniforms,
205
+ uniformBuffersNames: uniformBuffers,
206
+ samplers: samplers,
207
+ defines: join,
208
+ fallbacks: fallbacks,
209
+ onCompiled: this.onCompiled,
210
+ onError: this.onError,
211
+ indexParameters: { maxSimultaneousLights: 4 },
212
+ }, engine), defines, this._materialContext);
213
+ }
214
+ // Check if Area Lights have LTC texture.
215
+ if (defines["AREALIGHTUSED"]) {
216
+ for (let index = 0; index < mesh.lightSources.length; index++) {
217
+ if (!mesh.lightSources[index]._isReady()) {
218
+ return false;
219
+ }
220
+ }
221
+ }
222
+ if (!subMesh.effect || !subMesh.effect.isReady()) {
223
+ return false;
224
+ }
225
+ defines._renderId = scene.getRenderId();
226
+ drawWrapper._wasPreviouslyReady = true;
227
+ drawWrapper._wasPreviouslyUsingInstances = !!useInstances;
228
+ return true;
229
+ }
230
+ bindForSubMesh(world, mesh, subMesh) {
231
+ const scene = this.getScene();
232
+ const defines = subMesh.materialDefines;
233
+ if (!defines) {
234
+ return;
235
+ }
236
+ const effect = subMesh.effect;
237
+ if (!effect) {
238
+ return;
239
+ }
240
+ this._activeEffect = effect;
241
+ // Matrices
242
+ this.bindOnlyWorldMatrix(world);
243
+ this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
244
+ // Bones
245
+ BindBonesParameters(mesh, this._activeEffect);
246
+ if (this._mustRebind(scene, effect, subMesh)) {
247
+ // Textures
248
+ if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {
249
+ this._activeEffect.setTexture("diffuseSampler", this.diffuseTexture);
250
+ this._activeEffect.setFloat2("vDiffuseInfos", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);
251
+ this._activeEffect.setMatrix("diffuseMatrix", this.diffuseTexture.getTextureMatrix());
252
+ }
253
+ // Clip plane
254
+ BindClipPlane(effect, this, scene);
255
+ // Point size
256
+ if (this.pointsCloud) {
257
+ this._activeEffect.setFloat("pointSize", this.pointSize);
258
+ }
259
+ // Log. depth
260
+ if (this._useLogarithmicDepth) {
261
+ BindLogDepth(defines, effect, scene);
262
+ }
263
+ scene.bindEyePosition(effect);
264
+ }
265
+ this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
266
+ // Lights
267
+ if (scene.lightsEnabled && !this.disableLighting) {
268
+ BindLights(scene, mesh, this._activeEffect, defines);
269
+ }
270
+ // View
271
+ if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {
272
+ this._activeEffect.setMatrix("view", scene.getViewMatrix());
273
+ }
274
+ // Fog
275
+ BindFogParameters(scene, mesh, this._activeEffect);
276
+ this._afterBind(mesh, this._activeEffect, subMesh);
277
+ }
278
+ getAnimatables() {
279
+ const results = [];
280
+ if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {
281
+ results.push(this.diffuseTexture);
282
+ }
283
+ return results;
284
+ }
285
+ getActiveTextures() {
286
+ const activeTextures = super.getActiveTextures();
287
+ if (this._diffuseTexture) {
288
+ activeTextures.push(this._diffuseTexture);
289
+ }
290
+ return activeTextures;
291
+ }
292
+ hasTexture(texture) {
293
+ if (super.hasTexture(texture)) {
294
+ return true;
295
+ }
296
+ if (this.diffuseTexture === texture) {
297
+ return true;
298
+ }
299
+ return false;
300
+ }
301
+ dispose(forceDisposeEffect) {
302
+ if (this.diffuseTexture) {
303
+ this.diffuseTexture.dispose();
304
+ }
305
+ super.dispose(forceDisposeEffect);
306
+ }
307
+ clone(name) {
308
+ return SerializationHelper.Clone(() => new NormalMaterial(name, this.getScene()), this);
309
+ }
310
+ serialize() {
311
+ const serializationObject = super.serialize();
312
+ serializationObject.customType = "BABYLON.NormalMaterial";
313
+ return serializationObject;
314
+ }
315
+ getClassName() {
316
+ return "NormalMaterial";
317
+ }
318
+ // Statics
319
+ static Parse(source, scene, rootUrl) {
320
+ return SerializationHelper.Parse(() => new NormalMaterial(source.name, scene), source, scene, rootUrl);
321
+ }
322
+ }
323
+ __decorate([
324
+ serializeAsTexture("diffuseTexture")
325
+ ], NormalMaterial.prototype, "_diffuseTexture", void 0);
326
+ __decorate([
327
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
328
+ ], NormalMaterial.prototype, "diffuseTexture", void 0);
329
+ __decorate([
330
+ serializeAsColor3()
331
+ ], NormalMaterial.prototype, "diffuseColor", void 0);
332
+ __decorate([
333
+ serialize("disableLighting")
334
+ ], NormalMaterial.prototype, "_disableLighting", void 0);
335
+ __decorate([
336
+ expandToProperty("_markAllSubMeshesAsLightsDirty")
337
+ ], NormalMaterial.prototype, "disableLighting", void 0);
338
+ __decorate([
339
+ serialize("maxSimultaneousLights")
340
+ ], NormalMaterial.prototype, "_maxSimultaneousLights", void 0);
341
+ __decorate([
342
+ expandToProperty("_markAllSubMeshesAsLightsDirty")
343
+ ], NormalMaterial.prototype, "maxSimultaneousLights", void 0);
344
+ RegisterClass("BABYLON.NormalMaterial", NormalMaterial);
345
+ //# sourceMappingURL=normalMaterial.js.map