mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0031650: Visualization - invalid picking of object with local transformation and per-object clipping plane
SelectMgr_SelectingVolumeManager::SetViewClipping() now updates clipping range using picking ray in world coordinates, as clipping planes are always defined in world space.
This commit is contained in:
parent
3e9c1d1e5a
commit
72e9e86732
@ -453,14 +453,16 @@ gp_Pnt SelectMgr_SelectingVolumeManager::GetFarPickedPnt() const
|
|||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SelectMgr_SelectingVolumeManager::SetViewClipping (const Handle(Graphic3d_SequenceOfHClipPlane)& theViewPlanes,
|
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;
|
myViewClipPlanes = theViewPlanes;
|
||||||
myObjectClipPlanes = theObjPlanes;
|
myObjectClipPlanes = theObjPlanes;
|
||||||
if (myActiveSelectionType != Point)
|
if (myActiveSelectionType != Point)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const SelectMgr_RectangularFrustum* aFrustum = reinterpret_cast<const SelectMgr_RectangularFrustum*>(mySelectingVolumes[Frustum].get());
|
const SelectMgr_SelectingVolumeManager* aWorldSelMgr = theWorldSelMgr != NULL ? theWorldSelMgr : this;
|
||||||
|
const SelectMgr_RectangularFrustum* aFrustum = reinterpret_cast<const SelectMgr_RectangularFrustum*>(aWorldSelMgr->mySelectingVolumes[Frustum].get());
|
||||||
myViewClipRange.SetVoid();
|
myViewClipRange.SetVoid();
|
||||||
if (!theViewPlanes.IsNull()
|
if (!theViewPlanes.IsNull()
|
||||||
&& !theViewPlanes->IsEmpty())
|
&& !theViewPlanes->IsEmpty())
|
||||||
|
@ -172,10 +172,12 @@ public:
|
|||||||
|
|
||||||
//! Valid for point selection only!
|
//! Valid for point selection only!
|
||||||
//! Computes depth range for clipping planes.
|
//! Computes depth range for clipping planes.
|
||||||
//! @param theViewPlanes global view planes
|
//! @param theViewPlanes [in] global view planes
|
||||||
//! @param theObjPlanes object 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,
|
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.
|
//! Copy clipping planes from another volume manager.
|
||||||
Standard_EXPORT void SetViewClipping (const SelectMgr_SelectingVolumeManager& theOther);
|
Standard_EXPORT void SetViewClipping (const SelectMgr_SelectingVolumeManager& theOther);
|
||||||
|
@ -386,7 +386,7 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
|
|||||||
if (!theObject->ClipPlanes().IsNull()
|
if (!theObject->ClipPlanes().IsNull()
|
||||||
&& theObject->ClipPlanes()->ToOverrideGlobal())
|
&& theObject->ClipPlanes()->ToOverrideGlobal())
|
||||||
{
|
{
|
||||||
aMgr.SetViewClipping (Handle(Graphic3d_SequenceOfHClipPlane)(), theObject->ClipPlanes());
|
aMgr.SetViewClipping (Handle(Graphic3d_SequenceOfHClipPlane)(), theObject->ClipPlanes(), &theMgr);
|
||||||
}
|
}
|
||||||
else if (!theObject->TransformPersistence().IsNull())
|
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()
|
else if (!theObject->ClipPlanes().IsNull()
|
||||||
&& !theObject->ClipPlanes()->IsEmpty())
|
&& !theObject->ClipPlanes()->IsEmpty())
|
||||||
{
|
{
|
||||||
aMgr.SetViewClipping (theMgr.ViewClipping(), theObject->ClipPlanes());
|
aMgr.SetViewClipping (theMgr.ViewClipping(), theObject->ClipPlanes(), &theMgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theMgr.ViewClipping().IsNull() &&
|
if (!theMgr.ViewClipping().IsNull() &&
|
||||||
|
@ -63,7 +63,7 @@ void SelectMgr_ViewerSelector3d::Pick (const Standard_Integer theXPix,
|
|||||||
gp_Pnt2d aMousePos (static_cast<Standard_Real> (theXPix),
|
gp_Pnt2d aMousePos (static_cast<Standard_Real> (theXPix),
|
||||||
static_cast<Standard_Real> (theYPix));
|
static_cast<Standard_Real> (theYPix));
|
||||||
mySelectingVolumeMgr.BuildSelectingVolume (aMousePos);
|
mySelectingVolumeMgr.BuildSelectingVolume (aMousePos);
|
||||||
mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)());
|
mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)(), NULL);
|
||||||
|
|
||||||
TraverseSensitives();
|
TraverseSensitives();
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ void SelectMgr_ViewerSelector3d::Pick (const Standard_Integer theXPMin,
|
|||||||
mySelectingVolumeMgr.BuildSelectingVolume (aMinMousePos,
|
mySelectingVolumeMgr.BuildSelectingVolume (aMinMousePos,
|
||||||
aMaxMousePos);
|
aMaxMousePos);
|
||||||
|
|
||||||
mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)());
|
mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)(), NULL);
|
||||||
|
|
||||||
TraverseSensitives();
|
TraverseSensitives();
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ void SelectMgr_ViewerSelector3d::Pick (const TColgp_Array1OfPnt2d& thePolyline,
|
|||||||
mySelectingVolumeMgr.SetWindowSize (aWidth, aHeight);
|
mySelectingVolumeMgr.SetWindowSize (aWidth, aHeight);
|
||||||
mySelectingVolumeMgr.BuildSelectingVolume (thePolyline);
|
mySelectingVolumeMgr.BuildSelectingVolume (thePolyline);
|
||||||
|
|
||||||
mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)());
|
mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)(), NULL);
|
||||||
|
|
||||||
TraverseSensitives();
|
TraverseSensitives();
|
||||||
}
|
}
|
||||||
|
26
tests/bugs/vis/bug31650
Normal file
26
tests/bugs/vis/bug31650
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user