#include <Graphic3d_SequenceOfHClipPlane.hxx>
-IMPLEMENT_STANDARD_HANDLE (OpenGl_Structure, Graphic3d_CStructure)
-IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Structure, Graphic3d_CStructure)
//! Auxiliary class for bounding box presentation
class OpenGl_BndBoxPrs : public OpenGl_Element
OpenGl_Structure::OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager)
: Graphic3d_CStructure (theManager),
myTransformation (NULL),
- myTransPers (NULL),
myAspectLine (NULL),
myAspectFace (NULL),
myAspectMarker (NULL),
{
Release (Handle(OpenGl_Context)());
delete myTransformation; myTransformation = NULL;
- delete myTransPers; myTransPers = NULL;
}
// =======================================================================
// =======================================================================
void OpenGl_Structure::UpdateAspects()
{
- SetTransformPersistence (TransformPersistence);
-
if (ContextLine.IsDef)
SetAspectLine (ContextLine);
}
}
-// =======================================================================
-// function : SetTransformPersistence
-// purpose :
-// =======================================================================
-void OpenGl_Structure::SetTransformPersistence(const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers)
-{
- if (!myTransPers)
- myTransPers = new TEL_TRANSFORM_PERSISTENCE;
-
- myTransPers->mode = ATransPers.Flag;
- myTransPers->pointX = ATransPers.Point.x;
- myTransPers->pointY = ATransPers.Point.y;
- myTransPers->pointZ = ATransPers.Point.z;
- MarkAsNotCulled();
-}
-
// =======================================================================
// function : SetAspectLine
// purpose :
aCtx->SetGlNormalizeEnabled (Standard_True);
}
}
-
- // Apply transform persistence
- const TEL_TRANSFORM_PERSISTENCE *aTransPersistence = NULL;
- if ( myTransPers && myTransPers->mode != 0 )
+ if (TransformPersistence.Flags)
{
- aTransPersistence = theWorkspace->ActiveView()->BeginTransformPersistence (aCtx, myTransPers, theWorkspace->Width(), theWorkspace->Height());
+ OpenGl_Mat4 aProjection = aCtx->ProjectionState.Current();
+ OpenGl_Mat4 aWorldView = aCtx->WorldViewState.Current();
+ TransformPersistence.Apply (aProjection, aWorldView, theWorkspace->Width(), theWorkspace->Height());
+
+ aCtx->ProjectionState.Push();
+ aCtx->WorldViewState.Push();
+ aCtx->ProjectionState.SetCurrent (aProjection);
+ aCtx->WorldViewState.SetCurrent (aWorldView);
+ aCtx->ApplyProjectionMatrix();
}
// Take into account transform persistence
if (!aUserPlanes.IsNull() && !aUserPlanes->IsEmpty())
{
// add planes at loaded view matrix state
- aCtx->ChangeClipping().AddWorld (*aUserPlanes, theWorkspace);
+ aCtx->ChangeClipping().AddWorld (aCtx, *aUserPlanes);
// Set OCCT state uniform variables
if (!aCtx->ShaderManager()->IsEmpty())
// Revert structure clippings
if (!aUserPlanes.IsNull() && !aUserPlanes->IsEmpty())
{
- aCtx->ChangeClipping().Remove (*aUserPlanes);
+ aCtx->ChangeClipping().Remove (aCtx, *aUserPlanes);
// Set OCCT state uniform variables
if (!aCtx->ShaderManager()->IsEmpty())
}
}
- // Apply local transformation
+ // Restore local transformation
if (myTransformation)
{
aCtx->ModelWorldState.Pop();
aCtx->SetGlNormalizeEnabled (anOldGlNormalize);
}
+ if (TransformPersistence.Flags)
+ {
+ aCtx->ProjectionState.Pop();
+ aCtx->WorldViewState.Pop();
+ aCtx->ApplyProjectionMatrix();
+ }
// Restore highlight color
theWorkspace->HighlightColor = aHighlightColor;
theWorkspace->SetAspectMarker (anAspectMarker);
theWorkspace->SetAspectText (anAspectText);
- // Restore transform persistence
- if ( myTransPers && myTransPers->mode != 0 )
- {
- theWorkspace->ActiveView()->BeginTransformPersistence (aCtx, aTransPersistence, theWorkspace->Width(), theWorkspace->Height());
- }
-
// Apply highlight box
if (!myHighlightBox.IsNull())
{