Prepass.vert 755 B

12345678910111213141516171819202122232425262728293031
  1. #include "Uniforms.vert"
  2. #include "Transform.vert"
  3. #ifdef HWDEPTH
  4. varying vec2 vTexCoord;
  5. #else
  6. varying vec3 vTexCoord;
  7. #endif
  8. varying vec3 vNormal;
  9. #ifdef NORMALMAP
  10. varying vec3 vTangent;
  11. varying vec3 vBitangent;
  12. #endif
  13. void main()
  14. {
  15. mat4 modelMatrix = iModelMatrix;
  16. vec3 worldPos = GetWorldPos(modelMatrix);
  17. gl_Position = GetClipPos(worldPos);
  18. #ifdef HWDEPTH
  19. vTexCoord = GetTexCoord(iTexCoord);
  20. #else
  21. vTexCoord = vec3(GetTexCoord(iTexCoord), GetDepth(gl_Position));
  22. #endif
  23. vNormal = GetWorldNormal(modelMatrix);
  24. #ifdef NORMALMAP
  25. vTangent = GetWorldTangent(modelMatrix);
  26. vBitangent = cross(vTangent, vNormal) * iTangent.w;
  27. #endif
  28. }