From: mzernova Date: Wed, 10 Jun 2020 09:18:47 +0000 (+0300) Subject: 0027919: Visualization - support multiple transformation persistence groups within... X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=b0ccd9e21269f26399076c620f46f61712cf821d;p=occt-copy.git 0027919: Visualization - support multiple transformation persistence groups within single presentation added AnchorPoint transformation in accordance with local transformation (cherry picked from commit de18833ce2e8e83d84bdc25e441a4f55f50f3b7f) (cherry picked from commit 88201b5418170634d740fdfe9fa1d5f5775ae97b) (cherry picked from commit e0d6884df321c7d5750ee2c45f96d5e0b4166e01) (cherry picked from commit acd78717b153e7f1e913a411d9278bfdabf2017a) (cherry picked from commit e39441eccd178b578032c1ebd6b3b08ad8724502) (cherry picked from commit 19c38dc1987650795faaa4edce4a853b5c107a20) (cherry picked from commit 0ade81efd00d909f4736ef61b9c6c90dd33e6667) --- diff --git a/src/OpenGl/OpenGl_Structure.cxx b/src/OpenGl/OpenGl_Structure.cxx index 2fc4f91b41..72df9594ad 100644 --- a/src/OpenGl/OpenGl_Structure.cxx +++ b/src/OpenGl/OpenGl_Structure.cxx @@ -392,10 +392,22 @@ void OpenGl_Structure::renderGeometry (const Handle(OpenGl_Workspace)& theWorksp const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); for (OpenGl_Structure::GroupIterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next()) { - Handle(Graphic3d_TransformPers) aTrsfPersistence = aGroupIter.Value()->TransformPersistence(); + const Handle(Graphic3d_TransformPers)& aTrsfPersistence = aGroupIter.Value()->TransformPersistence(); + gp_Pnt aStartPnt; + if (!aTrsfPersistence.IsNull()) { + if (aTrsfPersistence->IsZoomOrRotate()) + { + aCtx->ModelWorldState.Push(); + OpenGl_Mat4& aModelWorld = aCtx->ModelWorldState.ChangeCurrent(); + aStartPnt = aTrsfPersistence->AnchorPoint(); + Graphic3d_Vec4 anAnchorPoint = aModelWorld * Graphic3d_Vec4 (aStartPnt.X(), aStartPnt.Y(), aStartPnt.Z(), 1.0); + aModelWorld.InitIdentity(); + aTrsfPersistence->SetAnchorPoint (gp_Pnt (anAnchorPoint.x(), anAnchorPoint.y(), anAnchorPoint.z())); + } applyPersistence (aCtx, aTrsfPersistence, Standard_True); + aCtx->ApplyModelViewMatrix(); } theHasClosed = theHasClosed || aGroupIter.Value()->IsClosed(); @@ -403,7 +415,13 @@ void OpenGl_Structure::renderGeometry (const Handle(OpenGl_Workspace)& theWorksp if (!aTrsfPersistence.IsNull()) { + if (aTrsfPersistence->IsZoomOrRotate()) + { + aTrsfPersistence->SetAnchorPoint (aStartPnt); + aCtx->ModelWorldState.Pop(); + } applyPersistence (aCtx, aTrsfPersistence, Standard_False); + aCtx->ApplyModelViewMatrix(); } } } @@ -668,6 +686,7 @@ void OpenGl_Structure::applyPersistence (const Handle(OpenGl_Context)& theContex else { theContext->WorldViewState.Pop(); + theContext->ApplyModelViewMatrix(); } }