mirror of
https://github.com/allemangD/toddcox-visualize.git
synced 2025-11-10 12:02:47 -05:00
template not a great idea yet; back to vectors but better implementation
This commit is contained in:
@@ -60,12 +60,6 @@ struct Drawable {
|
||||
}
|
||||
};
|
||||
|
||||
float factor(unsigned index, unsigned size) {
|
||||
auto num = (float) index;
|
||||
auto den = size > 1 ? (float) size - 1 : 1;
|
||||
return num / den;
|
||||
}
|
||||
|
||||
Matrices build(GLFWwindow *window, float st) {
|
||||
int width, height;
|
||||
glfwGetFramebufferSize(window, &width, &height);
|
||||
@@ -100,13 +94,6 @@ auto hull(const tc::Group &group, T all_sg_gens) {
|
||||
return parts;
|
||||
}
|
||||
|
||||
template<unsigned N>
|
||||
auto full_hull(const tc::Group &group) {
|
||||
auto g_gens = gens(group);
|
||||
const Combos<int> &combos = Combos(g_gens, N - 1);
|
||||
return hull<N, Combos<int>>(group, combos);
|
||||
}
|
||||
|
||||
class Shaders {
|
||||
public:
|
||||
cgl::pgm::vert defer = cgl::pgm::vert::file(
|
||||
@@ -168,16 +155,15 @@ void run(GLFWwindow *window) {
|
||||
|
||||
auto group = tc::schlafli({5, 3, 3, 2});
|
||||
|
||||
// auto wire_data = full_hull<2>(group);
|
||||
|
||||
// slice_parts.erase(slice_parts.end() - 1, slice_parts.end());
|
||||
auto slice_faces = hull<4>(group, (std::vector<std::vector<int>>) {
|
||||
{0, 1, 2},
|
||||
});
|
||||
|
||||
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
|
||||
std::default_random_engine rand(seed);
|
||||
std::shuffle(slice_faces.begin(), slice_faces.end(), rand);
|
||||
slice_faces.erase(slice_faces.begin(), slice_faces.begin() + slice_faces.size() / 2);
|
||||
|
||||
auto slice_face_data = merge<4>(slice_faces);
|
||||
auto slice_edges = hull<4>(group, (std::vector<std::vector<int>>) {
|
||||
{0, 1, 3},
|
||||
@@ -190,9 +176,6 @@ void run(GLFWwindow *window) {
|
||||
});
|
||||
auto slice_edge_data = merge<4>(slice_edges);
|
||||
|
||||
// Drawable<2> wires(GL_LINES);
|
||||
// wires.ibo.put(wire_data);
|
||||
|
||||
Drawable<4> edges(GL_POINTS);
|
||||
edges.ibo.put(slice_edge_data);
|
||||
edges.vao.ipointer(0, edges.ibo, 4, GL_UNSIGNED_INT);
|
||||
@@ -230,11 +213,6 @@ void run(GLFWwindow *window) {
|
||||
faces.draw_deferred();
|
||||
});
|
||||
|
||||
// proj_pipe.bound([&]() {
|
||||
// glProgramUniform4f(sh.solid, 2, 0.3, 0.3, 0.3, 0.4);
|
||||
// wires.draw_direct();
|
||||
// });
|
||||
|
||||
glfwSwapInterval(2);
|
||||
glfwSwapBuffers(window);
|
||||
|
||||
@@ -243,7 +221,6 @@ void run(GLFWwindow *window) {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
//region init window
|
||||
if (!glfwInit()) {
|
||||
std::cerr << "Failed to initialize GLFW" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
@@ -265,7 +242,6 @@ int main(int argc, char *argv[]) {
|
||||
glfwSwapInterval(1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glfwSwapBuffers(window);
|
||||
//endregion
|
||||
|
||||
std::cout << utilInfo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user