mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 09:47:58 -06:00
Fix mm rendering
This commit is contained in:
parent
511bfa71b6
commit
e211e7d144
3 changed files with 14 additions and 10 deletions
|
@ -492,11 +492,10 @@ void GLVolume::simple_render(GLShaderProgram* shader, ModelObjectPtrs& model_obj
|
|||
}
|
||||
} while (0);
|
||||
|
||||
if (color_volume) {
|
||||
glsafe(::glMultMatrixd(world_matrix().data()));
|
||||
if (color_volume && !picking) {
|
||||
for (int idx = 0; idx < mmuseg_models.size(); idx++) {
|
||||
GUI::GLModel &m = mmuseg_models[idx];
|
||||
if (m.is_empty())
|
||||
if (!m.is_initialized())
|
||||
continue;
|
||||
|
||||
if (idx == 0) {
|
||||
|
@ -570,17 +569,17 @@ void GLWipeTowerVolume::render()
|
|||
if (this->is_left_handed())
|
||||
glFrontFace(GL_CW);
|
||||
glsafe(::glCullFace(GL_BACK));
|
||||
glsafe(::glPushMatrix());
|
||||
glsafe(::glMultMatrixd(world_matrix().data()));
|
||||
|
||||
GLShaderProgram* shader = GUI::wxGetApp().get_current_shader();
|
||||
for (int i = 0; i < m_colors.size(); i++) {
|
||||
if (!picking) {
|
||||
ColorRGBA new_color = adjust_color_for_rendering(m_colors[i]);
|
||||
this->model_per_colors[i].set_color(new_color);
|
||||
} else {
|
||||
this->model_per_colors[i].set_color(model.get_color());
|
||||
}
|
||||
this->model_per_colors[i].render();
|
||||
}
|
||||
|
||||
glsafe(::glPopMatrix());
|
||||
if (this->is_left_handed())
|
||||
glFrontFace(GL_CCW);
|
||||
}
|
||||
|
|
|
@ -194,6 +194,8 @@ public:
|
|||
bool force_neutral_color : 1;
|
||||
// Whether or not to force rendering of sinking contours
|
||||
bool force_sinking_contours : 1;
|
||||
// Is render for picking
|
||||
bool picking : 1;
|
||||
};
|
||||
|
||||
// Is mouse or rectangle selection over this object to select/deselect it ?
|
||||
|
@ -315,7 +317,7 @@ public:
|
|||
virtual void render();
|
||||
|
||||
//BBS: add outline related logic and add virtual specifier
|
||||
void render_with_outline(const Transform3d &view_model_matrix);
|
||||
virtual void render_with_outline(const Transform3d &view_model_matrix);
|
||||
|
||||
//BBS: add simple render function for thumbnail
|
||||
void simple_render(GLShaderProgram* shader, ModelObjectPtrs& model_objects, std::vector<ColorRGBA>& extruder_colors);
|
||||
|
@ -348,6 +350,7 @@ class GLWipeTowerVolume : public GLVolume {
|
|||
public:
|
||||
GLWipeTowerVolume(const std::vector<ColorRGBA>& colors);
|
||||
void render() override;
|
||||
void render_with_outline(const Transform3d &view_model_matrix) override { render(); }
|
||||
|
||||
std::vector<GUI::GLModel> model_per_colors;
|
||||
bool IsTransparent();
|
||||
|
|
|
@ -7203,7 +7203,9 @@ void GLCanvas3D::_render_volumes_for_picking() const
|
|||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * volume.first->world_matrix());
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
volume.first->picking = true;
|
||||
volume.first->render();
|
||||
volume.first->picking = false;
|
||||
shader->stop_using();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue