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.
 
 
 

26 lines
533 B

attribute vec3 pos;
attribute vec2 texcoord;
attribute vec3 normal;
uniform mat4 M;
uniform mat4 P;
uniform mat4 V;
uniform mat4 NM;//Normal Matrix ʹÓÃÀ´ÐÞÕý·¨ÏßµÄ
uniform mat4 U_LightProjection;
uniform mat4 U_LightViewMatrix;
varying vec3 V_Normal;
varying vec3 V_WorldPos;
varying vec4 V_LightSpaceFragPos;
void main()
{
V_Normal = mat3(NM)*normal;
vec4 worldPos = M * vec4(pos, 1.0);
V_WorldPos = worldPos.xyz;
V_LightSpaceFragPos = U_LightProjection * U_LightViewMatrix * worldPos;
gl_Position=P*V*M*vec4(pos,1.0);
}