some meshgen and map rendering updates
[voxelands-alt.git] / data / shaders / map_vertex.glsl
blobfd19285d959d26bef02e099e464d876231fb5695
1 #version 330 core
3 in vec3 position;
4 in vec3 normals;
5 in vec2 texcoords;
7 out vec2 uv;
8 out vec3 normal;
9 out vec3 to_cam;
10 out vec3 light0_to;
12 uniform mat4 transformationMatrix;
13 uniform mat4 projectionMatrix;
14 uniform mat4 viewMatrix;
16 uniform vec4 plane;
18 vec3 light0_pos = vec3(-5.0,500.0,500.0);
20 void main(void)
22         vec4 worldpos = transformationMatrix*vec4(position, 1.0);
24         gl_ClipDistance[0] = dot(worldpos,plane);
26         gl_Position = projectionMatrix*viewMatrix*worldpos;
28         uv = texcoords;
29         normal = (transformationMatrix*vec4(normals,0.0)).xyz;
31         light0_to = light0_pos - worldpos.xyz;
33         to_cam = (inverse(viewMatrix)*vec4(0.0,0.0,0.0,1.0)).xyz - worldpos.xyz;