shadowOnly.vertex.fx.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { Effect } from "babylonjs";
  2. let name = 'shadowOnlyVertexShader';
  3. let shader = `precision highp float;
  4. attribute vec3 position;
  5. #ifdef NORMAL
  6. attribute vec3 normal;
  7. #endif
  8. #include<bonesDeclaration>
  9. #include<instancesDeclaration>
  10. uniform mat4 view;
  11. uniform mat4 viewProjection;
  12. #ifdef POINTSIZE
  13. uniform float pointSize;
  14. #endif
  15. varying vec3 vPositionW;
  16. #ifdef NORMAL
  17. varying vec3 vNormalW;
  18. #endif
  19. #ifdef VERTEXCOLOR
  20. varying vec4 vColor;
  21. #endif
  22. #include<clipPlaneVertexDeclaration>
  23. #include<fogVertexDeclaration>
  24. #include<__decl__lightFragment>[0..maxSimultaneousLights]
  25. void main(void) {
  26. #include<instancesVertex>
  27. #include<bonesVertex>
  28. gl_Position=viewProjection*finalWorld*vec4(position,1.0);
  29. vec4 worldPos=finalWorld*vec4(position,1.0);
  30. vPositionW=vec3(worldPos);
  31. #ifdef NORMAL
  32. vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));
  33. #endif
  34. #include<clipPlaneVertex>
  35. #include<fogVertex>
  36. #include<shadowsVertex>[0..maxSimultaneousLights]
  37. #ifdef POINTSIZE
  38. gl_PointSize=pointSize;
  39. #endif
  40. }
  41. `;
  42. Effect.ShadersStore[name] = shader;
  43. export { shader, name };