Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2019-06-13 11:24:19 +0300
committerEnrico Turri <enricoturri@seznam.cz>2019-06-13 11:24:19 +0300
commita99466ef1df99d52277a5f78a4fbb5481d2dd584 (patch)
treefd84bcd29d52518bb3f57f2bf9b3d643ffbc154d /src
parentf0b228c4d2f2d385bbfd3fe917fd928ffaadd1d3 (diff)
Method Camera::apply_projection() called at every rendered frame
Diffstat (limited to 'src')
-rw-r--r--src/slic3r/GUI/Camera.cpp5
-rw-r--r--src/slic3r/GUI/GLCanvas3D.cpp9
2 files changed, 8 insertions, 6 deletions
diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp
index 4c7cb314a..5aa881e3e 100644
--- a/src/slic3r/GUI/Camera.cpp
+++ b/src/slic3r/GUI/Camera.cpp
@@ -48,7 +48,7 @@ std::string Camera::get_type_as_string() const
// case Perspective:
// return "perspective";
case Ortho:
- return "ortho";
+ return "orthographic";
};
}
@@ -160,12 +160,15 @@ void Camera::debug_render() const
imgui.set_next_window_bg_alpha(0.5f);
imgui.begin(std::string("Camera statistics"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
+ std::string type = get_type_as_string();
Vec3f position = get_position().cast<float>();
Vec3f target = m_target.cast<float>();
Vec3f forward = get_dir_forward().cast<float>();
Vec3f right = get_dir_right().cast<float>();
Vec3f up = get_dir_up().cast<float>();
+ ImGui::InputText("Type", const_cast<char*>(type.data()), type.length(), ImGuiInputTextFlags_ReadOnly);
+ ImGui::Separator();
ImGui::InputFloat3("Position", position.data(), "%.6f", ImGuiInputTextFlags_ReadOnly);
ImGui::InputFloat3("Target", target.data(), "%.6f", ImGuiInputTextFlags_ReadOnly);
ImGui::Separator();
diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp
index 151ec3bdb..6648d744b 100644
--- a/src/slic3r/GUI/GLCanvas3D.cpp
+++ b/src/slic3r/GUI/GLCanvas3D.cpp
@@ -1624,6 +1624,7 @@ void GLCanvas3D::render()
}
m_camera.apply_view_matrix();
+ m_camera.apply_projection(_max_bounding_box());
GLfloat position_cam[4] = { 1.0f, 0.0f, 1.0f, 0.0f };
glsafe(::glLightfv(GL_LIGHT1, GL_POSITION, position_cam));
@@ -2515,7 +2516,7 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
m_layers_editing.band_width = std::max(std::min(m_layers_editing.band_width * (1.0f + 0.1f * (float)evt.GetWheelRotation() / (float)evt.GetWheelDelta()), 10.0f), 1.5f);
if (m_canvas != nullptr)
m_canvas->Refresh();
-
+
return;
}
}
@@ -2526,8 +2527,7 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
return;
// Calculate the zoom delta and apply it to the current zoom factor
- float zoom = (float)evt.GetWheelRotation() / (float)evt.GetWheelDelta();
- set_camera_zoom(zoom);
+ set_camera_zoom((float)evt.GetWheelRotation() / (float)evt.GetWheelDelta());
}
void GLCanvas3D::on_timer(wxTimerEvent& evt)
@@ -3293,7 +3293,7 @@ void GLCanvas3D::set_camera_zoom(float zoom)
zoom = std::min(zoom, 100.0f);
m_camera.zoom = zoom;
- _refresh_if_shown_on_screen();
+ m_dirty = true;
}
void GLCanvas3D::update_gizmos_on_off_state()
@@ -3609,7 +3609,6 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
// updates camera
m_camera.apply_viewport(0, 0, w, h);
- m_camera.apply_projection(_max_bounding_box());
m_dirty = false;
}