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