Tech ENABLE_WORLD_COORDINATE - Resize Move and Rotate gizmos in dependence of the selected coordinate system
This commit is contained in:
parent
b754ee3c84
commit
e1619944ad
4 changed files with 55 additions and 14 deletions
|
@ -45,6 +45,10 @@ GLGizmoRotate::GLGizmoRotate(const GLGizmoRotate& other)
|
|||
, m_snap_coarse_out_radius(other.m_snap_coarse_out_radius)
|
||||
, m_snap_fine_in_radius(other.m_snap_fine_in_radius)
|
||||
, m_snap_fine_out_radius(other.m_snap_fine_out_radius)
|
||||
#if ENABLE_WORLD_COORDINATE
|
||||
, m_bounding_box(other.m_bounding_box)
|
||||
, m_orient_matrix(other.m_orient_matrix)
|
||||
#endif // ENABLE_WORLD_COORDINATE
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -128,7 +132,9 @@ void GLGizmoRotate::on_render()
|
|||
return;
|
||||
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
#if !ENABLE_WORLD_COORDINATE
|
||||
const BoundingBoxf3& box = selection.get_bounding_box();
|
||||
#endif // !ENABLE_WORLD_COORDINATE
|
||||
|
||||
if (m_hover_id != 0 && !m_grabbers[0].dragging) {
|
||||
#if ENABLE_WORLD_COORDINATE
|
||||
|
@ -164,8 +170,13 @@ void GLGizmoRotate::on_render()
|
|||
if (m_hover_id != -1)
|
||||
render_angle();
|
||||
|
||||
#if ENABLE_WORLD_COORDINATE
|
||||
render_grabber(m_bounding_box);
|
||||
render_grabber_extension(m_bounding_box, false);
|
||||
#else
|
||||
render_grabber(box);
|
||||
render_grabber_extension(box, false);
|
||||
#endif // ENABLE_WORLD_COORDINATE
|
||||
|
||||
glsafe(::glPopMatrix());
|
||||
}
|
||||
|
@ -180,9 +191,14 @@ void GLGizmoRotate::on_render_for_picking()
|
|||
|
||||
transform_to_local(selection);
|
||||
|
||||
#if ENABLE_WORLD_COORDINATE
|
||||
render_grabbers_for_picking(m_bounding_box);
|
||||
render_grabber_extension(m_bounding_box, true);
|
||||
#else
|
||||
const BoundingBoxf3& box = selection.get_bounding_box();
|
||||
render_grabbers_for_picking(box);
|
||||
render_grabber_extension(box, true);
|
||||
#endif // ENABLE_WORLD_COORDINATE
|
||||
|
||||
glsafe(::glPopMatrix());
|
||||
}
|
||||
|
@ -190,9 +206,26 @@ void GLGizmoRotate::on_render_for_picking()
|
|||
#if ENABLE_WORLD_COORDINATE
|
||||
void GLGizmoRotate::init_data_from_selection(const Selection& selection)
|
||||
{
|
||||
#if ENABLE_WORLD_COORDINATE
|
||||
m_bounding_box.reset();
|
||||
if (wxGetApp().obj_manipul()->get_world_coordinates()) {
|
||||
m_bounding_box = selection.get_bounding_box();
|
||||
m_center = m_bounding_box.center();
|
||||
}
|
||||
else {
|
||||
const Selection::IndicesList& ids = selection.get_volume_idxs();
|
||||
for (unsigned int id : ids) {
|
||||
const GLVolume* v = selection.get_volume(id);
|
||||
m_bounding_box.merge(v->transformed_convex_hull_bounding_box(v->get_volume_transformation().get_matrix()));
|
||||
}
|
||||
m_center = selection.get_volume(*ids.begin())->get_instance_transformation().get_matrix() * m_bounding_box.center();
|
||||
}
|
||||
m_radius = Offset + m_bounding_box.radius();
|
||||
#else
|
||||
const BoundingBoxf3& box = selection.get_bounding_box();
|
||||
m_center = box.center();
|
||||
m_radius = Offset + box.radius();
|
||||
#endif // ENABLE_WORLD_COORDINATE
|
||||
m_snap_coarse_in_radius = m_radius / 3.0f;
|
||||
m_snap_coarse_out_radius = 2.0f * m_snap_coarse_in_radius;
|
||||
m_snap_fine_in_radius = m_radius;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue