-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoutline_shader.vert
31 lines (26 loc) · 1.19 KB
/
outline_shader.vert
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
#version 330 core
// Andy Thai
// NOTE: Do NOT use any version older than 330! Bad things will happen!
// This is an example vertex shader. GLSL is very similar to C.
// You can define extra functions if needed, and the main() function is
// called when the vertex shader gets run.
// The vertex shader gets called once per vertex.
layout (location = 0) in vec3 position;
layout (location = 1) in vec3 normal;
// Uniform variables can be updated by fetching their location and passing values to that location
uniform mat4 projection;
//uniform mat4 modelview;
uniform mat4 model;
uniform mat4 view;
// Outputs of the vertex shader are the inputs of the same name of the fragment shader.
// The default output, gl_Position, should be assigned something. You can define as many
// extra outputs as you need.
//out vec3 Normal;
//out vec3 FragPos;
void main()
{
// OpenGL maintains the D matrix so you only need to multiply by P, V (aka C inverse), and M
gl_Position = projection * view * model * vec4(position.x + normal.x * 0.65f, position.y + normal.y * 0.65f, position.z + normal.z * 0.65f, 1.0);
//FragPos = vec3(model * vec4(position, 1.0f));
//Normal = mat3(transpose(inverse(model))) * normal;
}