rotating tesseract

This commit is contained in:
2018-12-20 20:23:08 -05:00
parent 1ee97c5154
commit 1e842b8dda
4 changed files with 80 additions and 34 deletions

View File

@@ -13,7 +13,7 @@ vec3 hsv2rgb(vec3 c) {
void main() {
float h = pos.w / 3 + .6;
float s = 1;
float v = smoothstep(1, -1, pos.z);
float v = smoothstep(2, -2, pos.z);
fcolor = vec4(hsv2rgb(vec3(h, s, v)), 1);
}

19
simplex/shaders/wire.frag Normal file
View File

@@ -0,0 +1,19 @@
#version 440 core
out vec4 fcolor;
in vec4 pos;
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main() {
float h = pos.w / 3 + .6;
float s = 1;
float v = smoothstep(2, -2, pos.z);
fcolor = vec4(hsv2rgb(vec3(h, s, v)), 1);
}