mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0031579: Visualization - OpenGl_CappingAlgo performance on some clipping planes
(cherry picked from commit 61d75276ea924e0fd22de0a2a927bce1d554de99)
This commit is contained in:
@@ -177,6 +177,36 @@ namespace
|
||||
theWorkspace->SetAllowFaceCulling (wasCullAllowed);
|
||||
}
|
||||
|
||||
bool isGroupClipped (const Handle(Graphic3d_Group)& theGroup, const Handle(OpenGl_Context)& theContext)
|
||||
{
|
||||
const Graphic3d_BndBox4f& aBoxF = theGroup->BoundingBox();
|
||||
Graphic3d_BndBox3d aBBox = Graphic3d_BndBox3d (Graphic3d_Vec3d ((Standard_Real )aBoxF.CornerMin().x(),
|
||||
(Standard_Real )aBoxF.CornerMin().y(),
|
||||
(Standard_Real )aBoxF.CornerMin().z()),
|
||||
Graphic3d_Vec3d ((Standard_Real )aBoxF.CornerMax().x(),
|
||||
(Standard_Real )aBoxF.CornerMax().y(),
|
||||
(Standard_Real )aBoxF.CornerMax().z()));
|
||||
|
||||
Standard_Boolean isClipped = false;
|
||||
for (OpenGl_ClippingIterator aPlaneIt (theContext->Clipping()); aPlaneIt.More(); aPlaneIt.Next())
|
||||
{
|
||||
const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value();
|
||||
if (!aPlane->IsOn())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Graphic3d_ClipState aBoxState = aPlane->ProbeBox (aBBox);
|
||||
if (aBoxState == Graphic3d_ClipState_Out)
|
||||
{
|
||||
isClipped = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isClipped;
|
||||
}
|
||||
|
||||
|
||||
//! Render capping for specific structure.
|
||||
static void renderCappingForStructure (StencilTestSentry& theStencilSentry,
|
||||
const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
@@ -207,6 +237,11 @@ namespace
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isGroupClipped (aGroupIter.Value(), aContext))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// clear stencil only if something has been actually drawn
|
||||
theStencilSentry.Init();
|
||||
|
||||
|
Reference in New Issue
Block a user