separate edge, face, and cell frame. face frame not implemented.
This commit is contained in:
@@ -47,18 +47,18 @@ Mesh<4> tesseract() {
|
|||||||
rot_zw(T) * pair;
|
rot_zw(T) * pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh<4> tesseract_frame(float width) {
|
Mesh<4> tesseract_edge_frame(float width) {
|
||||||
Mesh<4> edge = tesseract() * glm::vec4(width, width, width, 1);
|
Mesh<4> edge = tesseract() * glm::vec4(width, width, width, 1);
|
||||||
auto o = glm::vec3(1 - width);
|
auto o = glm::vec3(1 - width);
|
||||||
|
|
||||||
Mesh<4> set = (edge + glm::vec4(+o.x, +o.y, +o.z, 0)) +
|
Mesh<4> set = (edge + glm::vec4(+o.x, +o.y, +o.z, 0)) +
|
||||||
(edge + glm::vec4(+o.x, +o.y, -o.z, 0)) +
|
(edge + glm::vec4(+o.x, +o.y, -o.z, 0)) +
|
||||||
(edge + glm::vec4(+o.x, -o.y, +o.z, 0)) +
|
(edge + glm::vec4(+o.x, -o.y, +o.z, 0)) +
|
||||||
(edge + glm::vec4(+o.x, -o.y, -o.z, 0)) +
|
(edge + glm::vec4(+o.x, -o.y, -o.z, 0)) +
|
||||||
(edge + glm::vec4(-o.x, +o.y, +o.z, 0)) +
|
(edge + glm::vec4(-o.x, +o.y, +o.z, 0)) +
|
||||||
(edge + glm::vec4(-o.x, +o.y, -o.z, 0)) +
|
(edge + glm::vec4(-o.x, +o.y, -o.z, 0)) +
|
||||||
(edge + glm::vec4(-o.x, -o.y, +o.z, 0)) +
|
(edge + glm::vec4(-o.x, -o.y, +o.z, 0)) +
|
||||||
(edge + glm::vec4(-o.x, -o.y, -o.z, 0));
|
(edge + glm::vec4(-o.x, -o.y, -o.z, 0));
|
||||||
|
|
||||||
return set +
|
return set +
|
||||||
rot_xw(T) * set +
|
rot_xw(T) * set +
|
||||||
@@ -66,4 +66,21 @@ Mesh<4> tesseract_frame(float width) {
|
|||||||
rot_zw(T) * set;
|
rot_zw(T) * set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mesh<4> tesseract_face_frame(float width) {
|
||||||
|
//todo - not even sure what this would mean, but it should be possible.
|
||||||
|
return Mesh<4>({}, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
Mesh<4> tesseract_cell_frame(float width) {
|
||||||
|
glm::vec4 off = glm::vec4(0, 0, 0, 1);
|
||||||
|
Mesh<4> cell = join(cube() * (1 - width), cube());
|
||||||
|
cell = cell + (cell - glm::vec4(0, 0, 0, width));
|
||||||
|
Mesh<4> pair = (cell + off) + (cell + off) * -1.f;
|
||||||
|
|
||||||
|
return pair +
|
||||||
|
rot_xw(T) * pair +
|
||||||
|
rot_yw(T) * pair +
|
||||||
|
rot_zw(T) * pair;
|
||||||
|
}
|
||||||
|
|
||||||
#endif //SIMPLEX_SOLIDS_H
|
#endif //SIMPLEX_SOLIDS_H
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class GLApp : public App {
|
|||||||
bool DRAW_WIRE = true;
|
bool DRAW_WIRE = true;
|
||||||
|
|
||||||
void init() override {
|
void init() override {
|
||||||
mesh = tesseract_frame(.125f);
|
mesh = tesseract_cell_frame(.125f);
|
||||||
|
|
||||||
//region Uniforms
|
//region Uniforms
|
||||||
matrices = {
|
matrices = {
|
||||||
@@ -114,7 +114,7 @@ class GLApp : public App {
|
|||||||
rotor(glm::vec4(1, 0, 0, 0), glm::vec4(0, 0, 1, 0), getTime() / 3) *
|
rotor(glm::vec4(1, 0, 0, 0), glm::vec4(0, 0, 1, 0), getTime() / 3) *
|
||||||
1.f;
|
1.f;
|
||||||
|
|
||||||
// matrices.offset = glm::vec4(0,0,0,sin(getTime() / 2));
|
matrices.offset = glm::vec4(0,0,0,sin(getTime() / 2) * 0.9f);
|
||||||
|
|
||||||
matrices.view = glm::lookAt(glm::vec3(0, 0, -4), glm::vec3(0, 0, 0), glm::vec3(0, 1, 0));
|
matrices.view = glm::lookAt(glm::vec3(0, 0, -4), glm::vec3(0, 0, 0), glm::vec3(0, 1, 0));
|
||||||
matrices.proj = glm::perspective(1.f, ratio, 0.1f, 20.0f);
|
matrices.proj = glm::perspective(1.f, ratio, 0.1f, 20.0f);
|
||||||
|
|||||||
Reference in New Issue
Block a user