mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0027816: Visualization - provide an API for overriding clipping planes list
Graphic3d_SequenceOfHClipPlane now inherits Standard_Transient. PrsMgr_PresentableObject, Graphic3d_Structure, Graphic3d_CStructure, V3d_View, OpenGl_View now manages the plane list by Handle. The getters ::GetClipPlanes() has been removed, setters taking non-handle ::SetClipPlanes() has been marked deprecated. OpenGl_Structure::Render() and SelectMgr_ViewerSelector::checkOverlap() now disable global (view) clipping planes for objects with flags Graphic3d_TMF_TriedronPers and Graphic3d_TMF_2d or with new flag Graphic3d_SequenceOfHClipPlane::ToOverrideGlobal(). OpenGl_Clipping now implements interface for managing clipping planes without copying the sequences. The filtering of duplicates is no more performed by OpenGl_Clipping - application is responsible to not do this. OpenGl_Clipping tries avoiding unnecessary allocations for managing list of active planes. MFC sample has been updated to use V3d_View::ClipPlanes() method.
This commit is contained in:
@@ -1087,25 +1087,10 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
|
||||
const Handle(OpenGl_Context)& aContext = myWorkspace->GetGlContext();
|
||||
|
||||
// Specify clipping planes in view transformation space
|
||||
aContext->ChangeClipping().RemoveAll (aContext);
|
||||
if (!myClipPlanes.IsEmpty())
|
||||
aContext->ChangeClipping().Reset (aContext, myClipPlanes);
|
||||
if (!myClipPlanes.IsNull()
|
||||
&& !myClipPlanes->IsEmpty())
|
||||
{
|
||||
Graphic3d_SequenceOfHClipPlane aUserPlanes;
|
||||
Graphic3d_SequenceOfHClipPlane::Iterator aClippingIt (myClipPlanes);
|
||||
for (; aClippingIt.More(); aClippingIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_ClipPlane)& aClipPlane = aClippingIt.Value();
|
||||
if (aClipPlane->IsOn())
|
||||
{
|
||||
aUserPlanes.Append (aClipPlane);
|
||||
}
|
||||
}
|
||||
|
||||
if (!aUserPlanes.IsEmpty())
|
||||
{
|
||||
aContext->ChangeClipping().AddWorld (aContext, aUserPlanes);
|
||||
}
|
||||
|
||||
aContext->ShaderManager()->UpdateClippingState();
|
||||
}
|
||||
|
||||
@@ -1193,8 +1178,9 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
|
||||
// Apply restored view matrix.
|
||||
aContext->ApplyWorldViewMatrix();
|
||||
|
||||
aContext->ChangeClipping().RemoveAll (aContext);
|
||||
if (!myClipPlanes.IsEmpty())
|
||||
aContext->ChangeClipping().Reset (aContext, Handle(Graphic3d_SequenceOfHClipPlane)());
|
||||
if (!myClipPlanes.IsNull()
|
||||
&& !myClipPlanes->IsEmpty())
|
||||
{
|
||||
aContext->ShaderManager()->RevertClippingState();
|
||||
}
|
||||
|
Reference in New Issue
Block a user