v4k-git-backup/engine/art/shaders/vs_332_32.glsl

34 lines
803 B
Plaintext
Raw Normal View History

2023-08-10 21:53:51 +00:00
uniform mat4 u_mvp;
2023-09-10 14:46:07 +00:00
2023-08-10 21:53:51 +00:00
in vec3 att_position;
in vec3 att_normal;
in vec2 att_texcoord;
in vec4 att_color;
out vec4 v_color;
out vec3 v_normal;
out vec3 v_normal_ws;
out vec2 v_texcoord;
2023-09-10 14:46:07 +00:00
2023-08-10 22:46:04 +00:00
// shadow
2023-08-10 21:53:51 +00:00
uniform mat4 model, view, proj;
2023-08-10 22:46:04 +00:00
uniform mat4 cameraToShadowProjector; // !VSMCUBE
2023-08-10 21:53:51 +00:00
out vec4 vneye;
out vec4 vpeye;
2023-08-10 22:46:04 +00:00
out vec4 sc; // !VSMCUBE
2023-08-10 21:53:51 +00:00
void do_shadow() {
vneye = view * model * vec4(att_normal, 0.0f);
vpeye = view * model * vec4(att_position, 1.0);
sc = cameraToShadowProjector * model * vec4(att_position, 1.0f);
}
2023-09-10 14:46:07 +00:00
2023-08-10 21:53:51 +00:00
void main() {
gl_Position = u_mvp * vec4(att_position, 1.0);
v_normal = normalize(att_normal);
2023-08-10 22:46:04 +00:00
v_normal_ws = normalize(vec3(model * vec4(att_normal, 0.))); // normal world/model space
2023-08-10 21:53:51 +00:00
v_texcoord = att_texcoord;
v_color = att_color;
do_shadow();
}