2022-04-17 08:02:16 +08:00
|
|
|
precision mediump float;
|
|
|
|
|
2021-07-23 00:52:31 +08:00
|
|
|
uniform mat4 u_worldViewProjection;
|
2021-07-24 21:54:35 +08:00
|
|
|
uniform float u_voxelSize;
|
2022-03-13 08:36:51 +08:00
|
|
|
uniform vec3 u_gridOffset;
|
2022-10-02 06:41:58 +08:00
|
|
|
uniform bool u_ambientOcclusion;
|
2021-07-23 00:52:31 +08:00
|
|
|
|
2022-03-08 02:45:06 +08:00
|
|
|
attribute vec3 position;
|
2021-07-23 00:52:31 +08:00
|
|
|
attribute vec3 normal;
|
2022-06-12 07:47:30 +08:00
|
|
|
attribute vec4 colour;
|
2021-07-23 00:52:31 +08:00
|
|
|
attribute vec4 occlusion;
|
|
|
|
attribute vec2 texcoord;
|
|
|
|
|
2021-07-23 23:24:09 +08:00
|
|
|
varying float v_lighting;
|
2021-07-23 00:52:31 +08:00
|
|
|
varying vec4 v_occlusion;
|
|
|
|
varying vec2 v_texcoord;
|
2022-06-12 07:47:30 +08:00
|
|
|
varying vec4 v_colour;
|
2021-07-23 00:52:31 +08:00
|
|
|
|
|
|
|
vec3 light = vec3(0.78, 0.98, 0.59);
|
|
|
|
|
|
|
|
void main() {
|
2021-07-23 23:24:09 +08:00
|
|
|
v_lighting = dot(light, abs(normal));
|
2022-02-12 09:54:31 +08:00
|
|
|
v_occlusion = occlusion;
|
|
|
|
v_texcoord = texcoord;
|
|
|
|
v_colour = colour;
|
|
|
|
|
2022-03-13 08:36:51 +08:00
|
|
|
gl_Position = u_worldViewProjection * vec4((position.xyz + u_gridOffset) * u_voxelSize, 1.0);
|
2021-07-23 00:52:31 +08:00
|
|
|
}
|