Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1.  
  2. <STRUCTURE>
  3.  
  4. <LAYOUT>
  5. layout(location = 0) in $weightType l_jointweight;
  6. layout(location = 1) in $indextType l_jointindex;
  7. layout(location = 5) in vec3 l_position;
  8. layout(location = 6) in vec3 l_normal;
  9.  
  10. <UNIFORM>
  11. uniform int NBJOINT;
  12. uniform mat4 JOINTS[$nbjoint];
  13.  
  14. <VARIABLE>
  15. out vec3 vPosition;
  16. out vec3 vNormal;
  17.  
  18. <FUNCTION>
  19.  
  20. <OPERATION>
  21. vPosition = vec3(0,0,0);
  22. vNormal   = vec3(0,0,0);
  23.  
  24. for(int i=0;i<NBJOINT;i++){
  25.     mat4 jointMatrix = JOINTS[l_jointindex[i]];
  26.     vec3 pos = vec3(jointMatrix * vec4(l_position,1)) * l_jointweight[i];
  27.     vPosition = vPosition + pos;
  28.     vec3 nor = vec3(jointMatrix * vec4(l_normal,0)) * l_jointweight[i];
  29.     vNormal = vNormal + nor;
  30. }
  31.  
  32. mat4 mvp = P*V*M;
  33. gl_Position = mvp * vec4(vPosition,1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement