forked from cricklet/Hatched
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgbuffer.vert
More file actions
27 lines (20 loc) · 686 Bytes
/
Copy pathgbuffer.vert
File metadata and controls
27 lines (20 loc) · 686 Bytes
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
#version 150
in vec3 inVertPosition;
in vec3 inVertNorm;
in vec2 inVertUV;
// we want to output the world-space normal and position
out vec3 outVertPos;
out vec3 outVertNorm;
out vec2 outVertUV;
out vec3 outVertViewPos;
uniform mat4 unifModelTrans;
uniform mat4 unifViewTrans;
uniform mat4 unifProjTrans;
void main () {
gl_Position = unifProjTrans * unifViewTrans * unifModelTrans * vec4(inVertPosition, 1.0);
mat4 trans = unifModelTrans;
outVertNorm = vec3(transpose(inverse(trans)) * vec4(inVertNorm, 0));
outVertPos = vec3(trans * vec4(inVertPosition, 1.0));
outVertUV = inVertUV;
outVertViewPos = vec3(unifViewTrans * unifModelTrans * vec4(inVertPosition, 1));
}