MaterialVertexFunctions.glsl 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /// @file
  2. /// Generic vertex shader for material passes (both color and depth)
  3. #pragma anki include "shaders/Pack.glsl"
  4. //==============================================================================
  5. #define setVaryings1_DEFINED
  6. void setVaryings1(in mat4 modelViewProjectionMat)
  7. {
  8. #if defined(PASS_DEPTH) && LOD > 0
  9. // No tex coords for you
  10. #else
  11. vTexCoords = texCoords;
  12. #endif
  13. gl_Position = modelViewProjectionMat * vec4(position, 1.0);
  14. }
  15. //==============================================================================
  16. #define setVaryings2_DEFINED
  17. void setVaryings2(
  18. in mat4 modelViewProjectionMat,
  19. in mat3 normalMat)
  20. {
  21. #if defined(PASS_COLOR)
  22. vNormal = normalMat * normal;
  23. vTangent = normalMat * vec3(tangent);
  24. vTangentW = tangent.w;
  25. #endif
  26. setVaryings1(modelViewProjectionMat);
  27. }
  28. //==============================================================================
  29. #if defined(PASS_COLOR)
  30. #define setVertPosViewSpace_DEFINED
  31. void setVertPosViewSpace(in mat4 modelViewMat)
  32. {
  33. vVertPosViewSpace = vec3(modelViewMat * vec4(position, 1.0));
  34. }
  35. #endif
  36. //==============================================================================
  37. #if defined(PASS_COLOR)
  38. #define prepackSpecular_DEFINED
  39. void prepackSpecular(in vec2 specular)
  40. {
  41. vSpecularComponent = packSpecular(specular);
  42. }
  43. #endif