FIX:Fix some missing contours in height range cursor rendering

delete init_from api in GLModel
jira: none

Change-Id: Icd2522ff1dc156f074369fadeb51b9568945a4fc
(cherry picked from commit f1d27c1bf3419f449fdc6cb83dca1224ca7478be)
This commit is contained in:
zhou.xu 2025-02-25 09:03:41 +08:00 committed by lane.wei
parent 038946fb29
commit cbe5818382
3 changed files with 1 additions and 29 deletions

View File

@ -588,33 +588,6 @@ void GLModel::init_from(const indexed_triangle_set& its)
this->init_from(its, bounding_box(its));
}
void GLModel::init_from(const Polygons& polygons, float z)
{
auto append_polygon = [](const Polygon& polygon, float z, GUI::GLModel::InitializationData& data) {
if (!polygon.empty()) {
GUI::GLModel::InitializationData::Entity entity;
entity.type = GUI::GLModel::PrimitiveType::LineLoop;
// contour
entity.positions.reserve(polygon.size() + 1);
entity.indices.reserve(polygon.size() + 1);
unsigned int id = 0;
for (const Point& p : polygon) {
Vec3f position = unscale(p.x(), p.y(), 0.0).cast<float>();
position.z() = z;
entity.positions.emplace_back(position);
entity.indices.emplace_back(id++);
}
data.entities.emplace_back(entity);
}
};
InitializationData init_data;
for (const Polygon& polygon : polygons) {
append_polygon(polygon, z, init_data);
}
init_from(init_data);
}
bool GLModel::init_from_file(const std::string& filename)
{
if (!boost::filesystem::exists(filename))

View File

@ -179,7 +179,6 @@ namespace GUI {
void init_from(const InitializationData& data);
void init_from(const indexed_triangle_set& its, const BoundingBoxf3& bbox);
void init_from(const indexed_triangle_set& its);
void init_from(const Polygons& polygons, float z);
bool init_from_file(const std::string& filename);
void init_model_from_polygon(const Polygons &polygons, float z);
bool init_model_from_poly(const std::vector<Vec2f> &triangles, float z, bool generate_mesh = false);

View File

@ -548,7 +548,7 @@ void GLGizmoPainterBase::update_contours(int i, const TriangleMesh &vol_mesh, fl
}
}
}
m_cut_contours[i].contours.init_from(polys, static_cast<float>(cursor_z));
m_cut_contours[i].contours.init_model_from_polygon(polys, static_cast<float>(cursor_z));
m_cut_contours[i].contours.set_color(-1, {1.0f, 1.0f, 1.0f, 1.0f});
}
} else if (box.center() != m_cut_contours[i].position) {