line.vertex.js 1.7 KB

123456789101112131415161718192021222324252627282930
  1. // Do not edit.
  2. import { ShaderStore } from "../Engines/shaderStore.js";
  3. import "./ShadersInclude/instancesDeclaration.js";
  4. import "./ShadersInclude/clipPlaneVertexDeclaration.js";
  5. import "./ShadersInclude/logDepthDeclaration.js";
  6. import "./ShadersInclude/instancesVertex.js";
  7. import "./ShadersInclude/clipPlaneVertex.js";
  8. import "./ShadersInclude/logDepthVertex.js";
  9. const name = "lineVertexShader";
  10. const shader = `#include<instancesDeclaration>
  11. #include<clipPlaneVertexDeclaration>
  12. attribute vec3 position;attribute vec4 normal;uniform mat4 viewProjection;uniform float width;uniform float aspectRatio;
  13. #include<logDepthDeclaration>
  14. #define CUSTOM_VERTEX_DEFINITIONS
  15. void main(void) {
  16. #define CUSTOM_VERTEX_MAIN_BEGIN
  17. #include<instancesVertex>
  18. mat4 worldViewProjection=viewProjection*finalWorld;vec4 viewPosition=worldViewProjection*vec4(position,1.0);vec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);vec2 currentScreen=viewPosition.xy/viewPosition.w;vec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;currentScreen.x*=aspectRatio;nextScreen.x*=aspectRatio;vec2 dir=normalize(nextScreen-currentScreen);vec2 normalDir=vec2(-dir.y,dir.x);normalDir*=width/2.0;normalDir.x/=aspectRatio;vec4 offset=vec4(normalDir*normal.w,0.0,0.0);gl_Position=viewPosition+offset;
  19. #if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)
  20. vec4 worldPos=finalWorld*vec4(position,1.0);
  21. #include<clipPlaneVertex>
  22. #endif
  23. #include<logDepthVertex>
  24. #define CUSTOM_VERTEX_MAIN_END
  25. }`;
  26. // Sideeffect
  27. ShaderStore.ShadersStore[name] = shader;
  28. /** @internal */
  29. export const lineVertexShader = { name, shader };
  30. //# sourceMappingURL=line.vertex.js.map