1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0031652: Visualization - crash on highlighting HLR Computed presentation displayed with Shaded display mode

PrsMgr_PresentationManager::displayImmediate() now uses proper ZLayer for a shadow presentation
of computed presentation (fixes dynamic highlighting on mouse move).
Graphic3d_CView::SetComputedMode() - added invalidation of bounding box on turning OFF compute mode.
AIS_ViewController::contextLazyMoveTo() now ignores MoveTo() while rotating
view with temporary disabled compute mode (leading to undefined results and crashes).

Graphic3d_Structure::Graphic3d_Structure() - do not copy Graphic3d_TOS_COMPUTED visual
from linked structure, as Graphic3d_CView::SetComputedMode() does not compute such structures.
This commit is contained in:
kgv 2020-07-04 23:37:04 +03:00 committed by bugmaster
parent 72e9e86732
commit 6d1d35e4b8
5 changed files with 41 additions and 5 deletions

View File

@ -2688,7 +2688,8 @@ void AIS_ViewController::contextLazyMoveTo (const Handle(AIS_InteractiveContext)
const Handle(V3d_View)& theView, const Handle(V3d_View)& theView,
const Graphic3d_Vec2i& thePnt) const Graphic3d_Vec2i& thePnt)
{ {
if (myPrevMoveTo == thePnt) if (myPrevMoveTo == thePnt
|| myHasHlrOnBeforeRotation) // ignore highlighting in-between rotation of HLR view
{ {
return; return;
} }

View File

@ -189,6 +189,7 @@ void Graphic3d_CView::SetComputedMode (const Standard_Boolean theMode)
const Handle(Graphic3d_Structure)& aStructComp = myStructsComputed.Value (anIndex); const Handle(Graphic3d_Structure)& aStructComp = myStructsComputed.Value (anIndex);
eraseStructure (aStructComp->CStructure()); eraseStructure (aStructComp->CStructure());
displayStructure (aStruct->CStructure(), aStruct->DisplayPriority()); displayStructure (aStruct->CStructure(), aStruct->DisplayPriority());
Update (aStruct->GetZLayer());
} }
} }
return; return;
@ -223,6 +224,10 @@ void Graphic3d_CView::SetComputedMode (const Standard_Boolean theMode)
{ {
Handle(Graphic3d_Structure) aCompStruct; Handle(Graphic3d_Structure) aCompStruct;
aStruct->computeHLR (myCamera, aCompStruct); aStruct->computeHLR (myCamera, aCompStruct);
if (aCompStruct.IsNull())
{
continue;
}
aCompStruct->SetHLRValidation (Standard_True); aCompStruct->SetHLRValidation (Standard_True);
const Standard_Boolean toComputeWireframe = myVisualization == Graphic3d_TOV_WIREFRAME const Standard_Boolean toComputeWireframe = myVisualization == Graphic3d_TOV_WIREFRAME
@ -303,6 +308,11 @@ void Graphic3d_CView::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
Handle(Graphic3d_Structure) aCompStruct = aCompStructOld; Handle(Graphic3d_Structure) aCompStruct = aCompStructOld;
aCompStruct->SetTransformation (Handle(TopLoc_Datum3D)()); aCompStruct->SetTransformation (Handle(TopLoc_Datum3D)());
theStruct->computeHLR (myCamera, aCompStruct); theStruct->computeHLR (myCamera, aCompStruct);
if (aCompStruct.IsNull())
{
return;
}
aCompStruct->SetHLRValidation (Standard_True); aCompStruct->SetHLRValidation (Standard_True);
aCompStruct->CalculateBoundBox(); aCompStruct->CalculateBoundBox();
@ -774,7 +784,10 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure)
aStruct->SetTransformation (Handle(TopLoc_Datum3D)()); aStruct->SetTransformation (Handle(TopLoc_Datum3D)());
} }
theStructure->computeHLR (myCamera, aStruct); theStructure->computeHLR (myCamera, aStruct);
if (aStruct.IsNull())
{
return;
}
aStruct->SetHLRValidation (Standard_True); aStruct->SetHLRValidation (Standard_True);
// TOCOMPUTE and COMPUTED associated to sequences are added // TOCOMPUTE and COMPUTED associated to sequences are added

View File

@ -49,8 +49,11 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
{ {
if (!theLinkPrs.IsNull()) if (!theLinkPrs.IsNull())
{ {
myOwner = theLinkPrs->myOwner; myOwner = theLinkPrs->myOwner;
myVisual = theLinkPrs->myVisual; if (theLinkPrs->myVisual != Graphic3d_TOS_COMPUTED)
{
myVisual = theLinkPrs->myVisual;
}
myComputeVisual = theLinkPrs->myComputeVisual; myComputeVisual = theLinkPrs->myComputeVisual;
myCStructure = theLinkPrs->myCStructure->ShadowLink (theManager); myCStructure = theLinkPrs->myCStructure->ShadowLink (theManager);
} }

View File

@ -368,9 +368,11 @@ void PrsMgr_PresentationManager::displayImmediate (const Handle(V3d_Viewer)& the
Handle(Prs3d_PresentationShadow) aShadowPrs = Handle(Prs3d_PresentationShadow)::DownCast (aPrs); Handle(Prs3d_PresentationShadow) aShadowPrs = Handle(Prs3d_PresentationShadow)::DownCast (aPrs);
if (!aShadowPrs.IsNull() && aView->IsComputed (aShadowPrs->ParentId(), aViewDepPrs)) if (!aShadowPrs.IsNull() && aView->IsComputed (aShadowPrs->ParentId(), aViewDepPrs))
{ {
const Graphic3d_ZLayerId aZLayer = aShadowPrs->GetZLayer();
aShadowPrs.Nullify(); aShadowPrs.Nullify();
aShadowPrs = new Prs3d_PresentationShadow (myStructureManager, aViewDepPrs); aShadowPrs = new Prs3d_PresentationShadow (myStructureManager, aViewDepPrs);
aShadowPrs->SetZLayer (aViewDepPrs->CStructure()->ZLayer()); aShadowPrs->SetZLayer (aZLayer);
aShadowPrs->SetClipPlanes (aViewDepPrs->ClipPlanes()); aShadowPrs->SetClipPlanes (aViewDepPrs->ClipPlanes());
aShadowPrs->CStructure()->IsForHighlight = 1; aShadowPrs->CStructure()->IsForHighlight = 1;
aShadowPrs->Highlight (aPrs->HighlightStyle()); aShadowPrs->Highlight (aPrs->HighlightStyle());

17
tests/bugs/vis/bug31652 Normal file
View File

@ -0,0 +1,17 @@
puts "============"
puts "0031652: Visualization - crash on highlighting HLR Computed presentation displayed with Shaded display mode"
puts "============"
puts ""
pload MODELING VISUALIZATION
psphere s 1
vclear
vinit View1
vdisplay -dispMode 1 s
vaxo
vfit
vhlr on -algoType polyAlgo
vmoveto 351 64
vdump ${imagedir}/${casename}.png