1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +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:
kgv
2016-09-14 13:44:47 +03:00
committed by bugmaster
parent ef444297f5
commit 3202bf1e9e
27 changed files with 691 additions and 606 deletions

View File

@@ -767,30 +767,21 @@ void OpenGl_ShaderManager::PushClippingState (const Handle(OpenGl_ShaderProgram)
return;
}
GLint aPlanesNb = 0;
for (Graphic3d_SequenceOfHClipPlane::Iterator anIter (myContext->Clipping().Planes());
anIter.More(); anIter.Next())
{
const Handle(Graphic3d_ClipPlane)& aPlane = anIter.Value();
if (!myContext->Clipping().IsEnabled (aPlane))
{
continue;
}
++aPlanesNb;
}
if (aPlanesNb < 1)
const GLint aNbPlanes = Min (myContext->Clipping().NbClippingOrCappingOn(), THE_MAX_CLIP_PLANES);
theProgram->SetUniform (myContext,
theProgram->GetStateLocation (OpenGl_OCC_CLIP_PLANE_COUNT),
aNbPlanes);
if (aNbPlanes < 1)
{
return;
}
OpenGl_Vec4 anEquations[THE_MAX_CLIP_PLANES];
GLuint aPlaneId = 0;
for (Graphic3d_SequenceOfHClipPlane::Iterator anIter (myContext->Clipping().Planes());
anIter.More(); anIter.Next())
for (OpenGl_ClippingIterator aPlaneIter (myContext->Clipping()); aPlaneIter.More(); aPlaneIter.Next())
{
const Handle(Graphic3d_ClipPlane)& aPlane = anIter.Value();
if (!myContext->Clipping().IsEnabled (aPlane))
const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIter.Value();
if (aPlaneIter.IsDisabled())
{
continue;
}
@@ -810,9 +801,6 @@ void OpenGl_ShaderManager::PushClippingState (const Handle(OpenGl_ShaderProgram)
++aPlaneId;
}
theProgram->SetUniform (myContext,
theProgram->GetStateLocation (OpenGl_OCC_CLIP_PLANE_COUNT),
aPlanesNb);
theProgram->SetUniform (myContext, aLocEquations, THE_MAX_CLIP_PLANES, anEquations);
}