diff --git a/.idea/misc.xml b/.idea/misc.xml
index 2edf9aa..e8c6c13 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -12,4 +12,7 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/vendor/toddcox b/vendor/toddcox
index 7cfb0a3..06c1540 160000
--- a/vendor/toddcox
+++ b/vendor/toddcox
@@ -1 +1 @@
-Subproject commit 7cfb0a380311cdd7c050407b3642bbb8a07f417d
+Subproject commit 06c154057fdc27186ec4d1c6c22fd6f73adba468
diff --git a/vis/include/util.hpp b/vis/include/util.hpp
index f038e0c..0019c21 100644
--- a/vis/include/util.hpp
+++ b/vis/include/util.hpp
@@ -11,18 +11,21 @@
class gl_error : public std::domain_error {
public:
explicit gl_error(const std::string &arg) : domain_error(arg) {}
+
explicit gl_error(const char *string) : domain_error(string) {}
};
class shader_error : public gl_error {
public:
explicit shader_error(const std::string &arg) : gl_error(arg) {}
+
explicit shader_error(const char *string) : gl_error(string) {}
};
class program_error : public gl_error {
public:
explicit program_error(const std::string &arg) : gl_error(arg) {}
+
explicit program_error(const char *string) : gl_error(string) {}
};
@@ -102,4 +105,4 @@ GLuint utilLinkProgram(const std::vector &shaders) {
if (success)return program;
throw program_error(utilProgramInfoLog(program));
-}
\ No newline at end of file
+}
diff --git a/vis/shaders/stereo.vs.glsl b/vis/shaders/stereo.vs.glsl
index c67588e..3829473 100644
--- a/vis/shaders/stereo.vs.glsl
+++ b/vis/shaders/stereo.vs.glsl
@@ -11,5 +11,5 @@ void main() {
int i = gl_VertexID;
vpos = view * pos;
gl_Position = proj * vec4(vpos.xyz / (1 - vpos.w), 1);
- gl_PointSize = 5;
+ gl_PointSize = 5 * smoothstep(-2, 2, gl_Position.z);
}
diff --git a/vis/src/main.cpp b/vis/src/main.cpp
index aa2fbb7..76418dc 100644
--- a/vis/src/main.cpp
+++ b/vis/src/main.cpp
@@ -17,6 +17,27 @@ __attribute__((unused)) __declspec(dllexport) int NvOptimusEnablement = 0x000000
}
#endif
+std::vector edge_inds(const tc::Group &group, const tc::Cosets &map, const int gen) {
+ const tc::SubGroup &eg = group.subgroup({gen});
+ const tc::Cosets &root = eg.solve({});
+ size_t N = root.size();
+
+ auto edges = root.path.walk(0, eg.gen_map, [map](int a, int gen) {
+ return map.get(a, gen);
+ });
+ const tc::Cosets &tile = group.solve({gen});
+
+ edges.resize(N * tile.size());
+ for (size_t i = 0; i < tile.size(); ++i) {
+ auto act = tile.path.get(i);
+ for (size_t j = 0; j < N; ++j) {
+ edges[i * N + j] = map.get(edges[act.from_idx * N + j], act.gen);
+ }
+ }
+
+ return edges;
+}
+
int main(int argc, char *argv[]) {
//region init window
@@ -47,8 +68,10 @@ int main(int argc, char *argv[]) {
GLuint pgm;
try {
- GLuint vs = utilCompileFiles(GL_VERTEX_SHADER, {"shaders/ortho.vs.glsl"});
- GLuint fs = utilCompileFiles(GL_FRAGMENT_SHADER, {"shaders/w-axis-hue.fs.glsl"});
+// GLuint vs = utilCompileFiles(GL_VERTEX_SHADER, {"shaders/ortho.vs.glsl"});
+ GLuint vs = utilCompileFiles(GL_VERTEX_SHADER, {"shaders/stereo.vs.glsl"});
+ GLuint fs = utilCompileFiles(GL_FRAGMENT_SHADER, {"shaders/one-color.fs.glsl"});
+// GLuint fs = utilCompileFiles(GL_FRAGMENT_SHADER, {"shaders/w-axis-hue.fs.glsl"});
pgm = utilLinkProgram({vs, fs});
} catch (const gl_error &e) {
@@ -57,12 +80,13 @@ int main(int argc, char *argv[]) {
exit(EXIT_FAILURE);
}
- auto group = tc::schlafli({5, 3, 3});
+ auto group = tc::group::H(4);
auto res = group.solve();
auto mirrors = mirror(group);
auto corners = plane_intersections(mirrors);
- auto start = barycentric(corners, {1.00, 1.00, 1.00, 1.00});
+// auto start = barycentric(corners, {1.00f, 1.00f, 1.00f, 1.00f});
+ auto start = barycentric(corners, {0.05, 0.05, 1.00, 3.00});
auto points = res.path.walk(start, mirrors, reflect);
GLuint vbo;
@@ -73,6 +97,21 @@ int main(int argc, char *argv[]) {
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 4, GL_FLOAT, false, 0, nullptr);
+ std::vector edge_count;
+ std::vector edge_ibo;
+ for (int i = 0; i < group.ngens; ++i) {
+ const auto data = edge_inds(group, res, i);
+ edge_count.push_back(data.size());
+
+ GLuint ibo;
+ glGenBuffers(1, &ibo);
+ glBindBuffer(GL_ARRAY_BUFFER, ibo);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(int) * data.size(), &data[0], GL_STATIC_DRAW);
+ edge_ibo.push_back(ibo);
+ }
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
while (!glfwWindowShouldClose(window)) {
int width, height;
glfwGetFramebufferSize(window, &width, &height);
@@ -92,7 +131,7 @@ int main(int argc, char *argv[]) {
glm::mat4 proj = glm::ortho(-pwidth, pwidth, -pheight, pheight, -100.0f, 100.0f);
glUniformMatrix4fv(0, 1, false, glm::value_ptr(proj));
- auto t = (float) glfwGetTime() / 5;
+ auto t = (float) glfwGetTime() / 10;
auto view = glm::identity();
view *= utilRotate(0, 1, t * 0.7f);
view *= utilRotate(0, 2, t * 0.8f);
@@ -106,6 +145,15 @@ int main(int argc, char *argv[]) {
glUniform3f(2, 1.0f, 1.0f, 1.0f);
glDrawArrays(GL_POINTS, 0, points.size());
+ glUniform3f(2, 1.0f, 1.0f, 1.0f);
+ for (int i = 0; i < group.ngens; ++i) {
+ auto ibo = edge_ibo[i];
+ auto count = edge_count[i];
+
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
+ glDrawElements(GL_LINES, count, GL_UNSIGNED_INT, nullptr);
+ }
+
glfwSwapBuffers(window);
glfwPollEvents();