ENH: Revert "remove the sinking logic"
This reverts commit 17dded5d4aa54a330174788f3d6fbd583f63f8e1. Change-Id: I51816d8357076a07c500a1bd006b08c15d7467e6
This commit is contained in:
parent
00a815e507
commit
0ce72dfcb7
|
@ -1272,14 +1272,13 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
||||||
#endif // ENABLE_MODIFIERS_ALWAYS_TRANSPARENT
|
#endif // ENABLE_MODIFIERS_ALWAYS_TRANSPARENT
|
||||||
|
|
||||||
// render sinking contours of non-hovered volumes
|
// render sinking contours of non-hovered volumes
|
||||||
//BBS: remove sinking logic
|
if (m_show_sinking_contours)
|
||||||
/*if (m_show_sinking_contours)
|
|
||||||
if (volume.first->is_sinking() && !volume.first->is_below_printbed() &&
|
if (volume.first->is_sinking() && !volume.first->is_below_printbed() &&
|
||||||
volume.first->hover == GLVolume::HS_None && !volume.first->force_sinking_contours) {
|
volume.first->hover == GLVolume::HS_None && !volume.first->force_sinking_contours) {
|
||||||
shader->stop_using();
|
shader->stop_using();
|
||||||
volume.first->render_sinking_contours();
|
volume.first->render_sinking_contours();
|
||||||
shader->start_using();
|
shader->start_using();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
glsafe(::glEnableClientState(GL_VERTEX_ARRAY));
|
glsafe(::glEnableClientState(GL_VERTEX_ARRAY));
|
||||||
glsafe(::glEnableClientState(GL_NORMAL_ARRAY));
|
glsafe(::glEnableClientState(GL_NORMAL_ARRAY));
|
||||||
|
@ -1335,8 +1334,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
||||||
glsafe(::glDisableClientState(GL_NORMAL_ARRAY));
|
glsafe(::glDisableClientState(GL_NORMAL_ARRAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
//BBS: remove sinking logic
|
if (m_show_sinking_contours) {
|
||||||
/*if (m_show_sinking_contours) {
|
|
||||||
for (GLVolumeWithIdAndZ& volume : to_render) {
|
for (GLVolumeWithIdAndZ& volume : to_render) {
|
||||||
// render sinking contours of hovered/displaced volumes
|
// render sinking contours of hovered/displaced volumes
|
||||||
if (volume.first->is_sinking() && !volume.first->is_below_printbed() &&
|
if (volume.first->is_sinking() && !volume.first->is_below_printbed() &&
|
||||||
|
@ -1348,7 +1346,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
||||||
shader->start_using();
|
shader->start_using();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if (disable_cullface)
|
if (disable_cullface)
|
||||||
glsafe(::glEnable(GL_CULL_FACE));
|
glsafe(::glEnable(GL_CULL_FACE));
|
||||||
|
|
|
@ -4399,9 +4399,7 @@ void GLCanvas3D::do_move(const std::string& snapshot_type)
|
||||||
ModelObject* m = m_model->objects[i.first];
|
ModelObject* m = m_model->objects[i.first];
|
||||||
const double shift_z = m->get_instance_min_z(i.second);
|
const double shift_z = m->get_instance_min_z(i.second);
|
||||||
//BBS: don't call translate if the z is zero
|
//BBS: don't call translate if the z is zero
|
||||||
//BBS: removing sinking logic
|
if ((current_printer_technology() == ptSLA || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) {
|
||||||
if (shift_z != 0.0f) {
|
|
||||||
//if ((current_printer_technology() == ptSLA || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) {
|
|
||||||
const Vec3d shift(0.0, 0.0, -shift_z);
|
const Vec3d shift(0.0, 0.0, -shift_z);
|
||||||
m_selection.translate(i.first, i.second, shift);
|
m_selection.translate(i.first, i.second, shift);
|
||||||
m->translate_instance(i.second, shift);
|
m->translate_instance(i.second, shift);
|
||||||
|
@ -4447,9 +4445,8 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type)
|
||||||
if (!snapshot_type.empty())
|
if (!snapshot_type.empty())
|
||||||
wxGetApp().plater()->take_snapshot(snapshot_type);
|
wxGetApp().plater()->take_snapshot(snapshot_type);
|
||||||
|
|
||||||
//BBS: removing sinking logic
|
|
||||||
// stores current min_z of instances
|
// stores current min_z of instances
|
||||||
/*std::map<std::pair<int, int>, double> min_zs;
|
std::map<std::pair<int, int>, double> min_zs;
|
||||||
for (int i = 0; i < static_cast<int>(m_model->objects.size()); ++i) {
|
for (int i = 0; i < static_cast<int>(m_model->objects.size()); ++i) {
|
||||||
const ModelObject* obj = m_model->objects[i];
|
const ModelObject* obj = m_model->objects[i];
|
||||||
for (int j = 0; j < static_cast<int>(obj->instances.size()); ++j) {
|
for (int j = 0; j < static_cast<int>(obj->instances.size()); ++j) {
|
||||||
|
@ -4462,7 +4459,7 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type)
|
||||||
min_zs[{ i, j }] = obj->instance_bounding_box(j).min.z();
|
min_zs[{ i, j }] = obj->instance_bounding_box(j).min.z();
|
||||||
|
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
std::set<std::pair<int, int>> done; // keeps track of modified instances
|
std::set<std::pair<int, int>> done; // keeps track of modified instances
|
||||||
|
|
||||||
|
@ -4507,9 +4504,7 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type)
|
||||||
//BBS: don't call translate if the z is zero
|
//BBS: don't call translate if the z is zero
|
||||||
const double shift_z = m->get_instance_min_z(i.second);
|
const double shift_z = m->get_instance_min_z(i.second);
|
||||||
// leave sinking instances as sinking
|
// leave sinking instances as sinking
|
||||||
//BBS: removing sinking logic
|
if ((min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD)&&(shift_z != 0.0f)) {
|
||||||
if (shift_z != 0.0f) {
|
|
||||||
//if ((min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD)&&(shift_z != 0.0f)) {
|
|
||||||
const Vec3d shift(0.0, 0.0, -shift_z);
|
const Vec3d shift(0.0, 0.0, -shift_z);
|
||||||
m_selection.translate(i.first, i.second, shift);
|
m_selection.translate(i.first, i.second, shift);
|
||||||
m->translate_instance(i.second, shift);
|
m->translate_instance(i.second, shift);
|
||||||
|
@ -4536,9 +4531,8 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type)
|
||||||
if (!snapshot_type.empty())
|
if (!snapshot_type.empty())
|
||||||
wxGetApp().plater()->take_snapshot(snapshot_type);
|
wxGetApp().plater()->take_snapshot(snapshot_type);
|
||||||
|
|
||||||
//BBS: removing sinking logic
|
|
||||||
// stores current min_z of instances
|
// stores current min_z of instances
|
||||||
/*std::map<std::pair<int, int>, double> min_zs;
|
std::map<std::pair<int, int>, double> min_zs;
|
||||||
if (!snapshot_type.empty()) {
|
if (!snapshot_type.empty()) {
|
||||||
for (int i = 0; i < static_cast<int>(m_model->objects.size()); ++i) {
|
for (int i = 0; i < static_cast<int>(m_model->objects.size()); ++i) {
|
||||||
const ModelObject* obj = m_model->objects[i];
|
const ModelObject* obj = m_model->objects[i];
|
||||||
|
@ -4546,7 +4540,7 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type)
|
||||||
min_zs[{ i, j }] = obj->instance_bounding_box(j).min.z();
|
min_zs[{ i, j }] = obj->instance_bounding_box(j).min.z();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
std::set<std::pair<int, int>> done; // keeps track of modified instances
|
std::set<std::pair<int, int>> done; // keeps track of modified instances
|
||||||
|
|
||||||
|
@ -4592,9 +4586,7 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type)
|
||||||
//BBS: don't call translate if the z is zero
|
//BBS: don't call translate if the z is zero
|
||||||
double shift_z = m->get_instance_min_z(i.second);
|
double shift_z = m->get_instance_min_z(i.second);
|
||||||
// leave sinking instances as sinking
|
// leave sinking instances as sinking
|
||||||
//BBS: removing sinking logic
|
if ((min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) {
|
||||||
if (shift_z != 0.0f) {
|
|
||||||
//if ((min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) && (shift_z != 0.0f)) {
|
|
||||||
Vec3d shift(0.0, 0.0, -shift_z);
|
Vec3d shift(0.0, 0.0, -shift_z);
|
||||||
m_selection.translate(i.first, i.second, shift);
|
m_selection.translate(i.first, i.second, shift);
|
||||||
m->translate_instance(i.second, shift);
|
m->translate_instance(i.second, shift);
|
||||||
|
@ -4639,9 +4631,8 @@ void GLCanvas3D::do_mirror(const std::string& snapshot_type)
|
||||||
if (!snapshot_type.empty())
|
if (!snapshot_type.empty())
|
||||||
wxGetApp().plater()->take_snapshot(snapshot_type);
|
wxGetApp().plater()->take_snapshot(snapshot_type);
|
||||||
|
|
||||||
//BBS: removing sinking logic
|
|
||||||
// stores current min_z of instances
|
// stores current min_z of instances
|
||||||
/*std::map<std::pair<int, int>, double> min_zs;
|
std::map<std::pair<int, int>, double> min_zs;
|
||||||
if (!snapshot_type.empty()) {
|
if (!snapshot_type.empty()) {
|
||||||
for (int i = 0; i < static_cast<int>(m_model->objects.size()); ++i) {
|
for (int i = 0; i < static_cast<int>(m_model->objects.size()); ++i) {
|
||||||
const ModelObject* obj = m_model->objects[i];
|
const ModelObject* obj = m_model->objects[i];
|
||||||
|
@ -4649,7 +4640,7 @@ void GLCanvas3D::do_mirror(const std::string& snapshot_type)
|
||||||
min_zs[{ i, j }] = obj->instance_bounding_box(j).min.z();
|
min_zs[{ i, j }] = obj->instance_bounding_box(j).min.z();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
std::set<std::pair<int, int>> done; // keeps track of modified instances
|
std::set<std::pair<int, int>> done; // keeps track of modified instances
|
||||||
|
|
||||||
|
@ -4692,9 +4683,7 @@ void GLCanvas3D::do_mirror(const std::string& snapshot_type)
|
||||||
//BBS: don't call translate if the z is zero
|
//BBS: don't call translate if the z is zero
|
||||||
double shift_z = m->get_instance_min_z(i.second);
|
double shift_z = m->get_instance_min_z(i.second);
|
||||||
// leave sinking instances as sinking
|
// leave sinking instances as sinking
|
||||||
//BBS: removing sinking logic
|
if ((min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD)&&(shift_z != 0.0f)) {
|
||||||
if (shift_z != 0.0f) {
|
|
||||||
//if ((min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD)&&(shift_z != 0.0f)) {
|
|
||||||
Vec3d shift(0.0, 0.0, -shift_z);
|
Vec3d shift(0.0, 0.0, -shift_z);
|
||||||
m_selection.translate(i.first, i.second, shift);
|
m_selection.translate(i.first, i.second, shift);
|
||||||
m->translate_instance(i.second, shift);
|
m->translate_instance(i.second, shift);
|
||||||
|
@ -6649,8 +6638,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
|
||||||
else {
|
else {
|
||||||
m_volumes.set_clipping_plane(m_camera_clipping_plane.get_data());
|
m_volumes.set_clipping_plane(m_camera_clipping_plane.get_data());
|
||||||
}
|
}
|
||||||
//BBS: remove sinking logic
|
m_volumes.set_show_sinking_contours(! m_gizmos.is_hiding_instances());
|
||||||
//m_volumes.set_show_sinking_contours(! m_gizmos.is_hiding_instances());
|
|
||||||
|
|
||||||
GLShaderProgram* shader = wxGetApp().get_shader("gouraud");
|
GLShaderProgram* shader = wxGetApp().get_shader("gouraud");
|
||||||
ECanvasType canvas_type = this->m_canvas_type;
|
ECanvasType canvas_type = this->m_canvas_type;
|
||||||
|
|
Loading…
Reference in New Issue