Another fix of the gizmo grabber color picking
This commit is contained in:
parent
32c9e8b168
commit
ef939905b1
2 changed files with 3 additions and 4 deletions
|
@ -6286,7 +6286,6 @@ void GLCanvas3D::_picking_pass() const
|
|||
::glReadPixels(pos(0), cnv_size.get_height() - pos(1) - 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, (void*)color);
|
||||
volume_id = color[0] + color[1] * 256 + color[2] * 256 * 256;
|
||||
}
|
||||
|
||||
if ((0 <= volume_id) && (volume_id < (int)m_volumes.volumes.size()))
|
||||
{
|
||||
m_hover_volume_id = volume_id;
|
||||
|
@ -6295,7 +6294,7 @@ void GLCanvas3D::_picking_pass() const
|
|||
else
|
||||
{
|
||||
m_hover_volume_id = -1;
|
||||
m_gizmos.set_hover_id(inside ? (254 - (int)color[2]) : -1);
|
||||
m_gizmos.set_hover_id(inside && volume_id <= 254 * 255 * 255 ? (254 * 255 * 255 - volume_id) : -1);
|
||||
}
|
||||
|
||||
_update_volumes_hover_state();
|
||||
|
|
|
@ -255,9 +255,9 @@ std::array<float, 3> GLGizmoBase::picking_color_component(unsigned int id) const
|
|||
if (m_group_id > -1)
|
||||
id -= m_group_id;
|
||||
|
||||
return std::array<float, 3> { (float)((id >> 16) & 0xff) * INV_255, // red
|
||||
return std::array<float, 3> { (float)((id >> 0) & 0xff) * INV_255, // red
|
||||
(float)((id >> 8) & 0xff) * INV_255, // green
|
||||
(float)(id & 0xff) * INV_255}; // blue
|
||||
(float)((id >> 16)& 0xff) * INV_255}; // blue
|
||||
}
|
||||
|
||||
void GLGizmoBase::render_grabbers(const BoundingBoxf3& box) const
|
||||
|
|
Loading…
Reference in a new issue