mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 02:07:54 -06:00
Tech ENABLE_GLBEGIN_GLEND_REMOVAL - Another refactoring to simplify client code of GLModel::Geometry
(cherry picked from commit prusa3d/PrusaSlicer@fa1ff1c357)
This commit is contained in:
parent
8107057e17
commit
12dbbf2d1c
8 changed files with 26 additions and 26 deletions
|
@ -337,14 +337,13 @@ void GLGizmoFlatten::update_planes()
|
|||
// the vertices in order, so triangulation is trivial.
|
||||
for (auto& plane : m_planes) {
|
||||
GLModel::Geometry init_data;
|
||||
const GLModel::Geometry::EIndexType index_type = (plane.vertices.size() < 65536) ? GLModel::Geometry::EIndexType::USHORT : GLModel::Geometry::EIndexType::UINT;
|
||||
init_data.format = { GLModel::Geometry::EPrimitiveType::TriangleFan, GLModel::Geometry::EVertexLayout::P3N3, index_type };
|
||||
init_data.format = { GLModel::Geometry::EPrimitiveType::TriangleFan, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::index_type(plane.vertices.size()) };
|
||||
init_data.reserve_vertices(plane.vertices.size());
|
||||
init_data.reserve_indices(plane.vertices.size());
|
||||
// vertices + indices
|
||||
for (size_t i = 0; i < plane.vertices.size(); ++i) {
|
||||
init_data.add_vertex((Vec3f)plane.vertices[i].cast<float>(), (Vec3f)plane.normal.cast<float>());
|
||||
if (index_type == GLModel::Geometry::EIndexType::USHORT)
|
||||
if (init_data.format.index_type == GLModel::Geometry::EIndexType::USHORT)
|
||||
init_data.add_ushort_index((unsigned short)i);
|
||||
else
|
||||
init_data.add_uint_index((unsigned int)i);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue