[C++] The IN55 project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
683B

  1. #version 150
  2. attribute vec3 Position;
  3. attribute vec3 Normal;
  4. attribute mat4 BoneTransform[4];
  5. attribute float Weights[4];
  6. varying vec3 Normal0;
  7. varying vec3 WorldPos0;
  8. const int MAX_BONES = 100;
  9. uniform mat4 gWVP;
  10. uniform mat4 gWorld;
  11. void main()
  12. {
  13. mat4 Transform = BoneTransform[0] * Weights[0];
  14. Transform += BoneTransform[1] * Weights[1];
  15. Transform += BoneTransform[2] * Weights[2];
  16. Transform += BoneTransform[3] * Weights[3];
  17. vec4 PosL = Transform * vec4(Position, 1.0);
  18. gl_Position = gWVP * PosL;
  19. vec4 NormalL = Transform * vec4(Normal, 0.0);
  20. Normal0 = (gWorld * NormalL).xyz;
  21. WorldPos0 = (gWorld * PosL).xyz;
  22. }