mirror of
https://github.com/allemangD/toddcox-visualize.git
synced 2025-11-10 12:02:47 -05:00
some results, but holey, not sure why
This commit is contained in:
@@ -173,11 +173,12 @@ struct Mesh {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
Mesh<N> recontext(
|
Mesh<N> recontext(
|
||||||
const tc::Group &context,
|
const tc::Group &context,
|
||||||
const std::vector<int> &g_gens,
|
const std::vector<int> &g_gens,
|
||||||
const std::vector<int> &sg_gens
|
const std::vector<int> &sg_gens
|
||||||
) {
|
) const {
|
||||||
const auto proper_sg_gens = recontext_gens(context, g_gens, sg_gens);
|
const auto proper_sg_gens = recontext_gens(context, g_gens, sg_gens);
|
||||||
// todo memo recontext
|
// todo memo recontext
|
||||||
const auto table = solve_g(context, g_gens);
|
const auto table = solve_g(context, g_gens);
|
||||||
@@ -200,11 +201,12 @@ struct Mesh {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
Mesh<N> tile(
|
Mesh<N> tile(
|
||||||
const tc::Group &context,
|
const tc::Group &context,
|
||||||
const std::vector<int> &g_gens,
|
const std::vector<int> &g_gens,
|
||||||
const std::vector<int> &sg_gens
|
const std::vector<int> &sg_gens
|
||||||
) {
|
) const {
|
||||||
Mesh<N> base = recontext(context, g_gens, sg_gens);
|
Mesh<N> base = recontext(context, g_gens, sg_gens);
|
||||||
const auto proper_sg_gens = recontext_gens(context, g_gens, sg_gens);
|
const auto proper_sg_gens = recontext_gens(context, g_gens, sg_gens);
|
||||||
|
|
||||||
@@ -220,7 +222,8 @@ struct Mesh {
|
|||||||
return merge(all);
|
return merge(all);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh<N + 1> fan(int root) {
|
[[nodiscard]]
|
||||||
|
Mesh<N + 1> fan(int root) const {
|
||||||
std::vector<Primitive<N + 1>> res(prims.size());
|
std::vector<Primitive<N + 1>> res(prims.size());
|
||||||
std::transform(prims.begin(), prims.end(), res.begin(),
|
std::transform(prims.begin(), prims.end(), res.begin(),
|
||||||
[root](const Primitive<N> &prim) {
|
[root](const Primitive<N> &prim) {
|
||||||
|
|||||||
@@ -122,10 +122,9 @@ int main(int argc, char *argv[]) {
|
|||||||
// };
|
// };
|
||||||
auto chosen = combos;
|
auto chosen = combos;
|
||||||
|
|
||||||
for (const auto& sg_gens : chosen) {
|
for (const auto &sg_gens : chosen) {
|
||||||
const Mesh<4> &base = triangulate<4>(group, sg_gens);
|
const auto s = triangulate<4>(group, sg_gens)
|
||||||
const auto &s = base;
|
.tile(group, g_gens, sg_gens);
|
||||||
// s = tile(context, g_gens, sg_gens, base);
|
|
||||||
|
|
||||||
GLuint vao = utilCreateVertexArray();
|
GLuint vao = utilCreateVertexArray();
|
||||||
GLuint ibo = utilCreateBuffer();
|
GLuint ibo = utilCreateBuffer();
|
||||||
@@ -133,7 +132,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
glBindVertexArray(vao);
|
glBindVertexArray(vao);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, ibo);
|
glBindBuffer(GL_ARRAY_BUFFER, ibo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(Primitive<4>) * count, &s.prims[0], GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(Primitive<4>) * s.size(), &s.prims[0], GL_STATIC_DRAW);
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
glVertexAttribIPointer(0, 4, GL_INT, 0, nullptr);
|
glVertexAttribIPointer(0, 4, GL_INT, 0, nullptr);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
@@ -181,7 +180,7 @@ int main(int argc, char *argv[]) {
|
|||||||
glBindProgramPipeline(pipe);
|
glBindProgramPipeline(pipe);
|
||||||
glBindVertexArray(vaos[i]);
|
glBindVertexArray(vaos[i]);
|
||||||
glProgramUniform3f(fs, 2, c.r, c.g, c.b);
|
glProgramUniform3f(fs, 2, c.r, c.g, c.b);
|
||||||
glDrawArrays(GL_POINTS, 0, counts[i] / 4);
|
glDrawArrays(GL_POINTS, 0, counts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindProgramPipeline(0);
|
glBindProgramPipeline(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user