WIP: remove points, hull from Structure<>

This commit is contained in:
David Allemang
2023-02-12 10:10:25 -05:00
parent 844bf23b3b
commit accb70ad5f
3 changed files with 23 additions and 28 deletions

View File

@@ -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()) {
}
};

View File

@@ -115,8 +115,8 @@ void show_options(entt::registry &registry) {
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>(
registry.emplace<Slice>(
entity,
group,
tc::schlafli({5, 3, 3, 2}),
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
}
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);

View File

@@ -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;