mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 22:24:01 -06:00
Tech ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL - Replace GLIndexedVertexArray with GLModel: GLVolume geometry + removed class GLIndexedVertexArray from codebase
(cherry picked from commit prusa3d/PrusaSlicer@1eac357739)
This commit is contained in:
parent
d85bbcba50
commit
d09dc36ff1
16 changed files with 765 additions and 1130 deletions
|
@ -32,9 +32,9 @@ std::string GLGizmoFaceDetector::on_get_name() const
|
|||
|
||||
void GLGizmoFaceDetector::on_render()
|
||||
{
|
||||
if (m_iva.has_VBOs()) {
|
||||
::glColor4f(0.f, 0.f, 1.f, 0.4f);
|
||||
m_iva.render();
|
||||
if (model.is_initialized()) {
|
||||
model.set_color({0.f, 0.f, 1.f, 0.4f});
|
||||
model.render();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ void GLGizmoFaceDetector::on_render_input_window(float x, float y, float bottom_
|
|||
void GLGizmoFaceDetector::on_set_state()
|
||||
{
|
||||
if (get_state() == On) {
|
||||
m_iva.release_geometry();
|
||||
model.reset();
|
||||
display_exterior_face();
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,10 @@ void GLGizmoFaceDetector::perform_recognition(const Selection& selection)
|
|||
void GLGizmoFaceDetector::display_exterior_face()
|
||||
{
|
||||
int cnt = 0;
|
||||
m_iva.release_geometry();
|
||||
model.reset();
|
||||
|
||||
GLModel::Geometry init_data;
|
||||
init_data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::EIndexType::UINT };
|
||||
|
||||
const ModelObjectPtrs& objects = wxGetApp().model().objects;
|
||||
for (ModelObject* mo : objects) {
|
||||
|
@ -110,19 +113,15 @@ void GLGizmoFaceDetector::display_exterior_face()
|
|||
continue;
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
m_iva.push_geometry(double(mv_its.vertices[facet_vert_idxs[i]](0)),
|
||||
double(mv_its.vertices[facet_vert_idxs[i]](1)),
|
||||
double(mv_its.vertices[facet_vert_idxs[i]](2)),
|
||||
0., 0., 1.);
|
||||
init_data.add_vertex((Vec3f) mv_its.vertices[facet_vert_idxs[i]].cast<float>(), Vec3f{0.0f, 0.0f, 1.0f});
|
||||
}
|
||||
|
||||
m_iva.push_triangle(cnt, cnt + 1, cnt + 2);
|
||||
init_data.add_uint_triangle(cnt, cnt + 1, cnt + 2);
|
||||
cnt += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_iva.finalize_geometry(true);
|
||||
model.init_from(std::move(init_data));
|
||||
}
|
||||
|
||||
CommonGizmosDataID GLGizmoFaceDetector::on_get_requirements() const
|
||||
|
|
|
@ -28,7 +28,7 @@ private:
|
|||
void perform_recognition(const Selection& selection);
|
||||
void display_exterior_face();
|
||||
|
||||
GLIndexedVertexArray m_iva;
|
||||
GUI::GLModel model;
|
||||
double m_sample_interval = {0.5};
|
||||
};
|
||||
|
||||
|
|
|
@ -894,13 +894,16 @@ void GLGizmoFdmSupports::run_thread()
|
|||
print->set_status(100, L("Support Generated"));
|
||||
goto _finished;
|
||||
}
|
||||
GLModel::Geometry init_data;
|
||||
init_data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::EIndexType::UINT };
|
||||
for (const SupportLayer *support_layer : m_print_instance.print_object->support_layers())
|
||||
{
|
||||
for (const ExtrusionEntity *extrusion_entity : support_layer->support_fills.entities)
|
||||
{
|
||||
_3DScene::extrusionentity_to_verts(extrusion_entity, float(support_layer->print_z), m_print_instance.shift, *m_support_volume);
|
||||
_3DScene::extrusionentity_to_verts(extrusion_entity, float(support_layer->print_z), m_print_instance.shift, init_data);
|
||||
}
|
||||
}
|
||||
m_support_volume->model.init_from(std::move(init_data));
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished extrusionentity_to_verts, update status to 100%";
|
||||
print->set_status(100, L("Support Generated"));
|
||||
|
||||
|
@ -926,7 +929,6 @@ _finished:
|
|||
void GLGizmoFdmSupports::generate_support_volume()
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ",before finalize_geometry";
|
||||
m_support_volume->indexed_vertex_array.finalize_geometry(m_parent.is_initialized());
|
||||
|
||||
std::unique_lock<std::mutex> lck(m_mutex);
|
||||
m_volume_ready = true;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "slic3r/GUI/Gizmos/GLGizmoFdmSupports.hpp"
|
||||
// BBS
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoAdvancedCut.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoFaceDetector.hpp"
|
||||
//#include "slic3r/GUI/Gizmos/GLGizmoFaceDetector.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoHollow.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoSeam.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue