Small refactoring
This commit is contained in:
parent
748a4438ba
commit
905673f344
1 changed files with 3 additions and 5 deletions
|
@ -3658,9 +3658,7 @@ void GLCanvas3D::_refresh_if_shown_on_screen()
|
|||
|
||||
void GLCanvas3D::_picking_pass() const
|
||||
{
|
||||
const Vec2d& pos = m_mouse.position;
|
||||
|
||||
if (m_picking_enabled && !m_mouse.dragging && (pos != Vec2d(DBL_MAX, DBL_MAX)))
|
||||
if (m_picking_enabled && !m_mouse.dragging && (m_mouse.position != Vec2d(DBL_MAX, DBL_MAX)))
|
||||
{
|
||||
m_hover_volume_idxs.clear();
|
||||
|
||||
|
@ -3694,10 +3692,10 @@ void GLCanvas3D::_picking_pass() const
|
|||
|
||||
GLubyte color[4] = { 0, 0, 0, 0 };
|
||||
const Size& cnv_size = get_canvas_size();
|
||||
bool inside = (0 <= pos(0)) && (pos(0) < cnv_size.get_width()) && (0 <= pos(1)) && (pos(1) < cnv_size.get_height());
|
||||
bool inside = (0 <= m_mouse.position(0)) && (m_mouse.position(0) < cnv_size.get_width()) && (0 <= m_mouse.position(1)) && (m_mouse.position(1) < cnv_size.get_height());
|
||||
if (inside)
|
||||
{
|
||||
glsafe(::glReadPixels(pos(0), cnv_size.get_height() - pos(1) - 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, (void*)color));
|
||||
glsafe(::glReadPixels(m_mouse.position(0), cnv_size.get_height() - m_mouse.position(1) - 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, (void*)color));
|
||||
volume_id = color[0] + (color[1] << 8) + (color[2] << 16);
|
||||
}
|
||||
if ((0 <= volume_id) && (volume_id < (int)m_volumes.volumes.size()))
|
||||
|
|
Loading…
Reference in a new issue