cube and tesseract frame toggles, rotation experiments

This commit is contained in:
2018-12-20 22:46:58 -05:00
parent 5580899074
commit 0b87482276
4 changed files with 88 additions and 40 deletions

View File

@@ -9,6 +9,8 @@ layout(std430, binding=1) buffer Positions {
layout(std140, binding=1) uniform Matrices {
mat4 model;
vec4 offset;
mat4 view;
mat4 proj;
};
@@ -19,13 +21,13 @@ out vec4 pos;
void emit(vec4 v) {
pos = v;
gl_Position = proj * view * vec4(v.xyz, -v.w + 3);
gl_Position = proj * view * vec4(v.xyz, 1);
EmitVertex();
}
void main() {
vec4 pos4[4];
for(int i = 0; i < 4; ++i) pos4[i] = model * verts[inds[0][i]];
for(int i = 0; i < 4; ++i) pos4[i] = offset + model * verts[inds[0][i]];
int lo[4], L = 0;
int hi[4], H = 0;

View File

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

View File

@@ -9,6 +9,8 @@ layout(std430, binding=1) buffer Positions {
layout(std140, binding=1) uniform Matrices {
mat4 model;
vec4 offset;
mat4 view;
mat4 proj;
};
@@ -19,13 +21,13 @@ out vec4 pos;
void emit(vec4 v) {
pos = v;
gl_Position = proj * view * vec4(v.xyz, -v.w + 3);
gl_Position = proj * view * vec4(v.xyz, 1 - v.w / 2);
EmitVertex();
}
void main() {
vec4 pos4[4];
for(int i = 0; i < 4; ++i) pos4[i] = model * verts[inds[0][i]];
for(int i = 0; i < 4; ++i) pos4[i] = offset + model * verts[inds[0][i]];
for(int i = 0; i < 4; ++i) {
for(int j = i + 1; j < 4; ++j) {