Guest User

Untitled

a guest
Jan 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. //
  2. // skinning.vert: uses two matrices to create a "blended" vertex
  3. //
  4. // author: Philip Rideout
  5. //
  6. // Copyright (c) 2005-2006: 3Dlabs, Inc.
  7. //
  8.  
  9. uniform vec3 LightPosition;
  10. uniform vec3 SurfaceColor;
  11. varying vec4 Color;
  12. uniform int index0;
  13. uniform int index1;
  14. uniform mat4 transforms[13];
  15. attribute float weight;
  16.  
  17. void main(void)
  18. {
  19. mat4 transform = transforms[index0] * weight + transforms[index1] * (1.0 - weight);
  20. vec3 normal = normalize(gl_NormalMatrix * gl_Normal);;
  21. vec3 position = vec3(gl_ModelViewMatrix * gl_Vertex);
  22. vec3 lightVec = normalize(LightPosition - position);
  23. float diffuse = max(dot(lightVec, normal), 0.0);
  24.  
  25. if (diffuse < 0.125)
  26. diffuse = 0.125;
  27.  
  28. Color = vec4(SurfaceColor * diffuse, 1.0);
  29. gl_Position = transform * gl_Vertex;
  30. }
Add Comment
Please, Sign In to add comment