default.vertex.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. // Do not edit.
  2. import { ShaderStore } from "../Engines/shaderStore.js";
  3. import "./ShadersInclude/defaultVertexDeclaration.js";
  4. import "./ShadersInclude/defaultUboDeclaration.js";
  5. import "./ShadersInclude/uvAttributeDeclaration.js";
  6. import "./ShadersInclude/helperFunctions.js";
  7. import "./ShadersInclude/bonesDeclaration.js";
  8. import "./ShadersInclude/bakedVertexAnimationDeclaration.js";
  9. import "./ShadersInclude/instancesDeclaration.js";
  10. import "./ShadersInclude/prePassVertexDeclaration.js";
  11. import "./ShadersInclude/mainUVVaryingDeclaration.js";
  12. import "./ShadersInclude/samplerVertexDeclaration.js";
  13. import "./ShadersInclude/bumpVertexDeclaration.js";
  14. import "./ShadersInclude/clipPlaneVertexDeclaration.js";
  15. import "./ShadersInclude/fogVertexDeclaration.js";
  16. import "./ShadersInclude/lightVxFragmentDeclaration.js";
  17. import "./ShadersInclude/lightVxUboDeclaration.js";
  18. import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
  19. import "./ShadersInclude/morphTargetsVertexDeclaration.js";
  20. import "./ShadersInclude/logDepthDeclaration.js";
  21. import "./ShadersInclude/morphTargetsVertexGlobal.js";
  22. import "./ShadersInclude/morphTargetsVertex.js";
  23. import "./ShadersInclude/instancesVertex.js";
  24. import "./ShadersInclude/bonesVertex.js";
  25. import "./ShadersInclude/bakedVertexAnimation.js";
  26. import "./ShadersInclude/prePassVertex.js";
  27. import "./ShadersInclude/uvVariableDeclaration.js";
  28. import "./ShadersInclude/samplerVertexImplementation.js";
  29. import "./ShadersInclude/bumpVertex.js";
  30. import "./ShadersInclude/clipPlaneVertex.js";
  31. import "./ShadersInclude/fogVertex.js";
  32. import "./ShadersInclude/shadowsVertex.js";
  33. import "./ShadersInclude/vertexColorMixing.js";
  34. import "./ShadersInclude/pointCloudVertex.js";
  35. import "./ShadersInclude/logDepthVertex.js";
  36. const name = "defaultVertexShader";
  37. const shader = `#include<__decl__defaultVertex>
  38. #define CUSTOM_VERTEX_BEGIN
  39. attribute vec3 position;
  40. #ifdef NORMAL
  41. attribute vec3 normal;
  42. #endif
  43. #ifdef TANGENT
  44. attribute vec4 tangent;
  45. #endif
  46. #ifdef UV1
  47. attribute vec2 uv;
  48. #endif
  49. #include<uvAttributeDeclaration>[2..7]
  50. #ifdef VERTEXCOLOR
  51. attribute vec4 color;
  52. #endif
  53. #include<helperFunctions>
  54. #include<bonesDeclaration>
  55. #include<bakedVertexAnimationDeclaration>
  56. #include<instancesDeclaration>
  57. #include<prePassVertexDeclaration>
  58. #include<mainUVVaryingDeclaration>[1..7]
  59. #include<samplerVertexDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse)
  60. #include<samplerVertexDeclaration>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)
  61. #include<samplerVertexDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)
  62. #include<samplerVertexDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)
  63. #include<samplerVertexDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)
  64. #include<samplerVertexDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)
  65. #if defined(SPECULARTERM)
  66. #include<samplerVertexDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular)
  67. #endif
  68. #include<samplerVertexDeclaration>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)
  69. #include<samplerVertexDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)
  70. varying vec3 vPositionW;
  71. #ifdef NORMAL
  72. varying vec3 vNormalW;
  73. #endif
  74. #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
  75. varying vec4 vColor;
  76. #endif
  77. #include<bumpVertexDeclaration>
  78. #include<clipPlaneVertexDeclaration>
  79. #include<fogVertexDeclaration>
  80. #include<__decl__lightVxFragment>[0..maxSimultaneousLights]
  81. #include<morphTargetsVertexGlobalDeclaration>
  82. #include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]
  83. #ifdef REFLECTIONMAP_SKYBOX
  84. varying vec3 vPositionUVW;
  85. #endif
  86. #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
  87. varying vec3 vDirectionW;
  88. #endif
  89. #include<logDepthDeclaration>
  90. #define CUSTOM_VERTEX_DEFINITIONS
  91. void main(void) {
  92. #define CUSTOM_VERTEX_MAIN_BEGIN
  93. vec3 positionUpdated=position;
  94. #ifdef NORMAL
  95. vec3 normalUpdated=normal;
  96. #endif
  97. #ifdef TANGENT
  98. vec4 tangentUpdated=tangent;
  99. #endif
  100. #ifdef UV1
  101. vec2 uvUpdated=uv;
  102. #endif
  103. #include<morphTargetsVertexGlobal>
  104. #include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]
  105. #ifdef REFLECTIONMAP_SKYBOX
  106. vPositionUVW=positionUpdated;
  107. #endif
  108. #define CUSTOM_VERTEX_UPDATE_POSITION
  109. #define CUSTOM_VERTEX_UPDATE_NORMAL
  110. #include<instancesVertex>
  111. #if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)
  112. vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);
  113. #endif
  114. #include<bonesVertex>
  115. #include<bakedVertexAnimation>
  116. vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);
  117. #ifdef NORMAL
  118. mat3 normalWorld=mat3(finalWorld);
  119. #if defined(INSTANCES) && defined(THIN_INSTANCES)
  120. vNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vNormalW=normalize(normalWorld*vNormalW);
  121. #else
  122. #ifdef NONUNIFORMSCALING
  123. normalWorld=transposeMat3(inverseMat3(normalWorld));
  124. #endif
  125. vNormalW=normalize(normalWorld*normalUpdated);
  126. #endif
  127. #endif
  128. #define CUSTOM_VERTEX_UPDATE_WORLDPOS
  129. #ifdef MULTIVIEW
  130. if (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;}
  131. #else
  132. gl_Position=viewProjection*worldPos;
  133. #endif
  134. vPositionW=vec3(worldPos);
  135. #include<prePassVertex>
  136. #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
  137. vDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));
  138. #endif
  139. #ifndef UV1
  140. vec2 uvUpdated=vec2(0.,0.);
  141. #endif
  142. #ifdef MAINUV1
  143. vMainUV1=uvUpdated;
  144. #endif
  145. #include<uvVariableDeclaration>[2..7]
  146. #include<samplerVertexImplementation>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x)
  147. #include<samplerVertexImplementation>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)
  148. #include<samplerVertexImplementation>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)
  149. #include<samplerVertexImplementation>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)
  150. #include<samplerVertexImplementation>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)
  151. #include<samplerVertexImplementation>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)
  152. #if defined(SPECULARTERM)
  153. #include<samplerVertexImplementation>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x)
  154. #endif
  155. #include<samplerVertexImplementation>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)
  156. #include<samplerVertexImplementation>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)
  157. #include<bumpVertex>
  158. #include<clipPlaneVertex>
  159. #include<fogVertex>
  160. #include<shadowsVertex>[0..maxSimultaneousLights]
  161. #include<vertexColorMixing>
  162. #include<pointCloudVertex>
  163. #include<logDepthVertex>
  164. #define CUSTOM_VERTEX_MAIN_END
  165. }
  166. `;
  167. // Sideeffect
  168. ShaderStore.ShadersStore[name] = shader;
  169. /** @internal */
  170. export const defaultVertexShader = { name, shader };
  171. //# sourceMappingURL=default.vertex.js.map