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.

25 lines
533 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. attribute vec3 pos;
  2. attribute vec2 texcoord;
  3. attribute vec3 normal;
  4. uniform mat4 M;
  5. uniform mat4 P;
  6. uniform mat4 V;
  7. uniform mat4 NM;//Normal Matrix ʹ�����������ߵ�
  8. uniform mat4 U_LightProjection;
  9. uniform mat4 U_LightViewMatrix;
  10. varying vec3 V_Normal;
  11. varying vec3 V_WorldPos;
  12. varying vec4 V_LightSpaceFragPos;
  13. void main()
  14. {
  15. V_Normal = mat3(NM)*normal;
  16. vec4 worldPos = M * vec4(pos, 1.0);
  17. V_WorldPos = worldPos.xyz;
  18. V_LightSpaceFragPos = U_LightProjection * U_LightViewMatrix * worldPos;
  19. gl_Position=P*V*M*vec4(pos,1.0);
  20. }