ObjToSchematic/shaders/block_vertex.vs

27 lines
656 B
Plaintext
Raw Normal View History

uniform mat4 u_worldViewProjection;
2021-07-23 23:24:09 +08:00
uniform sampler2D u_texture;
2021-07-24 21:54:35 +08:00
uniform float u_voxelSize;
2022-03-08 02:45:06 +08:00
uniform vec3 u_translate;
2022-03-08 02:45:06 +08:00
attribute vec3 position;
attribute vec3 normal;
attribute vec4 occlusion;
attribute vec2 texcoord;
attribute vec2 blockTexcoord;
2021-07-23 23:24:09 +08:00
varying float v_lighting;
varying vec4 v_occlusion;
varying vec2 v_texcoord;
varying vec2 v_blockTexcoord;
vec3 light = vec3(0.78, 0.98, 0.59);
void main() {
v_texcoord = texcoord;
v_occlusion = occlusion;
v_blockTexcoord = blockTexcoord;
2021-07-23 23:24:09 +08:00
v_lighting = dot(light, abs(normal));
2022-03-08 02:45:06 +08:00
gl_Position = u_worldViewProjection * vec4((position.xyz + vec3(0.5)) * u_voxelSize + u_translate, 1.0);
}