mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-07-18 04:36:41 +08: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:
@@ -388,61 +388,76 @@ void Visual3d_ViewManager::UnHighlight (const Handle(Graphic3d_Structure)& AStru
|
||||
|
||||
}
|
||||
|
||||
void Visual3d_ViewManager::Redraw () const {
|
||||
void Visual3d_ViewManager::Redraw() const
|
||||
{
|
||||
// redraw all activated views
|
||||
if (MyDefinedView.Extent() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Integer MaxDx, MaxDy;
|
||||
Standard_Integer Dx, Dy;
|
||||
MaxDx = MaxDy = IntegerFirst ();
|
||||
if (!MyUnderLayer.IsNull() || !MyOverLayer.IsNull())
|
||||
{
|
||||
Standard_Integer aWidth = 0, aHeight = 0;
|
||||
Standard_Integer aWidthMax = 0;
|
||||
Standard_Integer aHeightMax = 0;
|
||||
for (Visual3d_SetIteratorOfSetOfView anIter (MyDefinedView);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
anIter.Value()->Window()->Size (aWidth, aHeight);
|
||||
aWidthMax = Max (aWidthMax, aWidth);
|
||||
aHeightMax = Max (aHeightMax, aWidth);
|
||||
}
|
||||
if (!MyUnderLayer.IsNull())
|
||||
{
|
||||
MyUnderLayer->SetViewport (aWidthMax, aHeightMax);
|
||||
}
|
||||
if (!MyOverLayer.IsNull())
|
||||
{
|
||||
MyOverLayer->SetViewport (aWidthMax, aHeightMax);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Redraw all activated views
|
||||
//
|
||||
Standard_Integer j = MyDefinedView.Extent ();
|
||||
if (j == 0) return;
|
||||
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
|
||||
|
||||
if (! MyUnderLayer.IsNull () || ! MyOverLayer.IsNull ()) {
|
||||
while (MyIterator.More ()) {
|
||||
(MyIterator.Value ())->Window ()->Size (Dx, Dy);
|
||||
if (Dx > MaxDx) MaxDx = Dx;
|
||||
if (Dy > MaxDy) MaxDy = Dy;
|
||||
|
||||
// MyIterator.Next () is located on the next view
|
||||
MyIterator.Next ();
|
||||
}
|
||||
if (! MyUnderLayer.IsNull ())
|
||||
MyUnderLayer->SetViewport (MaxDx, MaxDy);
|
||||
if (! MyOverLayer.IsNull ())
|
||||
MyOverLayer->SetViewport (MaxDx, MaxDy);
|
||||
for (Visual3d_SetIteratorOfSetOfView anIter (MyDefinedView);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
anIter.Value()->Redraw (MyUnderLayer, MyOverLayer);
|
||||
}
|
||||
|
||||
if (! MyUnderLayer.IsNull () || ! MyOverLayer.IsNull ())
|
||||
MyIterator.Initialize (MyDefinedView);
|
||||
while (MyIterator.More ()) {
|
||||
(MyIterator.Value ())->Redraw (MyUnderLayer, MyOverLayer);
|
||||
|
||||
// MyIterator.Next () is located on the next view
|
||||
MyIterator.Next ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Visual3d_ViewManager::Update () const {
|
||||
void Visual3d_ViewManager::Update() const
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
//
|
||||
// Update all activated views
|
||||
//
|
||||
Standard_Integer j = MyDefinedView.Extent ();
|
||||
if (j == 0) return;
|
||||
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
|
||||
void Visual3d_ViewManager::RedrawImmediate() const
|
||||
{
|
||||
if (MyDefinedView.Extent() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
while (MyIterator.More ()) {
|
||||
(MyIterator.Value ())->Update (MyUnderLayer, MyOverLayer);
|
||||
// update all activated views
|
||||
for (Visual3d_SetIteratorOfSetOfView anIter (MyDefinedView);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
anIter.Value()->RedrawImmediate (MyUnderLayer, MyOverLayer);
|
||||
}
|
||||
}
|
||||
|
||||
// MyIterator.Next () is located on the next view
|
||||
MyIterator.Next ();
|
||||
}
|
||||
void Visual3d_ViewManager::Invalidate() const
|
||||
{
|
||||
if (MyDefinedView.Extent() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// update all activated views
|
||||
for (Visual3d_SetIteratorOfSetOfView anIter (MyDefinedView);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
anIter.Value()->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Visual3d_HSetOfView) Visual3d_ViewManager::ActivatedView () const {
|
||||
|
||||
Reference in New Issue
Block a user