working intersection - rotating simplex

This commit is contained in:
2018-12-20 11:26:18 -05:00
parent 78195ef8ec
commit 1ee97c5154
6 changed files with 161 additions and 57 deletions

37
simplex/shaders/wire.geom Normal file
View File

@@ -0,0 +1,37 @@
#version 440 core
layout(points) in;
layout(line_strip, max_vertices=48) out;
layout(std430, binding=1) buffer Positions {
vec4 verts[];
};
layout(std140, binding=1) uniform Matrices {
mat4 model;
mat4 view;
mat4 proj;
};
in ivec4 inds[];
out vec4 pos;
void emit(vec4 v) {
pos = v;
gl_Position = proj * view * vec4(v.xyz, -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) {
for(int j = i + 1; j < 4; ++j) {
emit(pos4[i]);
emit(pos4[j]);
EndPrimitive();
}
}
}