mirror of
https://github.com/allemangD/toddcox-visualize.git
synced 2025-11-10 12:02:47 -05:00
WIP: remove points, hull from Structure<>
This commit is contained in:
@@ -47,25 +47,18 @@ namespace vis {
|
|||||||
tc::Group group;
|
tc::Group group;
|
||||||
VectorRf root;
|
VectorRf root;
|
||||||
|
|
||||||
Points points;
|
std::vector<typename Hull<Grade>::Tiling> tilings{};
|
||||||
Hull<Grade> hull;
|
std::vector<char> enabled{};
|
||||||
|
std::vector<Eigen::Vector3f> colors{};
|
||||||
std::vector<char> enabled;
|
|
||||||
std::vector<Eigen::Vector3f> colors;
|
|
||||||
|
|
||||||
Affine transform = Affine::Identity();
|
Affine transform = Affine::Identity();
|
||||||
|
|
||||||
explicit Structure(
|
explicit Structure(
|
||||||
tc::Group group,
|
tc::Group group,
|
||||||
VectorRf root,
|
VectorRf root
|
||||||
Color color_ = Color::Ones()
|
|
||||||
) :
|
) :
|
||||||
group(group),
|
group(group),
|
||||||
root(root),
|
root(root),
|
||||||
points(group, root), // todo separate system
|
|
||||||
hull(group), // todo separate system
|
|
||||||
enabled(hull.tilings.size(), true),
|
|
||||||
colors(hull.tilings.size(), color_),
|
|
||||||
transform(Affine::Identity()) {
|
transform(Affine::Identity()) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ void show_options(entt::registry ®istry) {
|
|||||||
for (auto [entity, structure]: view.each()) {
|
for (auto [entity, structure]: view.each()) {
|
||||||
ImGui::Begin("Structure View Options");
|
ImGui::Begin("Structure View Options");
|
||||||
|
|
||||||
for (int i = 0; i < structure.hull.tilings.size(); ++i) {
|
for (int i = 0; i < structure.tilings.size(); ++i) {
|
||||||
std::string label = fmt::format("{}", structure.hull.subgroups[i]);
|
std::string label = fmt::format("{}", i);
|
||||||
|
|
||||||
ImGui::Checkbox(label.c_str(), (bool*) (&(structure.enabled[i])));
|
ImGui::Checkbox(label.c_str(), (bool*) (&(structure.enabled[i])));
|
||||||
ImGui::ColorEdit3(label.c_str(), structure.colors[i].data(), ImGuiColorEditFlags_NoLabel);
|
ImGui::ColorEdit3(label.c_str(), structure.colors[i].data(), ImGuiColorEditFlags_NoLabel);
|
||||||
@@ -156,20 +156,15 @@ int run(GLFWwindow* window, ImGuiContext* ctx) {
|
|||||||
state.dimension = 4;
|
state.dimension = 4;
|
||||||
|
|
||||||
auto entity = registry.create();
|
auto entity = registry.create();
|
||||||
{
|
registry.emplace<Slice>(
|
||||||
tc::Group group = tc::schlafli({5, 3, 3, 2});
|
|
||||||
|
|
||||||
auto &structure = registry.emplace<Slice>(
|
|
||||||
entity,
|
entity,
|
||||||
group,
|
tc::schlafli({5, 3, 3, 2}),
|
||||||
vec5{0.80, 0.09, 0.09, 0.09, 0.09}
|
vec5{0.80, 0.09, 0.09, 0.09, 0.09}
|
||||||
);
|
);
|
||||||
registry.emplace<vis::VBOs<Slice>>(entity);
|
registry.emplace<vis::VBOs<Slice>>(entity);
|
||||||
|
|
||||||
structure.enabled[0] = false; // disable {0,1,2} cells
|
|
||||||
}
|
|
||||||
|
|
||||||
vis::upload_structure<Slice>(registry);
|
vis::upload_structure<Slice>(registry);
|
||||||
|
registry.get<Slice>(entity).enabled[0] = false; // disable {0,1,2} cells
|
||||||
|
|
||||||
auto ubo = cgl::Buffer<Matrices>();
|
auto ubo = cgl::Buffer<Matrices>();
|
||||||
glBindBufferBase(GL_UNIFORM_BUFFER, 1, ubo);
|
glBindBufferBase(GL_UNIFORM_BUFFER, 1, ubo);
|
||||||
|
|||||||
@@ -24,8 +24,15 @@ namespace vis {
|
|||||||
auto view = registry.view<Str, VBOs<Str>>();
|
auto view = registry.view<Str, VBOs<Str>>();
|
||||||
|
|
||||||
for (auto [entity, structure, vbos]: view.each()) {
|
for (auto [entity, structure, vbos]: view.each()) {
|
||||||
auto vertices = structure.points.verts.colwise();
|
Points points(structure.group, structure.root);
|
||||||
auto indices = structure.hull.inds.colwise();
|
Hull<Str::Grade> hull(structure.group);
|
||||||
|
|
||||||
|
auto vertices = points.verts.colwise();
|
||||||
|
auto indices = hull.inds.colwise();
|
||||||
|
|
||||||
|
structure.tilings = hull.tilings;
|
||||||
|
structure.enabled.resize(hull.tilings.size(), true);
|
||||||
|
structure.colors.resize(hull.tilings.size(), vec3::Ones());
|
||||||
|
|
||||||
vbos.vertices.put(vertices.begin(), vertices.end());
|
vbos.vertices.put(vertices.begin(), vertices.end());
|
||||||
vbos.indices.put(indices.begin(), indices.end());
|
vbos.indices.put(indices.begin(), indices.end());
|
||||||
@@ -53,7 +60,7 @@ namespace vis {
|
|||||||
auto view = registry.view<Str, VBOs<Str>>();
|
auto view = registry.view<Str, VBOs<Str>>();
|
||||||
|
|
||||||
for (auto [entity, structure, vbos]: view.each()) {
|
for (auto [entity, structure, vbos]: view.each()) {
|
||||||
const auto &tilings = structure.hull.tilings;
|
const auto &tilings = structure.tilings;
|
||||||
|
|
||||||
std::vector<typename VBOs<Str>::Command> commands;
|
std::vector<typename VBOs<Str>::Command> commands;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user