1 // Created on: 2011-08-01
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <OpenGl_CappingAlgo.hxx>
17 #include <OpenGl_Context.hxx>
18 #include <OpenGl_GlCore11.hxx>
19 #include <OpenGl_ClippingIterator.hxx>
20 #include <OpenGl_GraphicDriver.hxx>
21 #include <OpenGl_ShaderManager.hxx>
22 #include <OpenGl_ShaderProgram.hxx>
23 #include <OpenGl_StructureShadow.hxx>
24 #include <OpenGl_Vec.hxx>
25 #include <OpenGl_View.hxx>
26 #include <OpenGl_Workspace.hxx>
28 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Structure,Graphic3d_CStructure)
30 // =======================================================================
31 // function : renderBoundingBox
33 // =======================================================================
34 void OpenGl_Structure::renderBoundingBox (const Handle(OpenGl_Workspace)& theWorkspace) const
36 if (!myBndBox.IsValid())
41 const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
42 const Handle(OpenGl_TextureSet) aPrevTexture = aCtx->BindTextures (Handle(OpenGl_TextureSet)(), Handle(OpenGl_ShaderProgram)());
43 const Graphic3d_ZLayerSettings& aLayer = myGraphicDriver->ZLayerSettings (myZLayer);
44 const Graphic3d_Vec3d aMoveVec = myTrsfPers.IsNull()
45 && !aLayer.OriginTransformation().IsNull()
46 ? -Graphic3d_Vec3d (aLayer.Origin().X(), aLayer.Origin().Y(), aLayer.Origin().Z())
47 : Graphic3d_Vec3d (0.0, 0.0, 0.0);
48 if (aCtx->core20fwd != NULL
49 && aCtx->ShaderManager()->BindBoundBoxProgram())
51 const Graphic3d_Vec3d aCenter = myBndBox.Center() + aMoveVec;
52 const Graphic3d_Vec3d aSize = myBndBox.Size();
53 aCtx->ActiveProgram()->SetUniform (aCtx, "occBBoxCenter", Graphic3d_Vec3 ((float )aCenter.x(), (float )aCenter.y(), (float )aCenter.z()));
54 aCtx->ActiveProgram()->SetUniform (aCtx, "occBBoxSize", Graphic3d_Vec3 ((float )aSize.x(), (float )aSize.y(), (float )aSize.z()));
55 aCtx->SetColor4fv (theWorkspace->InteriorColor());
57 const Handle(OpenGl_VertexBuffer)& aBoundBoxVertBuffer = aCtx->ShaderManager()->BoundBoxVertBuffer();
58 aBoundBoxVertBuffer->BindAttribute (aCtx, Graphic3d_TOA_POS);
59 aCtx->core20fwd->glDrawArrays (GL_LINES, 0, aBoundBoxVertBuffer->GetElemsNb());
60 aBoundBoxVertBuffer->UnbindAttribute(aCtx, Graphic3d_TOA_POS);
62 #if !defined(GL_ES_VERSION_2_0)
63 else if (aCtx->core11ffp != NULL)
65 const Graphic3d_Vec3d aMind = myBndBox.CornerMin() + aMoveVec;
66 const Graphic3d_Vec3d aMaxd = myBndBox.CornerMax() + aMoveVec;
67 const Graphic3d_Vec3 aMin ((float )aMind.x(), (float )aMind.y(), (float )aMind.z());
68 const Graphic3d_Vec3 aMax ((float )aMaxd.x(), (float )aMaxd.y(), (float )aMaxd.z());
69 const OpenGl_Vec3 aVerts[16] =
71 OpenGl_Vec3 (aMin.x(), aMin.y(), aMin.z()),
72 OpenGl_Vec3 (aMin.x(), aMin.y(), aMax.z()),
73 OpenGl_Vec3 (aMin.x(), aMax.y(), aMax.z()),
74 OpenGl_Vec3 (aMin.x(), aMax.y(), aMin.z()),
75 OpenGl_Vec3 (aMin.x(), aMin.y(), aMin.z()),
76 OpenGl_Vec3 (aMax.x(), aMin.y(), aMin.z()),
77 OpenGl_Vec3 (aMax.x(), aMin.y(), aMax.z()),
78 OpenGl_Vec3 (aMax.x(), aMax.y(), aMax.z()),
79 OpenGl_Vec3 (aMax.x(), aMax.y(), aMin.z()),
80 OpenGl_Vec3 (aMax.x(), aMin.y(), aMin.z()),
81 OpenGl_Vec3 (aMax.x(), aMax.y(), aMin.z()),
82 OpenGl_Vec3 (aMin.x(), aMax.y(), aMin.z()),
83 OpenGl_Vec3 (aMin.x(), aMax.y(), aMax.z()),
84 OpenGl_Vec3 (aMax.x(), aMax.y(), aMax.z()),
85 OpenGl_Vec3 (aMax.x(), aMin.y(), aMax.z()),
86 OpenGl_Vec3 (aMin.x(), aMin.y(), aMax.z())
89 aCtx->ShaderManager()->BindLineProgram (Handle(OpenGl_TextureSet)(), Aspect_TOL_SOLID, Graphic3d_TOSM_UNLIT, Graphic3d_AlphaMode_Opaque, false, Handle(OpenGl_ShaderProgram)());
90 aCtx->SetColor4fv (theWorkspace->InteriorColor());
91 aCtx->core11fwd->glDisable (GL_LIGHTING);
92 aCtx->core11ffp->glEnableClientState (GL_VERTEX_ARRAY);
93 aCtx->core11ffp->glVertexPointer (3, GL_FLOAT, 0, aVerts[0].GetData());
94 aCtx->core11fwd->glDrawArrays (GL_LINE_STRIP, 0, 16);
95 aCtx->core11ffp->glDisableClientState (GL_VERTEX_ARRAY);
98 aCtx->BindTextures (aPrevTexture, Handle(OpenGl_ShaderProgram)());
101 // =======================================================================
102 // function : OpenGl_Structure
104 // =======================================================================
105 OpenGl_Structure::OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager)
106 : Graphic3d_CStructure (theManager),
107 myInstancedStructure (NULL),
108 myIsRaytracable (Standard_False),
109 myModificationState (0),
110 myIsMirrored (Standard_False)
112 updateLayerTransformation();
115 // =======================================================================
116 // function : ~OpenGl_Structure
118 // =======================================================================
119 OpenGl_Structure::~OpenGl_Structure()
121 Release (Handle(OpenGl_Context)());
124 // =======================================================================
125 // function : SetZLayer
127 // =======================================================================
128 void OpenGl_Structure::SetZLayer (const Graphic3d_ZLayerId theLayerIndex)
130 Graphic3d_CStructure::SetZLayer (theLayerIndex);
131 updateLayerTransformation();
134 // =======================================================================
135 // function : SetTransformation
137 // =======================================================================
138 void OpenGl_Structure::SetTransformation (const Handle(TopLoc_Datum3D)& theTrsf)
141 myIsMirrored = Standard_False;
142 if (!myTrsf.IsNull())
144 // Determinant of transform matrix less then 0 means that mirror transform applied.
145 const gp_Trsf& aTrsf = myTrsf->Transformation();
146 const Standard_Real aDet = aTrsf.Value(1, 1) * (aTrsf.Value (2, 2) * aTrsf.Value (3, 3) - aTrsf.Value (3, 2) * aTrsf.Value (2, 3))
147 - aTrsf.Value(1, 2) * (aTrsf.Value (2, 1) * aTrsf.Value (3, 3) - aTrsf.Value (3, 1) * aTrsf.Value (2, 3))
148 + aTrsf.Value(1, 3) * (aTrsf.Value (2, 1) * aTrsf.Value (3, 2) - aTrsf.Value (3, 1) * aTrsf.Value (2, 2));
149 myIsMirrored = aDet < 0.0;
152 updateLayerTransformation();
155 ++myModificationState;
159 // =======================================================================
160 // function : SetTransformPersistence
162 // =======================================================================
163 void OpenGl_Structure::SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
165 if ((myTrsfPers.IsNull() || theTrsfPers.IsNull()) && myTrsfPers != theTrsfPers)
167 ++myModificationState;
169 myTrsfPers = theTrsfPers;
170 updateLayerTransformation();
173 // =======================================================================
174 // function : updateLayerTransformation
176 // =======================================================================
177 void OpenGl_Structure::updateLayerTransformation()
180 if (!myTrsf.IsNull())
182 aRenderTrsf = myTrsf->Trsf();
185 const Graphic3d_ZLayerSettings& aLayer = myGraphicDriver->ZLayerSettings (myZLayer);
186 if (!aLayer.OriginTransformation().IsNull()
187 && myTrsfPers.IsNull())
189 aRenderTrsf.SetTranslationPart (aRenderTrsf.TranslationPart() - aLayer.Origin());
191 aRenderTrsf.GetMat4 (myRenderTrsf);
194 // =======================================================================
195 // function : GraphicHighlight
197 // =======================================================================
198 void OpenGl_Structure::GraphicHighlight (const Handle(Graphic3d_PresentationAttributes)& theStyle)
200 myHighlightStyle = theStyle;
204 // =======================================================================
205 // function : GraphicUnhighlight
207 // =======================================================================
208 void OpenGl_Structure::GraphicUnhighlight()
211 myHighlightStyle.Nullify();
214 // =======================================================================
215 // function : OnVisibilityChanged
217 // =======================================================================
218 void OpenGl_Structure::OnVisibilityChanged()
222 ++myModificationState;
226 // =======================================================================
227 // function : IsRaytracable
229 // =======================================================================
230 Standard_Boolean OpenGl_Structure::IsRaytracable() const
232 if (!myGroups.IsEmpty()
234 && myTrsfPers.IsNull())
236 return Standard_True;
239 return myInstancedStructure != NULL
240 && myInstancedStructure->IsRaytracable();
243 // =======================================================================
244 // function : UpdateRaytracableState
246 // =======================================================================
247 void OpenGl_Structure::UpdateStateIfRaytracable (const Standard_Boolean toCheck) const
249 myIsRaytracable = !toCheck;
250 if (!myIsRaytracable)
252 for (OpenGl_Structure::GroupIterator anIter (myGroups); anIter.More(); anIter.Next())
254 if (anIter.Value()->IsRaytracable())
256 myIsRaytracable = Standard_True;
264 ++myModificationState;
268 // =======================================================================
269 // function : Connect
271 // =======================================================================
272 void OpenGl_Structure::Connect (Graphic3d_CStructure& theStructure)
274 OpenGl_Structure* aStruct = static_cast<OpenGl_Structure*> (&theStructure);
276 Standard_ASSERT_RAISE (myInstancedStructure == NULL || myInstancedStructure == aStruct,
277 "Error! Instanced structure is already defined");
279 myInstancedStructure = aStruct;
281 if (aStruct->IsRaytracable())
283 UpdateStateIfRaytracable (Standard_False);
287 // =======================================================================
288 // function : Disconnect
290 // =======================================================================
291 void OpenGl_Structure::Disconnect (Graphic3d_CStructure& theStructure)
293 OpenGl_Structure* aStruct = static_cast<OpenGl_Structure*> (&theStructure);
295 if (myInstancedStructure == aStruct)
297 myInstancedStructure = NULL;
299 if (aStruct->IsRaytracable())
301 UpdateStateIfRaytracable();
306 // =======================================================================
307 // function : NewGroup
309 // =======================================================================
310 Handle(Graphic3d_Group) OpenGl_Structure::NewGroup (const Handle(Graphic3d_Structure)& theStruct)
312 Handle(OpenGl_Group) aGroup = new OpenGl_Group (theStruct);
313 myGroups.Append (aGroup);
317 // =======================================================================
318 // function : RemoveGroup
320 // =======================================================================
321 void OpenGl_Structure::RemoveGroup (const Handle(Graphic3d_Group)& theGroup)
323 if (theGroup.IsNull())
328 for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
330 // Check for the given group
331 if (aGroupIter.Value() == theGroup)
333 const Standard_Boolean wasRaytracable =
334 static_cast<const OpenGl_Group&> (*theGroup).IsRaytracable();
336 theGroup->Clear (Standard_False);
340 UpdateStateIfRaytracable();
343 myGroups.Remove (aGroupIter);
349 // =======================================================================
352 // =======================================================================
353 void OpenGl_Structure::Clear()
355 Clear (GlDriver()->GetSharedContext());
358 // =======================================================================
361 // =======================================================================
362 void OpenGl_Structure::Clear (const Handle(OpenGl_Context)& theGlCtx)
364 Standard_Boolean aRaytracableGroupDeleted (Standard_False);
367 for (OpenGl_Structure::GroupIterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
369 aRaytracableGroupDeleted |= aGroupIter.Value()->IsRaytracable();
372 aGroupIter.ChangeValue()->Release (theGlCtx);
376 if (aRaytracableGroupDeleted)
378 myIsRaytracable = Standard_False;
381 Is2dText = Standard_False;
382 IsForHighlight = Standard_False;
385 // =======================================================================
386 // function : renderGeometry
388 // =======================================================================
389 void OpenGl_Structure::renderGeometry (const Handle(OpenGl_Workspace)& theWorkspace,
390 bool& theHasClosed) const
392 if (myInstancedStructure != NULL)
394 myInstancedStructure->renderGeometry (theWorkspace, theHasClosed);
397 bool anOldCastShadows = false;
398 const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
399 for (OpenGl_Structure::GroupIterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
401 const OpenGl_Group* aGroup = aGroupIter.Value();
403 const Handle(Graphic3d_TransformPers)& aTrsfPers = aGroup->TransformPersistence();
404 if (!aTrsfPers.IsNull())
406 applyPersistence (aCtx, aTrsfPers, true, anOldCastShadows);
407 aCtx->ApplyModelViewMatrix();
410 theHasClosed = theHasClosed || aGroup->IsClosed();
411 aGroup->Render (theWorkspace);
413 if (!aTrsfPers.IsNull())
415 revertPersistence (aCtx, aTrsfPers, true, anOldCastShadows);
416 aCtx->ApplyModelViewMatrix();
421 // =======================================================================
424 // =======================================================================
425 void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) const
427 // Process the structure only if visible
433 const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
435 // Render named status
436 if (highlight && !myHighlightStyle.IsNull() && myHighlightStyle->Method() != Aspect_TOHM_BOUNDBOX)
438 theWorkspace->SetHighlightStyle (myHighlightStyle);
441 // Apply local transformation
442 aCtx->ModelWorldState.Push();
443 OpenGl_Mat4& aModelWorld = aCtx->ModelWorldState.ChangeCurrent();
444 aModelWorld = myRenderTrsf;
446 const Standard_Boolean anOldGlNormalize = aCtx->IsGlNormalizeEnabled();
447 #if !defined(GL_ES_VERSION_2_0)
448 // detect scale transform
449 if (aCtx->core11ffp != NULL
452 const Standard_Real aScale = myTrsf->Trsf().ScaleFactor();
453 if (Abs (aScale - 1.0) > Precision::Confusion())
455 aCtx->SetGlNormalizeEnabled (Standard_True);
460 bool anOldCastShadows = false;
461 #ifdef GL_DEPTH_CLAMP
462 bool toRestoreDepthClamp = false;
464 if (!myTrsfPers.IsNull())
466 applyPersistence (aCtx, myTrsfPers, false, anOldCastShadows);
468 #ifdef GL_DEPTH_CLAMP
469 if (myTrsfPers->Mode() == Graphic3d_TMF_CameraPers
470 && aCtx->arbDepthClamp)
472 toRestoreDepthClamp = true;
473 aCtx->core11fwd->glEnable (GL_DEPTH_CLAMP);
478 // Take into account transform persistence
479 aCtx->ApplyModelViewMatrix();
482 const OpenGl_Aspects* aPrevAspectFace = theWorkspace->Aspects();
484 // Apply correction for mirror transform
487 aCtx->core11fwd->glFrontFace (GL_CW);
490 // Collect clipping planes of structure scope
491 aCtx->ChangeClipping().SetLocalPlanes (myClipPlanes);
493 // True if structure is fully clipped
494 bool isClipped = false;
495 bool hasDisabled = false;
496 if (aCtx->Clipping().IsClippingOrCappingOn())
498 const Graphic3d_BndBox3d& aBBox = BoundingBox();
499 if (!myClipPlanes.IsNull()
500 && myClipPlanes->ToOverrideGlobal())
502 aCtx->ChangeClipping().DisableGlobal();
503 hasDisabled = aCtx->Clipping().HasDisabled();
505 else if (!myTrsfPers.IsNull())
507 if (myTrsfPers->IsZoomOrRotate())
509 // Zoom/rotate persistence object lives in two worlds at the same time.
510 // Global clipping planes can not be trivially applied without being converted
511 // into local space of transformation persistence object.
512 // As more simple alternative - just clip entire object by its anchor point defined in the world space.
513 const gp_Pnt anAnchor = myTrsfPers->AnchorPoint();
514 for (OpenGl_ClippingIterator aPlaneIt (aCtx->Clipping()); aPlaneIt.More() && aPlaneIt.IsGlobal(); aPlaneIt.Next())
516 const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value();
522 // check for clipping
523 const Graphic3d_Vec4d aCheckPnt (anAnchor.X(), anAnchor.Y(), anAnchor.Z(), 1.0);
524 if (aPlane->ProbePoint (aCheckPnt) == Graphic3d_ClipState_Out)
532 aCtx->ChangeClipping().DisableGlobal();
533 hasDisabled = aCtx->Clipping().HasDisabled();
536 // Set of clipping planes that do not intersect the structure,
537 // and thus can be disabled to improve rendering performance
539 && myTrsfPers.IsNull())
541 for (OpenGl_ClippingIterator aPlaneIt (aCtx->Clipping()); aPlaneIt.More(); aPlaneIt.Next())
543 const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value();
544 if (aPlaneIt.IsDisabled())
549 const Graphic3d_ClipState aBoxState = aPlane->ProbeBox (aBBox);
550 if (aBoxState == Graphic3d_ClipState_In)
552 aCtx->ChangeClipping().SetEnabled (aPlaneIt, false);
555 else if (aBoxState == Graphic3d_ClipState_Out && myBndBoxClipCheck)
563 if ((!myClipPlanes.IsNull() && !myClipPlanes->IsEmpty())
566 // Set OCCT state uniform variables
567 aCtx->ShaderManager()->UpdateClippingState();
572 bool hasClosedPrims = false;
575 renderGeometry (theWorkspace, hasClosedPrims);
578 // Reset correction for mirror transform
581 aCtx->core11fwd->glFrontFace (GL_CCW);
584 // Render capping for structure groups
586 && aCtx->Clipping().IsCappingOn())
588 OpenGl_CappingAlgo::RenderCapping (theWorkspace, *this);
591 // Revert structure clippings
594 // enable planes that were previously disabled
595 aCtx->ChangeClipping().RestoreDisabled();
597 aCtx->ChangeClipping().SetLocalPlanes (Handle(Graphic3d_SequenceOfHClipPlane)());
598 if ((!myClipPlanes.IsNull() && !myClipPlanes->IsEmpty())
601 // Set OCCT state uniform variables
602 aCtx->ShaderManager()->RevertClippingState();
605 // Restore local transformation
606 aCtx->ModelWorldState.Pop();
607 aCtx->SetGlNormalizeEnabled (anOldGlNormalize);
610 theWorkspace->SetAspects (aPrevAspectFace);
612 // Apply highlight box
614 && !myHighlightStyle.IsNull()
615 && myHighlightStyle->Method() == Aspect_TOHM_BOUNDBOX)
617 aCtx->ApplyModelViewMatrix();
618 theWorkspace->SetHighlightStyle (myHighlightStyle);
619 renderBoundingBox (theWorkspace);
622 if (!myTrsfPers.IsNull())
624 revertPersistence (aCtx, myTrsfPers, false, anOldCastShadows);
625 #ifdef GL_DEPTH_CLAMP
626 if (toRestoreDepthClamp) { aCtx->core11fwd->glDisable (GL_DEPTH_CLAMP); }
630 // Restore named status
631 theWorkspace->SetHighlightStyle (Handle(Graphic3d_PresentationAttributes)());
634 // =======================================================================
635 // function : Release
637 // =======================================================================
638 void OpenGl_Structure::Release (const Handle(OpenGl_Context)& theGlCtx)
642 myHighlightStyle.Nullify();
645 // =======================================================================
646 // function : ReleaseGlResources
648 // =======================================================================
649 void OpenGl_Structure::ReleaseGlResources (const Handle(OpenGl_Context)& theGlCtx)
651 for (OpenGl_Structure::GroupIterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
653 aGroupIter.ChangeValue()->Release (theGlCtx);
657 //=======================================================================
658 //function : ShadowLink
660 //=======================================================================
661 Handle(Graphic3d_CStructure) OpenGl_Structure::ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const
663 return new OpenGl_StructureShadow (theManager, this);
666 // =======================================================================
667 // function : applyPersistence
669 // =======================================================================
670 void OpenGl_Structure::applyPersistence (const Handle(OpenGl_Context)& theCtx,
671 const Handle(Graphic3d_TransformPers)& theTrsfPers,
672 const Standard_Boolean theIsLocal,
673 Standard_Boolean& theOldCastShadows) const
675 // temporarily disable shadows on non-3d objects
676 theOldCastShadows = theCtx->ShaderManager()->SetCastShadows (false);
678 theCtx->WorldViewState.Push();
679 OpenGl_Mat4& aWorldView = theCtx->WorldViewState.ChangeCurrent();
682 && theTrsfPers->IsZoomOrRotate())
684 // move anchor point to presentation location
685 theCtx->ModelWorldState.Push();
686 OpenGl_Mat4& aModelWorld = theCtx->ModelWorldState.ChangeCurrent();
687 gp_Pnt aStartPnt = theTrsfPers->AnchorPoint();
688 Graphic3d_Vec4 anAnchorPoint = aModelWorld * Graphic3d_Vec4 ((Standard_ShortReal)aStartPnt.X(),
689 (Standard_ShortReal)aStartPnt.Y(),
690 (Standard_ShortReal)aStartPnt.Z(), 1.0f);
691 aModelWorld.SetColumn (3, Graphic3d_Vec4 (Graphic3d_Vec3 (0.0), 1.0)); // reset translation part
692 aStartPnt.SetCoord (anAnchorPoint.x(), anAnchorPoint.y(), anAnchorPoint.z());
694 theTrsfPers->Apply (theCtx->Camera(),
695 theCtx->ProjectionState.Current(), aWorldView,
696 theCtx->VirtualViewport()[2], theCtx->VirtualViewport()[3],
701 theTrsfPers->Apply (theCtx->Camera(),
702 theCtx->ProjectionState.Current(), aWorldView,
703 theCtx->VirtualViewport()[2], theCtx->VirtualViewport()[3]);
706 #if !defined(GL_ES_VERSION_2_0)
707 if (!theCtx->IsGlNormalizeEnabled()
708 && theCtx->core11ffp != NULL)
710 const Standard_Real aScale = Graphic3d_TransformUtils::ScaleFactor (aWorldView);
711 if (Abs (aScale - 1.0) > Precision::Confusion())
713 theCtx->SetGlNormalizeEnabled (true);
719 // =======================================================================
720 // function : revertPersistence
722 // =======================================================================
723 void OpenGl_Structure::revertPersistence (const Handle(OpenGl_Context)& theCtx,
724 const Handle(Graphic3d_TransformPers)& theTrsfPers,
725 const Standard_Boolean theIsLocal,
726 const Standard_Boolean theOldCastShadows) const
729 && theTrsfPers->IsZoomOrRotate())
731 theCtx->ModelWorldState.Pop();
733 theCtx->WorldViewState.Pop();
734 theCtx->ShaderManager()->SetCastShadows (theOldCastShadows);
737 //=======================================================================
738 //function : DumpJson
740 //=======================================================================
741 void OpenGl_Structure::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
743 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
745 OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Graphic3d_CStructure)
747 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myInstancedStructure)
749 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsRaytracable)
750 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myModificationState)
751 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsMirrored)