mirror of
https://github.com/allemangD/toddcox-visualize.git
synced 2026-01-11 18:34:07 -05:00
embed shaders in binary
This commit is contained in:
4
vis/shaders/CMakeLists.txt
Normal file
4
vis/shaders/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
add_embed_library(shaders
|
||||
main-4d.vert.glsl
|
||||
main.vert.glsl
|
||||
main.frag.glsl)
|
||||
12
vis/shaders/main-4d.vert.glsl
Normal file
12
vis/shaders/main-4d.vert.glsl
Normal file
@@ -0,0 +1,12 @@
|
||||
#version 440
|
||||
|
||||
layout(location=1) uniform float time;
|
||||
layout(location=2) uniform mat4 proj;
|
||||
layout(location=3) uniform mat4 rot;
|
||||
|
||||
layout(location=0) in vec4 pos;
|
||||
|
||||
void main() {
|
||||
vec4 pos = rot * pos;
|
||||
gl_Position = proj * vec4(pos.xyz / (1 - pos.w), 1.0);
|
||||
}
|
||||
12
vis/shaders/main.frag.glsl
Normal file
12
vis/shaders/main.frag.glsl
Normal file
@@ -0,0 +1,12 @@
|
||||
#version 440
|
||||
|
||||
layout(location=0) uniform vec4 ucol;
|
||||
|
||||
layout(location=0) out vec4 col;
|
||||
|
||||
void main() {
|
||||
float d = 1.0 - gl_FragCoord.z;
|
||||
d = (d - 0.5) / 0.7 + 0.5;
|
||||
col = ucol;
|
||||
col.xyz *= d;
|
||||
}
|
||||
13
vis/shaders/main.vert.glsl
Normal file
13
vis/shaders/main.vert.glsl
Normal file
@@ -0,0 +1,13 @@
|
||||
#version 440
|
||||
|
||||
layout(location=1) uniform float time;
|
||||
layout(location=2) uniform mat4 proj;
|
||||
layout(location=3) uniform mat4 view;
|
||||
|
||||
layout(location=0) in vec4 pos;
|
||||
|
||||
void main() {
|
||||
vec3 pos3 = (view * pos).xyz;
|
||||
|
||||
gl_Position = proj * vec4(pos3, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user