2022-04-17 08:02:16 +08:00
|
|
|
precision mediump float;
|
|
|
|
|
2022-02-12 09:54:31 +08:00
|
|
|
uniform vec3 u_lightWorldPos;
|
|
|
|
uniform mat4 u_worldViewProjection;
|
|
|
|
uniform mat4 u_worldInverseTranspose;
|
|
|
|
|
2022-03-08 02:45:06 +08:00
|
|
|
attribute vec3 position;
|
2022-02-12 09:54:31 +08:00
|
|
|
attribute vec2 texcoord;
|
|
|
|
attribute vec3 normal;
|
|
|
|
|
|
|
|
varying float v_lighting;
|
|
|
|
varying vec2 v_texcoord;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
v_texcoord = texcoord;
|
|
|
|
|
|
|
|
float lighting = abs(dot(normal, normalize(u_lightWorldPos)));
|
|
|
|
lighting = (clamp(lighting, 0.0, 1.0) * 0.66) + 0.33;
|
|
|
|
v_lighting = lighting;
|
|
|
|
|
2022-03-13 08:36:51 +08:00
|
|
|
gl_Position = u_worldViewProjection * vec4(position, 1.0);
|
2022-02-12 09:54:31 +08:00
|
|
|
}
|