shadowMap.vertex.fx 797 B

123456789101112131415161718192021222324252627282930313233
  1. #ifdef GL_ES
  2. precision mediump float;
  3. #endif
  4. // Attribute
  5. attribute vec3 position;
  6. #ifdef BONES
  7. attribute vec4 matricesIndices;
  8. attribute vec4 matricesWeights;
  9. #endif
  10. // Uniform
  11. #ifdef BONES
  12. uniform mat4 world;
  13. uniform mat4 mBones[BonesPerMesh];
  14. uniform mat4 viewProjection;
  15. #else
  16. uniform mat4 worldViewProjection;
  17. #endif
  18. void main(void)
  19. {
  20. #ifdef BONES
  21. mat4 m0 = mBones[int(matricesIndices.x)] * matricesWeights.x;
  22. mat4 m1 = mBones[int(matricesIndices.y)] * matricesWeights.y;
  23. mat4 m2 = mBones[int(matricesIndices.z)] * matricesWeights.z;
  24. mat4 m3 = mBones[int(matricesIndices.w)] * matricesWeights.w;
  25. mat4 finalWorld = world * (m0 + m1 + m2 + m3);
  26. gl_Position = viewProjection * finalWorld * vec4(position, 1.0);
  27. #else
  28. gl_Position = worldViewProjection * vec4(position, 1.0);
  29. #endif
  30. }