diff --git a/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx b/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx index 89230c7668..b72f45cdff 100644 --- a/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx +++ b/src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx @@ -453,14 +453,16 @@ gp_Pnt SelectMgr_SelectingVolumeManager::GetFarPickedPnt() const // purpose : //======================================================================= void SelectMgr_SelectingVolumeManager::SetViewClipping (const Handle(Graphic3d_SequenceOfHClipPlane)& theViewPlanes, - const Handle(Graphic3d_SequenceOfHClipPlane)& theObjPlanes) + const Handle(Graphic3d_SequenceOfHClipPlane)& theObjPlanes, + const SelectMgr_SelectingVolumeManager* theWorldSelMgr) { myViewClipPlanes = theViewPlanes; myObjectClipPlanes = theObjPlanes; if (myActiveSelectionType != Point) return; - const SelectMgr_RectangularFrustum* aFrustum = reinterpret_cast(mySelectingVolumes[Frustum].get()); + const SelectMgr_SelectingVolumeManager* aWorldSelMgr = theWorldSelMgr != NULL ? theWorldSelMgr : this; + const SelectMgr_RectangularFrustum* aFrustum = reinterpret_cast(aWorldSelMgr->mySelectingVolumes[Frustum].get()); myViewClipRange.SetVoid(); if (!theViewPlanes.IsNull() && !theViewPlanes->IsEmpty()) diff --git a/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx b/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx index 6b3fe7822d..12b492761f 100644 --- a/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx +++ b/src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx @@ -172,10 +172,12 @@ public: //! Valid for point selection only! //! Computes depth range for clipping planes. - //! @param theViewPlanes global view planes - //! @param theObjPlanes object planes + //! @param theViewPlanes [in] global view planes + //! @param theObjPlanes [in] object planes + //! @param theWorldSelMgr [in] selection volume in world space for computing clipping plane ranges Standard_EXPORT void SetViewClipping (const Handle(Graphic3d_SequenceOfHClipPlane)& theViewPlanes, - const Handle(Graphic3d_SequenceOfHClipPlane)& theObjPlanes); + const Handle(Graphic3d_SequenceOfHClipPlane)& theObjPlanes, + const SelectMgr_SelectingVolumeManager* theWorldSelMgr); //! Copy clipping planes from another volume manager. Standard_EXPORT void SetViewClipping (const SelectMgr_SelectingVolumeManager& theOther); diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.cxx b/src/SelectMgr/SelectMgr_ViewerSelector.cxx index 9ada79f70d..94b4769bc0 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.cxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.cxx @@ -386,7 +386,7 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable if (!theObject->ClipPlanes().IsNull() && theObject->ClipPlanes()->ToOverrideGlobal()) { - aMgr.SetViewClipping (Handle(Graphic3d_SequenceOfHClipPlane)(), theObject->ClipPlanes()); + aMgr.SetViewClipping (Handle(Graphic3d_SequenceOfHClipPlane)(), theObject->ClipPlanes(), &theMgr); } else if (!theObject->TransformPersistence().IsNull()) { @@ -414,12 +414,12 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable } } - aMgr.SetViewClipping (Handle(Graphic3d_SequenceOfHClipPlane)(), theObject->ClipPlanes()); + aMgr.SetViewClipping (Handle(Graphic3d_SequenceOfHClipPlane)(), theObject->ClipPlanes(), &theMgr); } else if (!theObject->ClipPlanes().IsNull() && !theObject->ClipPlanes()->IsEmpty()) { - aMgr.SetViewClipping (theMgr.ViewClipping(), theObject->ClipPlanes()); + aMgr.SetViewClipping (theMgr.ViewClipping(), theObject->ClipPlanes(), &theMgr); } if (!theMgr.ViewClipping().IsNull() && diff --git a/src/SelectMgr/SelectMgr_ViewerSelector3d.cxx b/src/SelectMgr/SelectMgr_ViewerSelector3d.cxx index 7c3f95c6e5..f1600dc407 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector3d.cxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector3d.cxx @@ -63,7 +63,7 @@ void SelectMgr_ViewerSelector3d::Pick (const Standard_Integer theXPix, gp_Pnt2d aMousePos (static_cast (theXPix), static_cast (theYPix)); mySelectingVolumeMgr.BuildSelectingVolume (aMousePos); - mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)()); + mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)(), NULL); TraverseSensitives(); } @@ -91,7 +91,7 @@ void SelectMgr_ViewerSelector3d::Pick (const Standard_Integer theXPMin, mySelectingVolumeMgr.BuildSelectingVolume (aMinMousePos, aMaxMousePos); - mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)()); + mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)(), NULL); TraverseSensitives(); } @@ -111,7 +111,7 @@ void SelectMgr_ViewerSelector3d::Pick (const TColgp_Array1OfPnt2d& thePolyline, mySelectingVolumeMgr.SetWindowSize (aWidth, aHeight); mySelectingVolumeMgr.BuildSelectingVolume (thePolyline); - mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)()); + mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)(), NULL); TraverseSensitives(); } diff --git a/tests/bugs/vis/bug31650 b/tests/bugs/vis/bug31650 new file mode 100644 index 0000000000..e59f0f8130 --- /dev/null +++ b/tests/bugs/vis/bug31650 @@ -0,0 +1,26 @@ +puts "============" +puts "0031650: Visualization - invalid picking of object with local transformation and per-object clipping plane" +puts "============" +puts "" + +pload XDE MODELING VISUALIZATION +vclear +vinit View1 +vaxo +box b -28 -11 -35 20 20 42 +vdisplay -dispMode 1 -highMode 1 b +vsetlocation b 0 0 20 +vfit +catch {vclipplane -delete p} + +# global clipping +vclipplane p -equation 0 0 -1 -10 -set +vmoveto 205 205 +if { [vreadpixel 205 320 -name -rgb] != "DARKGOLDENROD" } { puts "Error" } + +# local clipping +vclipplane p -equation 0 0 -1 -10 -set b +vmoveto 205 205 +if { [vreadpixel 205 320 -name -rgb] != "DARKGOLDENROD" } { puts "Error" } + +vdump ${imagedir}/${casename}.png