Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <STRUCTURE>
- <LAYOUT>
- layout(location = 0) in $weightType l_jointweight;
- layout(location = 1) in $indextType l_jointindex;
- layout(location = 5) in vec3 l_position;
- layout(location = 6) in vec3 l_normal;
- <UNIFORM>
- uniform int NBJOINT;
- uniform mat4 JOINTS[$nbjoint];
- <VARIABLE>
- out vec3 vPosition;
- out vec3 vNormal;
- <FUNCTION>
- <OPERATION>
- vPosition = vec3(0,0,0);
- vNormal = vec3(0,0,0);
- for(int i=0;i<NBJOINT;i++){
- mat4 jointMatrix = JOINTS[l_jointindex[i]];
- vec3 pos = vec3(jointMatrix * vec4(l_position,1)) * l_jointweight[i];
- vPosition = vPosition + pos;
- vec3 nor = vec3(jointMatrix * vec4(l_normal,0)) * l_jointweight[i];
- vNormal = vNormal + nor;
- }
- mat4 mvp = P*V*M;
- gl_Position = mvp * vec4(vPosition,1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement