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

0026641: Visualization, TKOpenGl - handle correctly transformation persistence within perspective projection.

Add a new method AIS_InteractiveContext::SetTransformPersistence, which sets transform persistence to object and selection.
Add a new method SelectMgr_SelectionManager::UpdateSelection, which re-adds selectable object in BVHs in all viewer selectors.
Add a new method SelectMgr_ViewerSelector::MoveSelectableObject, which moves object from set of not transform persistence objects to set of transform persistence objects (or vice versa).
Add a new method Graphic3d_TransformUtils::Convert, which converts gp_Trsf to Graphic3d_Mat4.
Remove the method PrsMgr_PresentableObject::SetTransformPersistence(flag, point).
This commit is contained in:
isk
2016-07-05 13:32:52 +03:00
committed by bugmaster
parent fbad941bd4
commit 1d92133e83
20 changed files with 254 additions and 77 deletions

View File

@@ -474,6 +474,20 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
aCtx->ModelWorldState.Push();
aCtx->ModelWorldState.SetCurrent (Transformation);
const Standard_Boolean anOldGlNormalize = aCtx->IsGlNormalizeEnabled();
#if !defined(GL_ES_VERSION_2_0)
// detect scale transform
if (aCtx->core11 != NULL)
{
const Standard_ShortReal aScaleX = Transformation.GetRow (0).xyz().SquareModulus();
if (Abs (aScaleX - 1.f) > Precision::Confusion())
{
aCtx->SetGlNormalizeEnabled (Standard_True);
}
}
#endif
if (TransformPersistence.Flags)
{
OpenGl_Mat4 aProjection = aCtx->ProjectionState.Current();
@@ -485,14 +499,18 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
aCtx->ProjectionState.SetCurrent (aProjection);
aCtx->WorldViewState.SetCurrent (aWorldView);
aCtx->ApplyProjectionMatrix();
}
// detect scale transform
const Standard_Boolean anOldGlNormalize = aCtx->IsGlNormalizeEnabled();
const Standard_ShortReal aScaleX = aCtx->ModelWorldState.Current().GetRow (0).xyz().SquareModulus();
if (Abs (aScaleX - 1.f) > Precision::Confusion())
{
aCtx->SetGlNormalizeEnabled (Standard_True);
#if !defined(GL_ES_VERSION_2_0)
if (!aCtx->IsGlNormalizeEnabled()
&& aCtx->core11 != NULL)
{
const Standard_Real aScale = Graphic3d_TransformUtils::ScaleFactor<Standard_ShortReal> (aWorldView);
if (Abs (aScale - 1.0f) > Precision::Confusion())
{
aCtx->SetGlNormalizeEnabled (Standard_True);
}
}
#endif
}
// Take into account transform persistence