Tech ENABLE_RAYCAST_PICKING - Raytraced picking of Scale Gizmo

This commit is contained in:
enricoturri1966 2022-06-13 14:46:06 +02:00
parent 9962a5a873
commit 0cedf331b1
4 changed files with 20 additions and 4 deletions

View File

@ -363,7 +363,7 @@ void GLGizmoMove3D::on_render()
#if ENABLE_RAYCAST_PICKING #if ENABLE_RAYCAST_PICKING
void GLGizmoMove3D::on_register_raycasters_for_picking() void GLGizmoMove3D::on_register_raycasters_for_picking()
{ {
// this gizmo is rendered on top of the scene, so the raytraced picker should take it into account // the gizmo grabbers are rendered on top of the scene, so the raytraced picker should take it into account
m_parent.set_raycaster_gizmos_on_top(true); m_parent.set_raycaster_gizmos_on_top(true);
} }

View File

@ -885,7 +885,7 @@ void GLGizmoRotate3D::on_render()
#if ENABLE_RAYCAST_PICKING #if ENABLE_RAYCAST_PICKING
void GLGizmoRotate3D::on_register_raycasters_for_picking() void GLGizmoRotate3D::on_register_raycasters_for_picking()
{ {
// this gizmo is rendered on top of the scene, so the raytraced picker should take it into account // the gizmo grabbers are rendered on top of the scene, so the raytraced picker should take it into account
m_parent.set_raycaster_gizmos_on_top(true); m_parent.set_raycaster_gizmos_on_top(true);
for (GLGizmoRotate& g : m_gizmos) { for (GLGizmoRotate& g : m_gizmos) {
g.register_raycasters_for_picking(true); g.register_raycasters_for_picking(true);

View File

@ -643,6 +643,19 @@ void GLGizmoScale3D::on_render()
#endif // ENABLE_WORLD_COORDINATE #endif // ENABLE_WORLD_COORDINATE
} }
#if ENABLE_RAYCAST_PICKING
void GLGizmoScale3D::on_register_raycasters_for_picking()
{
// the gizmo grabbers are rendered on top of the scene, so the raytraced picker should take it into account
m_parent.set_raycaster_gizmos_on_top(true);
}
void GLGizmoScale3D::on_unregister_raycasters_for_picking()
{
m_parent.set_raycaster_gizmos_on_top(false);
}
#endif // ENABLE_RAYCAST_PICKING
#if !ENABLE_RAYCAST_PICKING #if !ENABLE_RAYCAST_PICKING
void GLGizmoScale3D::on_render_for_picking() void GLGizmoScale3D::on_render_for_picking()
{ {

View File

@ -93,9 +93,12 @@ protected:
virtual void on_stop_dragging() override; virtual void on_stop_dragging() override;
virtual void on_dragging(const UpdateData& data) override; virtual void on_dragging(const UpdateData& data) override;
virtual void on_render() override; virtual void on_render() override;
#if !ENABLE_RAYCAST_PICKING #if ENABLE_RAYCAST_PICKING
virtual void on_register_raycasters_for_picking() override;
virtual void on_unregister_raycasters_for_picking() override;
#else
virtual void on_render_for_picking() override; virtual void on_render_for_picking() override;
#endif // !ENABLE_RAYCAST_PICKING #endif // ENABLE_RAYCAST_PICKING
private: private:
#if ENABLE_LEGACY_OPENGL_REMOVAL #if ENABLE_LEGACY_OPENGL_REMOVAL