some meshgen and map rendering updates
[voxelands-alt.git] / data / shaders / model_vertex.glsl
blob015b8cd3163f3b050a734c76d2d753c02ae2977e
1 #version 330 core
3 in vec3 position;
4 in vec3 normals;
5 in vec2 texcoords;
7 out vec2 uv;
8 out vec3 surfaceNormal;
10 out vec3 toLight;
11 out vec3 toCam;
13 uniform mat4 transformationMatrix;
14 uniform mat4 projectionMatrix;
15 uniform mat4 viewMatrix;
17 void main(void) {
19         vec3 lightpos = vec3(0.0,10.0,0.0);
20         vec4 worldpos = transformationMatrix*vec4(position, 1.0);
22         gl_Position = projectionMatrix*viewMatrix*worldpos;
24         uv = texcoords;
25         surfaceNormal = (transformationMatrix*vec4(normals,0.0)).xyz;
26         toLight = lightpos - worldpos.xyz;
28         toCam = (inverse(viewMatrix)*vec4(0.0,0.0,0.0,1.0)).xyz - worldpos.xyz;