1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0024224: Suspicious logics in changing clipping planes at OpenGl_Structure

1) Resolved buggy situation of shared clip planes between view and structure;
2) Added clipping plane equation space identification - to be used with shaders;
3) Code refactoring to resolve performance issue reported by 0024189;
4) Attachment of stencil buffer to FBO.

Added test case bugs/vis/bug24224
This commit is contained in:
apl
2013-10-10 17:14:52 +04:00
committed by bugmaster
parent cbf1862449
commit b859a34d22
14 changed files with 461 additions and 247 deletions

View File

@@ -989,42 +989,67 @@ D = -[Px,Py,Pz] dot |Nx|
// Apply clipping planes
{
if ( myZClip.Back.IsOn || myZClip.Front.IsOn )
{
Graphic3d_SetOfHClipPlane aZClipping;
const Handle(OpenGl_Context)& aContext = AWorkspace->GetGlContext();
if (myZClip.Back.IsOn || myZClip.Front.IsOn)
{
const GLdouble ramp = myExtra.map.fpd - myExtra.map.bpd;
if ( myZClip.Back.IsOn )
Handle(Graphic3d_ClipPlane) aPlaneBack;
Handle(Graphic3d_ClipPlane) aPlaneFront;
if (myZClip.Back.IsOn)
{
const GLdouble back = ramp * myZClip.Back.Limit + myExtra.map.bpd;
const Graphic3d_ClipPlane::Equation aBack(0.0, 0.0, 1.0, -back);
aZClipping.Add (new Graphic3d_ClipPlane (aBack));
const Graphic3d_ClipPlane::Equation aBackEquation (0.0, 0.0, 1.0, -back);
aPlaneBack = new Graphic3d_ClipPlane (aBackEquation);
}
if ( myZClip.Front.IsOn )
if (myZClip.Front.IsOn)
{
const GLdouble front = ramp * myZClip.Front.Limit + myExtra.map.bpd;
const Graphic3d_ClipPlane::Equation aFront (0.0, 0.0, -1.0, front);
aZClipping.Add (new Graphic3d_ClipPlane (aFront));
const Graphic3d_ClipPlane::Equation aFrontEquation (0.0, 0.0, -1.0, front);
aPlaneFront = new Graphic3d_ClipPlane (aFrontEquation);
}
aContext->ChangeClipping().Set (aZClipping, &OpenGl_IdentityMatrix);
// do some "memory allocation"-wise optimization
if (!aPlaneBack.IsNull() || !aPlaneFront.IsNull())
{
Graphic3d_SetOfHClipPlane aSlicingPlanes;
if (!aPlaneBack.IsNull())
{
aSlicingPlanes.Add (aPlaneBack);
}
if (!aPlaneFront.IsNull())
{
aSlicingPlanes.Add (aPlaneFront);
}
// add planes at loaded view matrix state
aContext->ChangeClipping().AddView (aSlicingPlanes, AWorkspace);
}
}
// Apply user clipping planes
Graphic3d_SetOfHClipPlane aPlanesOn;
Graphic3d_SetOfHClipPlane::Iterator aPlaneIt (myClipPlanes);
for (; aPlaneIt.More(); aPlaneIt.Next())
if (!myClipPlanes.IsEmpty())
{
const Handle(Graphic3d_ClipPlane)& aUserPln = aPlaneIt.Value();
if (aUserPln->IsOn ())
aPlanesOn.Add (aUserPln);
}
Graphic3d_SetOfHClipPlane aUserPlanes;
Graphic3d_SetOfHClipPlane::Iterator aClippingIt (myClipPlanes);
for (; aClippingIt.More(); aClippingIt.Next())
{
const Handle(Graphic3d_ClipPlane)& aClipPlane = aClippingIt.Value();
if (aClipPlane->IsOn())
{
aUserPlanes.Add (aClipPlane);
}
}
if (aPlanesOn.Size() > 0)
{
aContext->ChangeClipping().Set (aPlanesOn);
if (!aUserPlanes.IsEmpty())
{
// add planes at actual matrix state.
aContext->ChangeClipping().AddWorld (aUserPlanes);
}
}
}
@@ -1111,8 +1136,7 @@ D = -[Px,Py,Pz] dot |Nx|
// and invoking optional callbacks
AWorkspace->ResetAppliedAspect();
// Unset clip planes managed by driver
aContext->ChangeClipping().Unset (aContext->Clipping().Planes());
aContext->ChangeClipping().RemoveAll();
// display global trihedron
if (myTrihedron != NULL)