Add live preview on open gizmo
Add delay 250ms before process for live move with slider Add short cut for unmodified mesh in processing
This commit is contained in:
parent
79dd007ec7
commit
ee7d5db31c
2 changed files with 22 additions and 9 deletions
|
@ -91,7 +91,7 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
|
|||
m_is_valid_result = false;
|
||||
m_exist_preview = false;
|
||||
init_wireframe();
|
||||
|
||||
live_preview();
|
||||
if (change_window_position) {
|
||||
ImVec2 pos = ImGui::GetMousePos();
|
||||
pos.x -= m_gui_cfg->window_offset_x;
|
||||
|
@ -308,9 +308,23 @@ void GLGizmoSimplify::process()
|
|||
if (m_volume == nullptr) return;
|
||||
if (m_volume->mesh().its.indices.empty()) return;
|
||||
size_t count_triangles = m_volume->mesh().its.indices.size();
|
||||
if (m_configuration.use_count &&
|
||||
m_configuration.wanted_count >= count_triangles)
|
||||
// Is neccessary simplification
|
||||
if ((m_configuration.use_count && m_configuration.wanted_count >= count_triangles) ||
|
||||
(!m_configuration.use_count && m_configuration.max_error <= 0.f)) {
|
||||
|
||||
// Exist different original volume?
|
||||
if (m_original_its.has_value() &&
|
||||
m_original_its->indices.size() != count_triangles) {
|
||||
indexed_triangle_set its = *m_original_its; // copy
|
||||
set_its(its);
|
||||
}
|
||||
m_is_valid_result = true;
|
||||
|
||||
// re-render bargraph
|
||||
set_dirty();
|
||||
m_parent.schedule_extra_frame(0);
|
||||
return;
|
||||
}
|
||||
|
||||
// when not store original volume store it for cancelation
|
||||
if (!m_original_its.has_value()) {
|
||||
|
|
|
@ -95,14 +95,13 @@ private:
|
|||
|
||||
void fix_count_by_ratio(size_t triangle_count)
|
||||
{
|
||||
if (decimate_ratio <= 0.f) {
|
||||
if (decimate_ratio <= 0.f)
|
||||
wanted_count = static_cast<uint32_t>(triangle_count);
|
||||
return;
|
||||
} else if (decimate_ratio >= 1.f) {
|
||||
else if (decimate_ratio >= 100.f)
|
||||
wanted_count = 0;
|
||||
return;
|
||||
}
|
||||
wanted_count = static_cast<uint32_t>(std::round(triangle_count * (100.f-decimate_ratio) / 100.f));
|
||||
else
|
||||
wanted_count = static_cast<uint32_t>(std::round(
|
||||
triangle_count * (100.f - decimate_ratio) / 100.f));
|
||||
}
|
||||
} m_configuration;
|
||||
|
||||
|
|
Loading…
Reference in a new issue