Tech ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - Use vertex attributes and matrices in shaders.

Shader: mm_contour
This commit is contained in:
enricoturri1966 2022-03-08 10:57:43 +01:00
parent c17c4d2e9a
commit 66fa2b1e26
9 changed files with 129 additions and 10 deletions

View File

@ -0,0 +1,18 @@
#version 110
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
uniform vec4 uniform_color;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
const float EPSILON = 0.0001;
void main()
{
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
gl_FragColor = uniform_color;
// gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// Values inside depth buffer for fragments of the contour of a selected area are offset
// by small epsilon to solve z-fighting between painted triangles and contour lines.
gl_FragDepth = gl_FragCoord.z - EPSILON;
}

View File

@ -0,0 +1,16 @@
#version 110
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
attribute vec3 v_position;
uniform mat4 view_model_matrix;
uniform mat4 projection_matrix;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void main()
{
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
gl_Position = projection_matrix * view_model_matrix * vec4(v_position, 1.0);
// gl_Position = ftransform();
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
}

View File

@ -98,7 +98,11 @@ std::pair<bool, std::string> GLShadersManager::init()
// used to render variable layers heights in 3d editor // used to render variable layers heights in 3d editor
valid &= append_shader("variable_layer_height", { "variable_layer_height.vs", "variable_layer_height.fs" }); valid &= append_shader("variable_layer_height", { "variable_layer_height.vs", "variable_layer_height.fs" });
// used to render highlight contour around selected triangles inside the multi-material gizmo // used to render highlight contour around selected triangles inside the multi-material gizmo
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
valid &= append_shader("mm_contour_attr", { "mm_contour_attr.vs", "mm_contour_attr.fs" });
#else
valid &= append_shader("mm_contour", { "mm_contour.vs", "mm_contour.fs" }); valid &= append_shader("mm_contour", { "mm_contour.vs", "mm_contour.fs" });
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
// Used to render painted triangles inside the multi-material gizmo. Triangle normals are computed inside fragment shader. // Used to render painted triangles inside the multi-material gizmo. Triangle normals are computed inside fragment shader.
// For Apple's on Arm CPU computed triangle normals inside fragment shader using dFdx and dFdy has the opposite direction. // For Apple's on Arm CPU computed triangle normals inside fragment shader using dFdx and dFdy has the opposite direction.
// Because of this, objects had darker colors inside the multi-material gizmo. // Because of this, objects had darker colors inside the multi-material gizmo.

View File

@ -188,7 +188,7 @@ void GLGizmoMmuSegmentation::render_triangles(const Selection &selection) const
const Transform3d trafo_matrix = mo->instances[selection.get_instance_idx()]->get_transformation().get_matrix() * mv->get_matrix(); const Transform3d trafo_matrix = mo->instances[selection.get_instance_idx()]->get_transformation().get_matrix() * mv->get_matrix();
bool is_left_handed = trafo_matrix.matrix().determinant() < 0.; const bool is_left_handed = trafo_matrix.matrix().determinant() < 0.0;
if (is_left_handed) if (is_left_handed)
glsafe(::glFrontFace(GL_CW)); glsafe(::glFrontFace(GL_CW));
@ -197,7 +197,11 @@ void GLGizmoMmuSegmentation::render_triangles(const Selection &selection) const
shader->set_uniform("volume_world_matrix", trafo_matrix); shader->set_uniform("volume_world_matrix", trafo_matrix);
shader->set_uniform("volume_mirrored", is_left_handed); shader->set_uniform("volume_mirrored", is_left_handed);
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
m_triangle_selectors[mesh_id]->render(m_imgui, trafo_matrix);
#else
m_triangle_selectors[mesh_id]->render(m_imgui); m_triangle_selectors[mesh_id]->render(m_imgui);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glPopMatrix()); glsafe(::glPopMatrix());
if (is_left_handed) if (is_left_handed)
@ -568,7 +572,11 @@ ColorRGBA GLGizmoMmuSegmentation::get_cursor_sphere_right_button_color() const
return color; return color;
} }
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
void TriangleSelectorMmGui::render(ImGuiWrapper* imgui, const Transform3d& matrix)
#else
void TriangleSelectorMmGui::render(ImGuiWrapper *imgui) void TriangleSelectorMmGui::render(ImGuiWrapper *imgui)
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
{ {
if (m_update_render_data) if (m_update_render_data)
update_render_data(); update_render_data();
@ -589,7 +597,11 @@ void TriangleSelectorMmGui::render(ImGuiWrapper *imgui)
} }
#if ENABLE_GLBEGIN_GLEND_REMOVAL #if ENABLE_GLBEGIN_GLEND_REMOVAL
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
render_paint_contour(matrix);
#else
render_paint_contour(); render_paint_contour();
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#else #else
if (m_paint_contour.has_VBO()) { if (m_paint_contour.has_VBO()) {
ScopeGuard guard_mm_gouraud([shader]() { shader->start_using(); }); ScopeGuard guard_mm_gouraud([shader]() { shader->start_using(); });

View File

@ -66,9 +66,13 @@ public:
: TriangleSelectorGUI(mesh), m_colors(colors), m_default_volume_color(default_volume_color), m_gizmo_scene(2 * (colors.size() + 1)) {} : TriangleSelectorGUI(mesh), m_colors(colors), m_default_volume_color(default_volume_color), m_gizmo_scene(2 * (colors.size() + 1)) {}
~TriangleSelectorMmGui() override = default; ~TriangleSelectorMmGui() override = default;
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
void render(ImGuiWrapper* imgui, const Transform3d& matrix) override;
#else
// Render current selection. Transformation matrices are supposed // Render current selection. Transformation matrices are supposed
// to be already set. // to be already set.
void render(ImGuiWrapper* imgui) override; void render(ImGuiWrapper* imgui) override;
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
private: private:
void update_render_data(); void update_render_data();

View File

@ -126,11 +126,13 @@ void GLGizmoPainterBase::render_triangles(const Selection& selection) const
// wrong transformation matrix is used for "Clipping of view". // wrong transformation matrix is used for "Clipping of view".
shader->set_uniform("volume_world_matrix", trafo_matrix); shader->set_uniform("volume_world_matrix", trafo_matrix);
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
m_triangle_selectors[mesh_id]->render(m_imgui, trafo_matrix);
#else
m_triangle_selectors[mesh_id]->render(m_imgui); m_triangle_selectors[mesh_id]->render(m_imgui);
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glPopMatrix()); glsafe(::glPopMatrix());
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
if (is_left_handed) if (is_left_handed)
glsafe(::glFrontFace(GL_CCW)); glsafe(::glFrontFace(GL_CCW));
} }
@ -908,7 +910,11 @@ ColorRGBA TriangleSelectorGUI::get_seed_fill_color(const ColorRGBA& base_color)
return saturate(base_color, 0.75f); return saturate(base_color, 0.75f);
} }
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
void TriangleSelectorGUI::render(ImGuiWrapper* imgui, const Transform3d& matrix)
#else
void TriangleSelectorGUI::render(ImGuiWrapper* imgui) void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
{ {
static const ColorRGBA enforcers_color = { 0.47f, 0.47f, 1.0f, 1.0f }; static const ColorRGBA enforcers_color = { 0.47f, 0.47f, 1.0f, 1.0f };
static const ColorRGBA blockers_color = { 1.0f, 0.44f, 0.44f, 1.0f }; static const ColorRGBA blockers_color = { 1.0f, 0.44f, 0.44f, 1.0f };
@ -963,7 +969,11 @@ void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL #endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
#if ENABLE_GLBEGIN_GLEND_REMOVAL #if ENABLE_GLBEGIN_GLEND_REMOVAL
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
render_paint_contour(matrix);
#else
render_paint_contour(); render_paint_contour();
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#else #else
if (m_paint_contour.has_VBO()) { if (m_paint_contour.has_VBO()) {
ScopeGuard guard_gouraud([shader]() { shader->start_using(); }); ScopeGuard guard_gouraud([shader]() { shader->start_using(); });
@ -1340,6 +1350,10 @@ void TriangleSelectorGUI::update_paint_contour()
init_data.format = { GLModel::Geometry::EPrimitiveType::Lines, GLModel::Geometry::EVertexLayout::P3, GLModel::Geometry::index_type(2 * contour_edges.size()) }; init_data.format = { GLModel::Geometry::EPrimitiveType::Lines, GLModel::Geometry::EVertexLayout::P3, GLModel::Geometry::index_type(2 * contour_edges.size()) };
init_data.reserve_vertices(2 * contour_edges.size()); init_data.reserve_vertices(2 * contour_edges.size());
init_data.reserve_indices(2 * contour_edges.size()); init_data.reserve_indices(2 * contour_edges.size());
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
init_data.color = ColorRGBA::WHITE();
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
//
// vertices + indices // vertices + indices
unsigned int vertices_count = 0; unsigned int vertices_count = 0;
for (const Vec2i& edge : contour_edges) { for (const Vec2i& edge : contour_edges) {
@ -1356,16 +1370,30 @@ void TriangleSelectorGUI::update_paint_contour()
m_paint_contour.init_from(std::move(init_data)); m_paint_contour.init_from(std::move(init_data));
} }
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
void TriangleSelectorGUI::render_paint_contour(const Transform3d& matrix)
#else
void TriangleSelectorGUI::render_paint_contour() void TriangleSelectorGUI::render_paint_contour()
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
{ {
auto* curr_shader = wxGetApp().get_current_shader(); auto* curr_shader = wxGetApp().get_current_shader();
if (curr_shader != nullptr) if (curr_shader != nullptr)
curr_shader->stop_using(); curr_shader->stop_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
auto* contour_shader = wxGetApp().get_shader("mm_contour_attr");
#else
auto* contour_shader = wxGetApp().get_shader("mm_contour"); auto* contour_shader = wxGetApp().get_shader("mm_contour");
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
if (contour_shader != nullptr) { if (contour_shader != nullptr) {
contour_shader->start_using(); contour_shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Camera& camera = wxGetApp().plater()->get_camera();
contour_shader->set_uniform("view_model_matrix", camera.get_view_matrix() * matrix);
contour_shader->set_uniform("projection_matrix", camera.get_projection_matrix());
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glDepthFunc(GL_LEQUAL)); glsafe(::glDepthFunc(GL_LEQUAL));
m_paint_contour.render(); m_paint_contour.render();
glsafe(::glDepthFunc(GL_LESS)); glsafe(::glDepthFunc(GL_LESS));

View File

@ -77,10 +77,15 @@ public:
: TriangleSelector(mesh) {} : TriangleSelector(mesh) {}
virtual ~TriangleSelectorGUI() = default; virtual ~TriangleSelectorGUI() = default;
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
virtual void render(ImGuiWrapper* imgui, const Transform3d& matrix);
void render(const Transform3d& matrix) { this->render(nullptr, matrix); }
#else
// Render current selection. Transformation matrices are supposed // Render current selection. Transformation matrices are supposed
// to be already set. // to be already set.
virtual void render(ImGuiWrapper *imgui); virtual void render(ImGuiWrapper *imgui);
void render() { this->render(nullptr); } void render() { this->render(nullptr); }
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
void request_update_render_data() { m_update_render_data = true; } void request_update_render_data() { m_update_render_data = true; }
@ -117,7 +122,11 @@ protected:
GLModel m_paint_contour; GLModel m_paint_contour;
void update_paint_contour(); void update_paint_contour();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
void render_paint_contour(const Transform3d& matrix);
#else
void render_paint_contour(); void render_paint_contour();
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#else #else
GLPaintContour m_paint_contour; GLPaintContour m_paint_contour;
#endif // ENABLE_GLBEGIN_GLEND_REMOVAL #endif // ENABLE_GLBEGIN_GLEND_REMOVAL

View File

@ -737,12 +737,12 @@ void GLGizmoSimplify::on_render()
GLModel &glmodel = it->second; GLModel &glmodel = it->second;
const Transform3d trafo_matrix = selected_volume->world_matrix(); const Transform3d trafo_matrix = selected_volume->world_matrix();
glsafe(::glPushMatrix());
glsafe(::glMultMatrixd(trafo_matrix.data()));
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
auto* gouraud_shader = wxGetApp().get_shader("gouraud_light_attr"); auto* gouraud_shader = wxGetApp().get_shader("gouraud_light_attr");
#else #else
glsafe(::glPushMatrix());
glsafe(::glMultMatrixd(trafo_matrix.data()));
auto *gouraud_shader = wxGetApp().get_shader("gouraud_light"); auto *gouraud_shader = wxGetApp().get_shader("gouraud_light");
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glPushAttrib(GL_DEPTH_TEST)); glsafe(::glPushAttrib(GL_DEPTH_TEST));
@ -759,16 +759,31 @@ void GLGizmoSimplify::on_render()
gouraud_shader->stop_using(); gouraud_shader->stop_using();
if (m_show_wireframe) { if (m_show_wireframe) {
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
auto* contour_shader = wxGetApp().get_shader("mm_contour_attr");
#else
auto *contour_shader = wxGetApp().get_shader("mm_contour"); auto *contour_shader = wxGetApp().get_shader("mm_contour");
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
contour_shader->start_using(); contour_shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
contour_shader->set_uniform("view_model_matrix", view_model_matrix);
contour_shader->set_uniform("projection_matrix", camera.get_projection_matrix());
const ColorRGBA color = glmodel.get_color();
glmodel.set_color(ColorRGBA::WHITE());
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glLineWidth(1.0f)); glsafe(::glLineWidth(1.0f));
glsafe(::glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)); glsafe(::glPolygonMode(GL_FRONT_AND_BACK, GL_LINE));
glmodel.render(); glmodel.render();
glsafe(::glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)); glsafe(::glPolygonMode(GL_FRONT_AND_BACK, GL_FILL));
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glmodel.set_color(color);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
contour_shader->stop_using(); contour_shader->stop_using();
} }
glsafe(::glPopAttrib()); glsafe(::glPopAttrib());
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glPopMatrix()); glsafe(::glPopMatrix());
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
} }
} }

View File

@ -209,10 +209,13 @@ void InstancesHider::render_cut() const
ClippingPlane clp = *get_pool()->object_clipper()->get_clipping_plane(); ClippingPlane clp = *get_pool()->object_clipper()->get_clipping_plane();
clp.set_normal(-clp.get_normal()); clp.set_normal(-clp.get_normal());
clipper->set_limiting_plane(clp); clipper->set_limiting_plane(clp);
} else }
else
clipper->set_limiting_plane(ClippingPlane::ClipsNothing()); clipper->set_limiting_plane(ClippingPlane::ClipsNothing());
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glPushMatrix()); glsafe(::glPushMatrix());
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL #if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
if (mv->is_model_part()) if (mv->is_model_part())
glsafe(::glColor3f(0.8f, 0.3f, 0.0f)); glsafe(::glColor3f(0.8f, 0.3f, 0.0f));
@ -229,7 +232,9 @@ void InstancesHider::render_cut() const
clipper->render_cut(); clipper->render_cut();
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL #endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
glsafe(::glPopAttrib()); glsafe(::glPopAttrib());
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glPopMatrix()); glsafe(::glPopMatrix());
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
++clipper_id; ++clipper_id;
} }
@ -410,11 +415,11 @@ void ObjectClipper::render_cut() const
return; return;
const SelectionInfo* sel_info = get_pool()->selection_info(); const SelectionInfo* sel_info = get_pool()->selection_info();
const ModelObject* mo = sel_info->model_object(); const ModelObject* mo = sel_info->model_object();
Geometry::Transformation inst_trafo = mo->instances[sel_info->get_active_instance()]->get_transformation(); const Geometry::Transformation inst_trafo = mo->instances[sel_info->get_active_instance()]->get_transformation();
size_t clipper_id = 0; size_t clipper_id = 0;
for (const ModelVolume* mv : mo->volumes) { for (const ModelVolume* mv : mo->volumes) {
Geometry::Transformation vol_trafo = mv->get_transformation(); const Geometry::Transformation vol_trafo = mv->get_transformation();
Geometry::Transformation trafo = inst_trafo * vol_trafo; Geometry::Transformation trafo = inst_trafo * vol_trafo;
trafo.set_offset(trafo.get_offset() + Vec3d(0., 0., sel_info->get_sla_shift())); trafo.set_offset(trafo.get_offset() + Vec3d(0., 0., sel_info->get_sla_shift()));
@ -422,14 +427,18 @@ void ObjectClipper::render_cut() const
clipper->set_plane(*m_clp); clipper->set_plane(*m_clp);
clipper->set_transformation(trafo); clipper->set_transformation(trafo);
clipper->set_limiting_plane(ClippingPlane(Vec3d::UnitZ(), -SINKING_Z_THRESHOLD)); clipper->set_limiting_plane(ClippingPlane(Vec3d::UnitZ(), -SINKING_Z_THRESHOLD));
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glPushMatrix()); glsafe(::glPushMatrix());
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL #if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
clipper->render_cut({ 1.0f, 0.37f, 0.0f, 1.0f }); clipper->render_cut({ 1.0f, 0.37f, 0.0f, 1.0f });
#else #else
glsafe(::glColor3f(1.0f, 0.37f, 0.0f)); glsafe(::glColor3f(1.0f, 0.37f, 0.0f));
clipper->render_cut(); clipper->render_cut();
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL #endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glPopMatrix()); glsafe(::glPopMatrix());
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
++clipper_id; ++clipper_id;
} }
@ -520,7 +529,7 @@ void SupportsClipper::render_cut() const
const SelectionInfo* sel_info = get_pool()->selection_info(); const SelectionInfo* sel_info = get_pool()->selection_info();
const ModelObject* mo = sel_info->model_object(); const ModelObject* mo = sel_info->model_object();
Geometry::Transformation inst_trafo = mo->instances[sel_info->get_active_instance()]->get_transformation(); const Geometry::Transformation inst_trafo = mo->instances[sel_info->get_active_instance()]->get_transformation();
//Geometry::Transformation vol_trafo = mo->volumes.front()->get_transformation(); //Geometry::Transformation vol_trafo = mo->volumes.front()->get_transformation();
Geometry::Transformation trafo = inst_trafo;// * vol_trafo; Geometry::Transformation trafo = inst_trafo;// * vol_trafo;
trafo.set_offset(trafo.get_offset() + Vec3d(0., 0., sel_info->get_sla_shift())); trafo.set_offset(trafo.get_offset() + Vec3d(0., 0., sel_info->get_sla_shift()));
@ -539,14 +548,18 @@ void SupportsClipper::render_cut() const
m_clipper->set_plane(*ocl->get_clipping_plane()); m_clipper->set_plane(*ocl->get_clipping_plane());
m_clipper->set_transformation(supports_trafo); m_clipper->set_transformation(supports_trafo);
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glPushMatrix()); glsafe(::glPushMatrix());
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL #if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
m_clipper->render_cut({ 1.0f, 0.f, 0.37f, 1.0f }); m_clipper->render_cut({ 1.0f, 0.f, 0.37f, 1.0f });
#else #else
glsafe(::glColor3f(1.0f, 0.f, 0.37f)); glsafe(::glColor3f(1.0f, 0.f, 0.37f));
m_clipper->render_cut(); m_clipper->render_cut();
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL #endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glPopMatrix()); glsafe(::glPopMatrix());
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
} }