mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
0024637: Visualization - clean up implementation of rendering in immediate mode
Remove unused flag "DoubleBuf". Remove Visual3d_TransientManager "class" (functionality moved to PrsMgr_PresentationManager). Remove unused "Add" immediate mode. V3d_View class - remove methods ::TransientManagerBeginDraw(), ::TransientManagerClearDraw(), ::TransientManagerBeginAddDraw(). Add method ::RedrawImmediate() to redraw only immediate presentations. OpenGl_GraphicDriver - add methods ::DisplayImmediateStructure(), ::EraseImmediateStructure(), ::RedrawImmediate(). OpenGl_View - manage list of immediate structures. OpenGl_Workspace - automate rendering workflow of immediate + persistent layers. Merge PrsMgr_PresentationManager3d class into PrsMgr_PresentationManager. Mark PrsMgr_PresentationManager3d as alias to PrsMgr_PresentationManager to simplify porting. Prs3d_Presentation - remove unused field myStruct. Prs3d_PresentationShadow - shadow link to existing presentation with custom attributes. Graphic3d_Structure::Highlight() - do not register undisplayed structure in structure manager. AIS_InteractiveContext, AIS_LocalContext add flag to prevent view update into methods ::MoveTo(), ::HilightNextDetected(), ::HilightPreviousDetected() to allow update of customized immediate structures before redraw but after ::MoveTo(). Remove unused method AIS_InteractiveContext::Drag(). StdSelect_ViewerSelector3d do not user immediate mode in methods ::DisplayAreas(), ::ClearAreas(), ::ClearSensitive(), ::DisplaySensitive(), GridEcho - update value in StdSelect_ViewerSelector3d::Pick() instead of V3d_View::Compute(). Do not use global variable for GridEcho vertex. Redraw immediate mode not within GridEcho but at AIS_InteractiveContext, AIS_LocalContext layer. V3d_View::ToPixMap() - disable autoupdate during FitAll. Avoid Redraw() into FBO without ImmediateModeDrawToFront flag. PrsMgr_PresentationManager stores list of temporary immediate presentations, automatically cleared within BeginImmediateMode() call. Methods with ambiguous names have been renamed (new names now consistent with pre-existed method names in AIS_LocalContext class): - BeginDraw -> BeginImmediateDraw - EndDraw -> EndImmediateDraw Remove now useless Remove() method (and ImmediateRemove() in AIS). Visual3d_View now stores map of displayed immediate presentations. ViewerTest_EventManager - eliminate double redraw in selection methods. Fix warning
This commit is contained in:
@@ -116,7 +116,6 @@ To solve the problem (for lack of a better solution) I make 2 passes.
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_DivideByZero.hxx>
|
||||
|
||||
#include <Visual3d_TransientManager.hxx>
|
||||
#include <Visual3d_ViewManager.hxx>
|
||||
#include <Visual3d_Light.hxx>
|
||||
#include <Visual3d_Layer.hxx>
|
||||
@@ -415,6 +414,30 @@ void V3d_View::Redraw() const
|
||||
if( MyView->IsDefined() ) MyView->Redraw() ;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : RedrawImmediate
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void V3d_View::RedrawImmediate() const
|
||||
{
|
||||
if (MyView->IsDefined())
|
||||
{
|
||||
MyView->RedrawImmediate();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Invalidate
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void V3d_View::Invalidate() const
|
||||
{
|
||||
if (MyView->IsDefined())
|
||||
{
|
||||
MyView->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Redraw
|
||||
//purpose :
|
||||
@@ -2974,37 +2997,6 @@ V3d_TypeOfBackfacingModel V3d_View::BackFacingModel() const
|
||||
return V3d_TypeOfBackfacingModel(MyView -> BackFacingModel ());
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : TransientManagerBeginDraw
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
Standard_Boolean V3d_View::TransientManagerBeginDraw(const Standard_Boolean DoubleBuffer,const Standard_Boolean RetainMode) const
|
||||
{
|
||||
return Visual3d_TransientManager::BeginDraw(MyView,DoubleBuffer,RetainMode);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : TransientManagerClearDraw
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void V3d_View::TransientManagerClearDraw() const
|
||||
{
|
||||
Visual3d_TransientManager::ClearDraw(MyView);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : TransientManagerBeginAddDraw
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
Standard_Boolean V3d_View::TransientManagerBeginAddDraw() const
|
||||
{
|
||||
return Visual3d_TransientManager::BeginAddDraw(MyView);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void V3d_View::Init()
|
||||
{
|
||||
myComputedMode = MyViewer->ComputedMode();
|
||||
@@ -3131,7 +3123,14 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
|
||||
}
|
||||
}
|
||||
|
||||
// render immediate structures into back buffer rather than front
|
||||
Handle(Graphic3d_GraphicDriver) aDriver = Handle(Graphic3d_GraphicDriver)::DownCast (MyView->GraphicDriver());
|
||||
const Standard_Boolean aPrevImmediateMode = aDriver.IsNull() ? Standard_True : aDriver->SetImmediateModeDrawToFront (*cView, Standard_False);
|
||||
|
||||
const Standard_Boolean toAutoUpdate = myImmediateUpdate;
|
||||
myImmediateUpdate = Standard_False;
|
||||
AutoZFit();
|
||||
myImmediateUpdate = toAutoUpdate;
|
||||
|
||||
if (theToKeepAspect)
|
||||
{
|
||||
@@ -3144,9 +3143,6 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
|
||||
MyLayerMgr->Compute();
|
||||
}
|
||||
|
||||
// render immediate structures into back buffer rather than front
|
||||
Handle(Graphic3d_GraphicDriver) aDriver = Handle(Graphic3d_GraphicDriver)::DownCast (MyView->GraphicDriver());
|
||||
const Standard_Boolean aPrevImmediateMode = aDriver.IsNull() ? Standard_True : aDriver->SetImmediateModeDrawToFront (*cView, Standard_False);
|
||||
Redraw();
|
||||
|
||||
if (!aDriver.IsNull())
|
||||
|
Reference in New Issue
Block a user