summaryrefslogtreecommitdiff
path: root/data/shaders/phong-vert.glsl
blob: f7fd363722a2c746135889979433c1147ba38144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// -*- mode: c -*-

#ifdef GLSL330
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 texcoord;
layout (location = 2) in vec3 normal;
#elif defined(GLSL130)
in vec3 position;
in vec2 texcoord;
in vec3 normal;
#elif defined(GLSL120)
attribute vec3 position;
attribute vec2 texcoord;
attribute vec3 normal;
#endif

#ifdef GLSL120
varying vec3 fragWorldPos;
varying vec3 fragNorm;
varying vec2 fragTex;
#else
out vec3 fragWorldPos;
out vec3 fragNorm;
out vec2 fragTex;
#endif

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main() {
  fragWorldPos = vec3(model * vec4(position, 1.0));
  fragNorm = mat3(model) * normal;
  fragTex = texcoord;
  gl_Position = projection * view * vec4(fragWorldPos, 1.0);
}