@babylonjs/materials 5.19.0 → 5.22.0

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 (121) hide show
  1. package/cell/cell.fragment.js +14 -2
  2. package/cell/cell.fragment.js.map +1 -1
  3. package/cell/cell.vertex.js +45 -3
  4. package/cell/cell.vertex.js.map +1 -1
  5. package/cell/cellMaterial.js +112 -120
  6. package/cell/cellMaterial.js.map +1 -1
  7. package/custom/customMaterial.js +69 -81
  8. package/custom/customMaterial.js.map +1 -1
  9. package/custom/pbrCustomMaterial.js +80 -89
  10. package/custom/pbrCustomMaterial.js.map +1 -1
  11. package/fire/fire.fragment.js +44 -3
  12. package/fire/fire.fragment.js.map +1 -1
  13. package/fire/fire.vertex.js +54 -3
  14. package/fire/fire.vertex.js.map +1 -1
  15. package/fire/fireMaterial.js +101 -109
  16. package/fire/fireMaterial.js.map +1 -1
  17. package/fur/fur.fragment.js +67 -3
  18. package/fur/fur.fragment.js.map +1 -1
  19. package/fur/fur.vertex.js +97 -3
  20. package/fur/fur.vertex.js.map +1 -1
  21. package/fur/furMaterial.js +181 -193
  22. package/fur/furMaterial.js.map +1 -1
  23. package/gradient/gradient.fragment.js +36 -3
  24. package/gradient/gradient.fragment.js.map +1 -1
  25. package/gradient/gradient.vertex.js +41 -3
  26. package/gradient/gradient.vertex.js.map +1 -1
  27. package/gradient/gradientMaterial.js +113 -121
  28. package/gradient/gradientMaterial.js.map +1 -1
  29. package/grid/grid.fragment.js +8 -2
  30. package/grid/grid.fragment.js.map +1 -1
  31. package/grid/grid.vertex.js +22 -3
  32. package/grid/grid.vertex.js.map +1 -1
  33. package/grid/gridMaterial.js +93 -101
  34. package/grid/gridMaterial.js.map +1 -1
  35. package/lava/lava.fragment.js +62 -3
  36. package/lava/lava.fragment.js.map +1 -1
  37. package/lava/lava.vertex.js +84 -3
  38. package/lava/lava.vertex.js.map +1 -1
  39. package/lava/lavaMaterial.js +175 -183
  40. package/lava/lavaMaterial.js.map +1 -1
  41. package/legacy/legacy-cell.js +2 -2
  42. package/legacy/legacy-cell.js.map +1 -1
  43. package/legacy/legacy-custom.js +2 -2
  44. package/legacy/legacy-custom.js.map +1 -1
  45. package/legacy/legacy-fire.js +2 -2
  46. package/legacy/legacy-fire.js.map +1 -1
  47. package/legacy/legacy-fur.js +2 -2
  48. package/legacy/legacy-fur.js.map +1 -1
  49. package/legacy/legacy-gradient.js +2 -2
  50. package/legacy/legacy-gradient.js.map +1 -1
  51. package/legacy/legacy-grid.js +2 -2
  52. package/legacy/legacy-grid.js.map +1 -1
  53. package/legacy/legacy-lava.js +2 -2
  54. package/legacy/legacy-lava.js.map +1 -1
  55. package/legacy/legacy-mix.js +2 -2
  56. package/legacy/legacy-mix.js.map +1 -1
  57. package/legacy/legacy-normal.js +2 -2
  58. package/legacy/legacy-normal.js.map +1 -1
  59. package/legacy/legacy-shadowOnly.js +2 -2
  60. package/legacy/legacy-shadowOnly.js.map +1 -1
  61. package/legacy/legacy-simple.js +2 -2
  62. package/legacy/legacy-simple.js.map +1 -1
  63. package/legacy/legacy-sky.js +2 -2
  64. package/legacy/legacy-sky.js.map +1 -1
  65. package/legacy/legacy-terrain.js +2 -2
  66. package/legacy/legacy-terrain.js.map +1 -1
  67. package/legacy/legacy-triPlanar.js +2 -2
  68. package/legacy/legacy-triPlanar.js.map +1 -1
  69. package/legacy/legacy-water.js +2 -2
  70. package/legacy/legacy-water.js.map +1 -1
  71. package/legacy/legacy.js +2 -2
  72. package/legacy/legacy.js.map +1 -1
  73. package/mix/mix.fragment.js +33 -2
  74. package/mix/mix.fragment.js.map +1 -1
  75. package/mix/mix.vertex.js +67 -3
  76. package/mix/mix.vertex.js.map +1 -1
  77. package/mix/mixMaterial.js +166 -174
  78. package/mix/mixMaterial.js.map +1 -1
  79. package/normal/normal.fragment.js +41 -3
  80. package/normal/normal.fragment.js.map +1 -1
  81. package/normal/normal.vertex.js +42 -3
  82. package/normal/normal.vertex.js.map +1 -1
  83. package/normal/normalMaterial.js +143 -151
  84. package/normal/normalMaterial.js.map +1 -1
  85. package/package.json +2 -5
  86. package/shadowOnly/shadowOnly.fragment.js +21 -3
  87. package/shadowOnly/shadowOnly.fragment.js.map +1 -1
  88. package/shadowOnly/shadowOnly.vertex.js +30 -3
  89. package/shadowOnly/shadowOnly.vertex.js.map +1 -1
  90. package/shadowOnly/shadowOnlyMaterial.js +73 -89
  91. package/shadowOnly/shadowOnlyMaterial.js.map +1 -1
  92. package/simple/simple.fragment.js +36 -3
  93. package/simple/simple.fragment.js.map +1 -1
  94. package/simple/simple.vertex.js +45 -3
  95. package/simple/simple.vertex.js.map +1 -1
  96. package/simple/simpleMaterial.js +102 -110
  97. package/simple/simpleMaterial.js.map +1 -1
  98. package/sky/sky.fragment.js +17 -3
  99. package/sky/sky.fragment.js.map +1 -1
  100. package/sky/sky.vertex.js +20 -3
  101. package/sky/sky.vertex.js.map +1 -1
  102. package/sky/skyMaterial.js +111 -119
  103. package/sky/skyMaterial.js.map +1 -1
  104. package/terrain/terrain.fragment.js +36 -2
  105. package/terrain/terrain.fragment.js.map +1 -1
  106. package/terrain/terrain.vertex.js +67 -3
  107. package/terrain/terrain.vertex.js.map +1 -1
  108. package/terrain/terrainMaterial.js +148 -156
  109. package/terrain/terrainMaterial.js.map +1 -1
  110. package/triPlanar/triPlanarMaterial.js +157 -165
  111. package/triPlanar/triPlanarMaterial.js.map +1 -1
  112. package/triPlanar/triplanar.fragment.js +64 -3
  113. package/triPlanar/triplanar.fragment.js.map +1 -1
  114. package/triPlanar/triplanar.vertex.js +45 -3
  115. package/triPlanar/triplanar.vertex.js.map +1 -1
  116. package/water/water.fragment.js +83 -3
  117. package/water/water.fragment.js.map +1 -1
  118. package/water/water.vertex.js +56 -3
  119. package/water/water.vertex.js.map +1 -1
  120. package/water/waterMaterial.js +283 -313
  121. package/water/waterMaterial.js.map +1 -1
@@ -12,10 +12,58 @@ import "@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js";
12
12
  import "@babylonjs/core/Shaders/ShadersInclude/lightFragment.js";
13
13
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
14
14
  import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
15
- var name = "terrainPixelShader";
16
- var shader = "precision highp float;\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D textureSampler;\nuniform vec2 vTextureInfos;\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\n#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;\nuniform sampler2D bump2Sampler;\nuniform sampler2D bump3Sampler;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));\nreturn mat3(tangent*invmax,binormal*invmax,normal);\n}\nvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\n{\nvec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;\nvec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;\nvec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;\nbump1Color.rgb*=mixColor.r;\nbump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);\nvec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);\nmap=map*255./127.-128./127.;\nmat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);\nreturn normalize(TBN*map);\n}\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\ndiffuse1Color.rgb*=baseColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);\nbaseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";
15
+ const name = "terrainPixelShader";
16
+ const shader = `precision highp float;
17
+ uniform vec4 vSpecularColor;
18
+ varying vec3 vPositionW;
19
+ varying vec3 vNormalW;
20
+ #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)
21
+ varying vec4 vColor;
22
+ #include<helperFunctions>
23
+ #include<__decl__lightFragment>[0..maxSimultaneousLights]
24
+ #ifdef DIFFUSE
25
+ varying vec2 vTextureUV;
26
+ #ifdef BUMP
27
+ uniform sampler2D bump1Sampler;
28
+ #include<lightsFragmentFunctions>
29
+ #include<shadowsFragmentFunctions>
30
+ #include<clipPlaneFragmentDeclaration>
31
+ #include<fogFragmentDeclaration>
32
+ #ifdef BUMP
33
+ #extension GL_OES_standard_derivatives : enable
34
+ mat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)
35
+ #define CUSTOM_FRAGMENT_DEFINITIONS
36
+ void main(void) {
37
+ #include<clipPlaneFragment>
38
+ vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);
39
+ float glossiness=vSpecularColor.a;
40
+ float glossiness=0.;
41
+ float alpha=vDiffuseColor.a;
42
+ vec3 normalW=normalize(vNormalW);
43
+ vec3 normalW=vec3(1.0,1.0,1.0);
44
+ #ifdef DIFFUSE
45
+ baseColor=texture2D(textureSampler,vTextureUV);
46
+ normalW=perturbNormal(viewDirectionW,baseColor.rgb);
47
+ #ifdef ALPHATEST
48
+ if (baseColor.a<0.4)
49
+ #include<depthPrePass>
50
+ baseColor.rgb*=vTextureInfos.y;
@@ -1 +1 @@
1
- {"version":3,"file":"terrain.fragment.js","sourceRoot":"","sources":["../../../../../lts/materials/generated/terrain/terrain.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,0EAA4D;AAC5D,qEAAuD;AACvD,gEAAkD;AAClD,iEAAmD;AACnD,+DAAiD;AACjD,gFAAkE;AAElE,IAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,IAAM,MAAM,GAAG,20HA6Hd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,kBAAkB,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,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/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"core/Shaders/ShadersInclude/depthPrePass\";\nimport \"core/Shaders/ShadersInclude/lightFragment\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"terrainPixelShader\";\nconst shader = `precision highp float;\runiform vec4 vEyePosition;\runiform vec4 vDiffuseColor;\r#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\r#endif\nvarying vec3 vPositionW;\r#ifdef NORMAL\nvarying vec3 vNormalW;\r#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)\nvarying vec4 vColor;\r#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\runiform sampler2D textureSampler;\runiform vec2 vTextureInfos;\runiform sampler2D diffuse1Sampler;\runiform sampler2D diffuse2Sampler;\runiform sampler2D diffuse3Sampler;\runiform vec2 diffuse1Infos;\runiform vec2 diffuse2Infos;\runiform vec2 diffuse3Infos;\r#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;\runiform sampler2D bump2Sampler;\runiform sampler2D bump3Sampler;\r#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\r{\rvec3 dp1=dFdx(p);\rvec3 dp2=dFdy(p);\rvec2 duv1=dFdx(uv);\rvec2 duv2=dFdy(uv);\rvec3 dp2perp=cross(dp2,normal);\rvec3 dp1perp=cross(normal,dp1);\rvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\rvec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;\rfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));\rreturn mat3(tangent*invmax,binormal*invmax,normal);\r}\rvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\r{\rvec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;\rvec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;\rvec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;\rbump1Color.rgb*=mixColor.r;\rbump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);\rvec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);\rmap=map*255./127.-128./127.;\rmat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);\rreturn normalize(TBN*map);\r}\r#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\r#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\rvec4 baseColor=vec4(1.,1.,1.,1.);\rvec3 diffuseColor=vDiffuseColor.rgb;\r#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\rvec3 specularColor=vSpecularColor.rgb;\r#else\nfloat glossiness=0.;\r#endif\nfloat alpha=vDiffuseColor.a;\r#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\r#else\nvec3 normalW=vec3(1.0,1.0,1.0);\r#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\r#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\r#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\rdiscard;\r#endif\n#include<depthPrePass>\nbaseColor.rgb*=vTextureInfos.y;\rvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\rvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\rvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\rdiffuse1Color.rgb*=baseColor.r;\rdiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);\rbaseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\r#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)\nbaseColor.rgb*=vColor.rgb;\r#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\rlightingInfo info;\rfloat shadow=1.;\r#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\r#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR)\nalpha*=vColor.a;\r#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\r#else\nvec3 finalSpecular=vec3(0.0);\r#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);\rvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\r#include<fogFragment>\ngl_FragColor=color;\r#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\r`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const terrainPixelShader = { name, shader };\n"]}
1
+ {"version":3,"file":"terrain.fragment.js","sourceRoot":"","sources":["../../../../../lts/materials/generated/terrain/terrain.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,0EAA4D;AAC5D,qEAAuD;AACvD,gEAAkD;AAClD,iEAAmD;AACnD,+DAAiD;AACjD,gFAAkE;AAElE,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Hd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,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/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/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"core/Shaders/ShadersInclude/depthPrePass\";\nimport \"core/Shaders/ShadersInclude/lightFragment\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"terrainPixelShader\";\nconst shader = `precision highp float;\runiform vec4 vEyePosition;\runiform vec4 vDiffuseColor;\r#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\r#endif\nvarying vec3 vPositionW;\r#ifdef NORMAL\nvarying vec3 vNormalW;\r#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)\nvarying vec4 vColor;\r#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\runiform sampler2D textureSampler;\runiform vec2 vTextureInfos;\runiform sampler2D diffuse1Sampler;\runiform sampler2D diffuse2Sampler;\runiform sampler2D diffuse3Sampler;\runiform vec2 diffuse1Infos;\runiform vec2 diffuse2Infos;\runiform vec2 diffuse3Infos;\r#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;\runiform sampler2D bump2Sampler;\runiform sampler2D bump3Sampler;\r#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\r{\rvec3 dp1=dFdx(p);\rvec3 dp2=dFdy(p);\rvec2 duv1=dFdx(uv);\rvec2 duv2=dFdy(uv);\rvec3 dp2perp=cross(dp2,normal);\rvec3 dp1perp=cross(normal,dp1);\rvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\rvec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;\rfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));\rreturn mat3(tangent*invmax,binormal*invmax,normal);\r}\rvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\r{\rvec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;\rvec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;\rvec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;\rbump1Color.rgb*=mixColor.r;\rbump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);\rvec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);\rmap=map*255./127.-128./127.;\rmat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);\rreturn normalize(TBN*map);\r}\r#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\r#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\rvec4 baseColor=vec4(1.,1.,1.,1.);\rvec3 diffuseColor=vDiffuseColor.rgb;\r#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\rvec3 specularColor=vSpecularColor.rgb;\r#else\nfloat glossiness=0.;\r#endif\nfloat alpha=vDiffuseColor.a;\r#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\r#else\nvec3 normalW=vec3(1.0,1.0,1.0);\r#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\r#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\r#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\rdiscard;\r#endif\n#include<depthPrePass>\nbaseColor.rgb*=vTextureInfos.y;\rvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\rvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\rvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\rdiffuse1Color.rgb*=baseColor.r;\rdiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);\rbaseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\r#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)\nbaseColor.rgb*=vColor.rgb;\r#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\rlightingInfo info;\rfloat shadow=1.;\r#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\r#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR)\nalpha*=vColor.a;\r#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\r#else\nvec3 finalSpecular=vec3(0.0);\r#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);\rvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\r#include<fogFragment>\ngl_FragColor=color;\r#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\r`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const terrainPixelShader = { name, shader };\n"]}
@@ -14,10 +14,74 @@ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
14
14
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
15
15
  import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
16
16
  import "@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js";
17
- var name = "terrainVertexShader";
18
- var 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 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\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 (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";
17
+ const name = "terrainVertexShader";
18
+ const shader = `precision highp float;attribute vec3 position;
19
+ #ifdef NORMAL
20
+ attribute vec3 normal;
21
+ #endif
22
+ #ifdef UV1
23
+ attribute vec2 uv;
24
+ #endif
25
+ #ifdef UV2
26
+ attribute vec2 uv2;
27
+ #endif
28
+ #ifdef VERTEXCOLOR
29
+ attribute vec4 color;
30
+ #endif
31
+ #include<bonesDeclaration>
32
+ #include<bakedVertexAnimationDeclaration>
33
+ #include<instancesDeclaration>
34
+ uniform mat4 view;uniform mat4 viewProjection;
35
+ #ifdef DIFFUSE
36
+ varying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;
37
+ #endif
38
+ #ifdef POINTSIZE
39
+ uniform float pointSize;
40
+ #endif
41
+ varying vec3 vPositionW;
42
+ #ifdef NORMAL
43
+ varying vec3 vNormalW;
44
+ #endif
45
+ #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)
46
+ varying vec4 vColor;
47
+ #endif
48
+ #include<clipPlaneVertexDeclaration>
49
+ #include<fogVertexDeclaration>
50
+ #include<__decl__lightFragment>[0..maxSimultaneousLights]
51
+ #define CUSTOM_VERTEX_DEFINITIONS
52
+ void main(void) {
53
+ #define CUSTOM_VERTEX_MAIN_BEGIN
54
+ #include<instancesVertex>
55
+ #include<bonesVertex>
56
+ #include<bakedVertexAnimation>
57
+ vec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);
58
+ #ifdef NORMAL
59
+ vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
60
+ #endif
61
+ #ifndef UV1
62
+ vec2 uv=vec2(0.,0.);
63
+ #endif
64
+ #ifndef UV2
65
+ vec2 uv2=vec2(0.,0.);
66
+ #endif
67
+ #ifdef DIFFUSE
68
+ if (vTextureInfos.x==0.)
69
+ {vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}
70
+ else
71
+ {vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}
72
+ #endif
73
+ #include<clipPlaneVertex>
74
+ #include<fogVertex>
75
+ #include<shadowsVertex>[0..maxSimultaneousLights]
76
+ #include<vertexColorMixing>
77
+ #if defined(POINTSIZE) && !defined(WEBGPU)
78
+ gl_PointSize=pointSize;
79
+ #endif
80
+ #define CUSTOM_VERTEX_MAIN_END
81
+ }
82
+ `;
19
83
  // Sideeffect
20
84
  ShaderStore.ShadersStore[name] = shader;
21
85
  /** @hidden */
22
- export var terrainVertexShader = { name: name, shader: shader };
86
+ export const terrainVertexShader = { name, shader };
23
87
  //# sourceMappingURL=terrain.vertex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"terrain.vertex.js","sourceRoot":"","sources":["../../../../../lts/materials/generated/terrain/terrain.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,iEAAmD;AACnD,qEAAuD;AAEvD,IAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,IAAM,MAAM,GAAG,koDAgEd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,mBAAmB,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,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/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/fogVertex\";\nimport \"core/Shaders/ShadersInclude/shadowsVertex\";\nimport \"core/Shaders/ShadersInclude/vertexColorMixing\";\n\nconst name = \"terrainVertexShader\";\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 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\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 (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const terrainVertexShader = { name, shader };\n"]}
1
+ {"version":3,"file":"terrain.vertex.js","sourceRoot":"","sources":["../../../../../lts/materials/generated/terrain/terrain.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,oEAAsD;AACtD,mFAAqE;AACrE,wEAA0D;AAC1D,8EAAgE;AAChE,wEAA0D;AAC1D,4EAA8D;AAC9D,uEAAyD;AACzD,mEAAqD;AACrD,+DAAiD;AACjD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,iEAAmD;AACnD,qEAAuD;AAEvD,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,MAAM,mBAAmB,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/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/fogVertex\";\nimport \"core/Shaders/ShadersInclude/shadowsVertex\";\nimport \"core/Shaders/ShadersInclude/vertexColorMixing\";\n\nconst name = \"terrainVertexShader\";\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 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\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 (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const terrainVertexShader = { name, shader };\n"]}
@@ -1,4 +1,4 @@
1
- import { __decorate, __extends } from "tslib";
1
+ import { __decorate } from "@babylonjs/core/tslib.es6.js";
2
2
  import { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
3
3
  import { Color3 } from "@babylonjs/core/Maths/math.color.js";
4
4
  import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
@@ -11,61 +11,56 @@ import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
11
11
  import "./terrain.fragment.js";
12
12
  import "./terrain.vertex.js";
13
13
  import { EffectFallbacks } from "@babylonjs/core/Materials/effectFallbacks.js";
14
- var TerrainMaterialDefines = /** @class */ (function (_super) {
15
- __extends(TerrainMaterialDefines, _super);
16
- function TerrainMaterialDefines() {
17
- var _this = _super.call(this) || this;
18
- _this.DIFFUSE = false;
19
- _this.BUMP = 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.SPECULARTERM = false;
31
- _this.NORMAL = false;
32
- _this.UV1 = false;
33
- _this.UV2 = false;
34
- _this.VERTEXCOLOR = false;
35
- _this.VERTEXALPHA = false;
36
- _this.NUM_BONE_INFLUENCERS = 0;
37
- _this.BonesPerMesh = 0;
38
- _this.INSTANCES = false;
39
- _this.INSTANCESCOLOR = false;
40
- _this.IMAGEPROCESSINGPOSTPROCESS = false;
41
- _this.SKIPFINALCOLORCLAMP = false;
42
- _this.rebuild();
43
- return _this;
14
+ class TerrainMaterialDefines extends MaterialDefines {
15
+ constructor() {
16
+ super();
17
+ this.DIFFUSE = false;
18
+ this.BUMP = false;
19
+ this.CLIPPLANE = false;
20
+ this.CLIPPLANE2 = false;
21
+ this.CLIPPLANE3 = false;
22
+ this.CLIPPLANE4 = false;
23
+ this.CLIPPLANE5 = false;
24
+ this.CLIPPLANE6 = false;
25
+ this.ALPHATEST = false;
26
+ this.DEPTHPREPASS = false;
27
+ this.POINTSIZE = false;
28
+ this.FOG = false;
29
+ this.SPECULARTERM = false;
30
+ this.NORMAL = false;
31
+ this.UV1 = false;
32
+ this.UV2 = false;
33
+ this.VERTEXCOLOR = false;
34
+ this.VERTEXALPHA = false;
35
+ this.NUM_BONE_INFLUENCERS = 0;
36
+ this.BonesPerMesh = 0;
37
+ this.INSTANCES = false;
38
+ this.INSTANCESCOLOR = false;
39
+ this.IMAGEPROCESSINGPOSTPROCESS = false;
40
+ this.SKIPFINALCOLORCLAMP = false;
41
+ this.rebuild();
44
42
  }
45
- return TerrainMaterialDefines;
46
- }(MaterialDefines));
47
- var TerrainMaterial = /** @class */ (function (_super) {
48
- __extends(TerrainMaterial, _super);
49
- function TerrainMaterial(name, scene) {
50
- var _this = _super.call(this, name, scene) || this;
51
- _this.diffuseColor = new Color3(1, 1, 1);
52
- _this.specularColor = new Color3(0, 0, 0);
53
- _this.specularPower = 64;
54
- _this._disableLighting = false;
55
- _this._maxSimultaneousLights = 4;
56
- return _this;
43
+ }
44
+ export class TerrainMaterial extends PushMaterial {
45
+ constructor(name, scene) {
46
+ super(name, scene);
47
+ this.diffuseColor = new Color3(1, 1, 1);
48
+ this.specularColor = new Color3(0, 0, 0);
49
+ this.specularPower = 64;
50
+ this._disableLighting = false;
51
+ this._maxSimultaneousLights = 4;
57
52
  }
58
- TerrainMaterial.prototype.needAlphaBlending = function () {
53
+ needAlphaBlending() {
59
54
  return this.alpha < 1.0;
60
- };
61
- TerrainMaterial.prototype.needAlphaTesting = function () {
55
+ }
56
+ needAlphaTesting() {
62
57
  return false;
63
- };
64
- TerrainMaterial.prototype.getAlphaTestTexture = function () {
58
+ }
59
+ getAlphaTestTexture() {
65
60
  return null;
66
- };
61
+ }
67
62
  // Methods
68
- TerrainMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
63
+ isReadyForSubMesh(mesh, subMesh, useInstances) {
69
64
  if (this.isFrozen) {
70
65
  if (subMesh.effect && subMesh.effect._wasPreviouslyReady && subMesh.effect._wasPreviouslyUsingInstances === useInstances) {
71
66
  return true;
@@ -74,12 +69,12 @@ var TerrainMaterial = /** @class */ (function (_super) {
74
69
  if (!subMesh.materialDefines) {
75
70
  subMesh.materialDefines = new TerrainMaterialDefines();
76
71
  }
77
- var defines = subMesh.materialDefines;
78
- var scene = this.getScene();
72
+ const defines = subMesh.materialDefines;
73
+ const scene = this.getScene();
79
74
  if (this._isReadyForSubMesh(subMesh)) {
80
75
  return true;
81
76
  }
82
- var engine = scene.getEngine();
77
+ const engine = scene.getEngine();
83
78
  // Textures
84
79
  if (scene.texturesEnabled) {
85
80
  if (!this.mixTexture || !this.mixTexture.isReady()) {
@@ -125,7 +120,7 @@ var TerrainMaterial = /** @class */ (function (_super) {
125
120
  defines.markAsProcessed();
126
121
  scene.resetCachedMaterial();
127
122
  // Fallbacks
128
- var fallbacks = new EffectFallbacks();
123
+ const fallbacks = new EffectFallbacks();
129
124
  if (defines.FOG) {
130
125
  fallbacks.addFallback(1, "FOG");
131
126
  }
@@ -135,7 +130,7 @@ var TerrainMaterial = /** @class */ (function (_super) {
135
130
  }
136
131
  defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
137
132
  //Attributes
138
- var attribs = [VertexBuffer.PositionKind];
133
+ const attribs = [VertexBuffer.PositionKind];
139
134
  if (defines.NORMAL) {
140
135
  attribs.push(VertexBuffer.NormalKind);
141
136
  }
@@ -151,9 +146,9 @@ var TerrainMaterial = /** @class */ (function (_super) {
151
146
  MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
152
147
  MaterialHelper.PrepareAttributesForInstances(attribs, defines);
153
148
  // Legacy browser patch
154
- var shaderName = "terrain";
155
- var join = defines.toString();
156
- var uniforms = [
149
+ const shaderName = "terrain";
150
+ const join = defines.toString();
151
+ const uniforms = [
157
152
  "world",
158
153
  "view",
159
154
  "viewProjection",
@@ -177,8 +172,8 @@ var TerrainMaterial = /** @class */ (function (_super) {
177
172
  "diffuse2Infos",
178
173
  "diffuse3Infos",
179
174
  ];
180
- var samplers = ["textureSampler", "diffuse1Sampler", "diffuse2Sampler", "diffuse3Sampler", "bump1Sampler", "bump2Sampler", "bump3Sampler"];
181
- var uniformBuffers = new Array();
175
+ const samplers = ["textureSampler", "diffuse1Sampler", "diffuse2Sampler", "diffuse3Sampler", "bump1Sampler", "bump2Sampler", "bump3Sampler"];
176
+ const uniformBuffers = new Array();
182
177
  MaterialHelper.PrepareUniformsAndSamplersList({
183
178
  uniformsNames: uniforms,
184
179
  uniformBuffersNames: uniformBuffers,
@@ -205,14 +200,14 @@ var TerrainMaterial = /** @class */ (function (_super) {
205
200
  subMesh.effect._wasPreviouslyReady = true;
206
201
  subMesh.effect._wasPreviouslyUsingInstances = !!useInstances;
207
202
  return true;
208
- };
209
- TerrainMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
210
- var scene = this.getScene();
211
- var defines = subMesh.materialDefines;
203
+ }
204
+ bindForSubMesh(world, mesh, subMesh) {
205
+ const scene = this.getScene();
206
+ const defines = subMesh.materialDefines;
212
207
  if (!defines) {
213
208
  return;
214
209
  }
215
- var effect = subMesh.effect;
210
+ const effect = subMesh.effect;
216
211
  if (!effect) {
217
212
  return;
218
213
  }
@@ -276,16 +271,16 @@ var TerrainMaterial = /** @class */ (function (_super) {
276
271
  // Fog
277
272
  MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);
278
273
  this._afterBind(mesh, this._activeEffect);
279
- };
280
- TerrainMaterial.prototype.getAnimatables = function () {
281
- var results = [];
274
+ }
275
+ getAnimatables() {
276
+ const results = [];
282
277
  if (this.mixTexture && this.mixTexture.animations && this.mixTexture.animations.length > 0) {
283
278
  results.push(this.mixTexture);
284
279
  }
285
280
  return results;
286
- };
287
- TerrainMaterial.prototype.getActiveTextures = function () {
288
- var activeTextures = _super.prototype.getActiveTextures.call(this);
281
+ }
282
+ getActiveTextures() {
283
+ const activeTextures = super.getActiveTextures();
289
284
  if (this._mixTexture) {
290
285
  activeTextures.push(this._mixTexture);
291
286
  }
@@ -308,9 +303,9 @@ var TerrainMaterial = /** @class */ (function (_super) {
308
303
  activeTextures.push(this._bumpTexture3);
309
304
  }
310
305
  return activeTextures;
311
- };
312
- TerrainMaterial.prototype.hasTexture = function (texture) {
313
- if (_super.prototype.hasTexture.call(this, texture)) {
306
+ }
307
+ hasTexture(texture) {
308
+ if (super.hasTexture(texture)) {
314
309
  return true;
315
310
  }
316
311
  if (this._mixTexture === texture) {
@@ -335,94 +330,91 @@ var TerrainMaterial = /** @class */ (function (_super) {
335
330
  return true;
336
331
  }
337
332
  return false;
338
- };
339
- TerrainMaterial.prototype.dispose = function (forceDisposeEffect) {
333
+ }
334
+ dispose(forceDisposeEffect) {
340
335
  if (this.mixTexture) {
341
336
  this.mixTexture.dispose();
342
337
  }
343
- _super.prototype.dispose.call(this, forceDisposeEffect);
344
- };
345
- TerrainMaterial.prototype.clone = function (name) {
346
- var _this = this;
347
- return SerializationHelper.Clone(function () { return new TerrainMaterial(name, _this.getScene()); }, this);
348
- };
349
- TerrainMaterial.prototype.serialize = function () {
350
- var serializationObject = _super.prototype.serialize.call(this);
338
+ super.dispose(forceDisposeEffect);
339
+ }
340
+ clone(name) {
341
+ return SerializationHelper.Clone(() => new TerrainMaterial(name, this.getScene()), this);
342
+ }
343
+ serialize() {
344
+ const serializationObject = super.serialize();
351
345
  serializationObject.customType = "BABYLON.TerrainMaterial";
352
346
  return serializationObject;
353
- };
354
- TerrainMaterial.prototype.getClassName = function () {
347
+ }
348
+ getClassName() {
355
349
  return "TerrainMaterial";
356
- };
350
+ }
357
351
  // Statics
358
- TerrainMaterial.Parse = function (source, scene, rootUrl) {
359
- return SerializationHelper.Parse(function () { return new TerrainMaterial(source.name, scene); }, source, scene, rootUrl);
360
- };
361
- __decorate([
362
- serializeAsTexture("mixTexture")
363
- ], TerrainMaterial.prototype, "_mixTexture", void 0);
364
- __decorate([
365
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
366
- ], TerrainMaterial.prototype, "mixTexture", void 0);
367
- __decorate([
368
- serializeAsTexture("diffuseTexture1")
369
- ], TerrainMaterial.prototype, "_diffuseTexture1", void 0);
370
- __decorate([
371
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
372
- ], TerrainMaterial.prototype, "diffuseTexture1", void 0);
373
- __decorate([
374
- serializeAsTexture("diffuseTexture2")
375
- ], TerrainMaterial.prototype, "_diffuseTexture2", void 0);
376
- __decorate([
377
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
378
- ], TerrainMaterial.prototype, "diffuseTexture2", void 0);
379
- __decorate([
380
- serializeAsTexture("diffuseTexture3")
381
- ], TerrainMaterial.prototype, "_diffuseTexture3", void 0);
382
- __decorate([
383
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
384
- ], TerrainMaterial.prototype, "diffuseTexture3", void 0);
385
- __decorate([
386
- serializeAsTexture("bumpTexture1")
387
- ], TerrainMaterial.prototype, "_bumpTexture1", void 0);
388
- __decorate([
389
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
390
- ], TerrainMaterial.prototype, "bumpTexture1", void 0);
391
- __decorate([
392
- serializeAsTexture("bumpTexture2")
393
- ], TerrainMaterial.prototype, "_bumpTexture2", void 0);
394
- __decorate([
395
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
396
- ], TerrainMaterial.prototype, "bumpTexture2", void 0);
397
- __decorate([
398
- serializeAsTexture("bumpTexture3")
399
- ], TerrainMaterial.prototype, "_bumpTexture3", void 0);
400
- __decorate([
401
- expandToProperty("_markAllSubMeshesAsTexturesDirty")
402
- ], TerrainMaterial.prototype, "bumpTexture3", void 0);
403
- __decorate([
404
- serializeAsColor3()
405
- ], TerrainMaterial.prototype, "diffuseColor", void 0);
406
- __decorate([
407
- serializeAsColor3()
408
- ], TerrainMaterial.prototype, "specularColor", void 0);
409
- __decorate([
410
- serialize()
411
- ], TerrainMaterial.prototype, "specularPower", void 0);
412
- __decorate([
413
- serialize("disableLighting")
414
- ], TerrainMaterial.prototype, "_disableLighting", void 0);
415
- __decorate([
416
- expandToProperty("_markAllSubMeshesAsLightsDirty")
417
- ], TerrainMaterial.prototype, "disableLighting", void 0);
418
- __decorate([
419
- serialize("maxSimultaneousLights")
420
- ], TerrainMaterial.prototype, "_maxSimultaneousLights", void 0);
421
- __decorate([
422
- expandToProperty("_markAllSubMeshesAsLightsDirty")
423
- ], TerrainMaterial.prototype, "maxSimultaneousLights", void 0);
424
- return TerrainMaterial;
425
- }(PushMaterial));
426
- export { TerrainMaterial };
352
+ static Parse(source, scene, rootUrl) {
353
+ return SerializationHelper.Parse(() => new TerrainMaterial(source.name, scene), source, scene, rootUrl);
354
+ }
355
+ }
356
+ __decorate([
357
+ serializeAsTexture("mixTexture")
358
+ ], TerrainMaterial.prototype, "_mixTexture", void 0);
359
+ __decorate([
360
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
361
+ ], TerrainMaterial.prototype, "mixTexture", void 0);
362
+ __decorate([
363
+ serializeAsTexture("diffuseTexture1")
364
+ ], TerrainMaterial.prototype, "_diffuseTexture1", void 0);
365
+ __decorate([
366
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
367
+ ], TerrainMaterial.prototype, "diffuseTexture1", void 0);
368
+ __decorate([
369
+ serializeAsTexture("diffuseTexture2")
370
+ ], TerrainMaterial.prototype, "_diffuseTexture2", void 0);
371
+ __decorate([
372
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
373
+ ], TerrainMaterial.prototype, "diffuseTexture2", void 0);
374
+ __decorate([
375
+ serializeAsTexture("diffuseTexture3")
376
+ ], TerrainMaterial.prototype, "_diffuseTexture3", void 0);
377
+ __decorate([
378
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
379
+ ], TerrainMaterial.prototype, "diffuseTexture3", void 0);
380
+ __decorate([
381
+ serializeAsTexture("bumpTexture1")
382
+ ], TerrainMaterial.prototype, "_bumpTexture1", void 0);
383
+ __decorate([
384
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
385
+ ], TerrainMaterial.prototype, "bumpTexture1", void 0);
386
+ __decorate([
387
+ serializeAsTexture("bumpTexture2")
388
+ ], TerrainMaterial.prototype, "_bumpTexture2", void 0);
389
+ __decorate([
390
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
391
+ ], TerrainMaterial.prototype, "bumpTexture2", void 0);
392
+ __decorate([
393
+ serializeAsTexture("bumpTexture3")
394
+ ], TerrainMaterial.prototype, "_bumpTexture3", void 0);
395
+ __decorate([
396
+ expandToProperty("_markAllSubMeshesAsTexturesDirty")
397
+ ], TerrainMaterial.prototype, "bumpTexture3", void 0);
398
+ __decorate([
399
+ serializeAsColor3()
400
+ ], TerrainMaterial.prototype, "diffuseColor", void 0);
401
+ __decorate([
402
+ serializeAsColor3()
403
+ ], TerrainMaterial.prototype, "specularColor", void 0);
404
+ __decorate([
405
+ serialize()
406
+ ], TerrainMaterial.prototype, "specularPower", void 0);
407
+ __decorate([
408
+ serialize("disableLighting")
409
+ ], TerrainMaterial.prototype, "_disableLighting", void 0);
410
+ __decorate([
411
+ expandToProperty("_markAllSubMeshesAsLightsDirty")
412
+ ], TerrainMaterial.prototype, "disableLighting", void 0);
413
+ __decorate([
414
+ serialize("maxSimultaneousLights")
415
+ ], TerrainMaterial.prototype, "_maxSimultaneousLights", void 0);
416
+ __decorate([
417
+ expandToProperty("_markAllSubMeshesAsLightsDirty")
418
+ ], TerrainMaterial.prototype, "maxSimultaneousLights", void 0);
427
419
  RegisterClass("BABYLON.TerrainMaterial", TerrainMaterial);
428
420
  //# sourceMappingURL=terrainMaterial.js.map