mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0025400: Visualization, TKOpenGl - Structure disappears if assigned a non-default Z layer
- BVH tree in the target Z layer was not updated when OpenGl_Structure was moved to another Z layer. - vpriority DRAW command added to test how BVH tree is updated when display priority is changed - Test case for Z layers and display priorities added Handle -noupdate argument within vpriority command
This commit is contained in:
parent
032d027214
commit
a0c202521d
@ -257,7 +257,9 @@ void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure *theStructure,
|
|||||||
if ((aPriority = aList.Remove (theStructure, Standard_True)) >= 0)
|
if ((aPriority = aList.Remove (theStructure, Standard_True)) >= 0)
|
||||||
{
|
{
|
||||||
myNbStructures--;
|
myNbStructures--;
|
||||||
AddStructure (theStructure, theNewLayerId, aPriority, Standard_True);
|
// isForChangePriority should be Standard_False below, because we want
|
||||||
|
// the BVH tree in the target layer to be updated with theStructure
|
||||||
|
AddStructure (theStructure, theNewLayerId, aPriority);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -273,7 +275,9 @@ void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure *theStructure,
|
|||||||
if ((aPriority = aList.Remove (theStructure, Standard_True)) >= 0)
|
if ((aPriority = aList.Remove (theStructure, Standard_True)) >= 0)
|
||||||
{
|
{
|
||||||
myNbStructures--;
|
myNbStructures--;
|
||||||
AddStructure (theStructure, theNewLayerId, aPriority, Standard_True);
|
// isForChangePriority should be Standard_False below, because we want
|
||||||
|
// the BVH tree in the target layer to be updated with theStructure
|
||||||
|
AddStructure (theStructure, theNewLayerId, aPriority);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5765,6 +5765,81 @@ static Standard_Integer VPointCloud (Draw_Interpretor& theDI,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : VPriority
|
||||||
|
//purpose : Prints or sets the display priority for an object
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
static int VPriority (Draw_Interpretor& theDI,
|
||||||
|
Standard_Integer theArgNum,
|
||||||
|
const char** theArgs)
|
||||||
|
{
|
||||||
|
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
|
||||||
|
ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
|
||||||
|
if (aContext.IsNull())
|
||||||
|
{
|
||||||
|
std::cout << "Error: no view available, call 'vinit' before!" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCollection_AsciiString aLastArg (theArgs[theArgNum - 1]);
|
||||||
|
Standard_Integer aPriority = -1;
|
||||||
|
Standard_Integer aNbArgs = theArgNum;
|
||||||
|
if (aLastArg.IsIntegerValue())
|
||||||
|
{
|
||||||
|
aPriority = aLastArg.IntegerValue();
|
||||||
|
--aNbArgs;
|
||||||
|
if (aPriority < 0 || aPriority > 10)
|
||||||
|
{
|
||||||
|
std::cout << "Error: the specified display priority value '" << aLastArg
|
||||||
|
<< "' is outside the valid range [0..10]" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
anUpdateTool.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aNbArgs < 2)
|
||||||
|
{
|
||||||
|
std::cout << "Error: wrong number of arguments! See usage:\n";
|
||||||
|
theDI.PrintHelp (theArgs[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Standard_Integer anArgIter = 1; anArgIter < aNbArgs; ++anArgIter)
|
||||||
|
{
|
||||||
|
if (anUpdateTool.parseRedrawMode (theArgs[anArgIter]))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCollection_AsciiString aName (theArgs[anArgIter]);
|
||||||
|
Handle(AIS_InteractiveObject) anIObj;
|
||||||
|
if (GetMapOfAIS().IsBound2 (aName))
|
||||||
|
{
|
||||||
|
anIObj = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anIObj.IsNull())
|
||||||
|
{
|
||||||
|
std::cout << "Error: the object '" << theArgs[1] << "' is not displayed" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aPriority < 1)
|
||||||
|
{
|
||||||
|
theDI << aContext->DisplayPriority (anIObj) << " ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aContext->SetDisplayPriority (anIObj, aPriority);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ObjectsCommands
|
//function : ObjectsCommands
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -6008,4 +6083,9 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
|
|||||||
"vlocscale name x y z scale\n\t\t applies scale to local transformation",
|
"vlocscale name x y z scale\n\t\t applies scale to local transformation",
|
||||||
__FILE__,
|
__FILE__,
|
||||||
LocalTransformPresentation, group);
|
LocalTransformPresentation, group);
|
||||||
|
|
||||||
|
theCommands.Add("vpriority",
|
||||||
|
"vpriority [-noupdate|-update] name [value]\n\t\t prints or sets the display priority for an object",
|
||||||
|
__FILE__,
|
||||||
|
VPriority, group);
|
||||||
}
|
}
|
||||||
|
43
tests/bugs/vis/bug25400
Normal file
43
tests/bugs/vis/bug25400
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC25400"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
###################################################################################################
|
||||||
|
# Visualization, TKOpenGl - Structure disappears if assigned a non-default Z layer
|
||||||
|
###################################################################################################
|
||||||
|
|
||||||
|
box b 1 2 3
|
||||||
|
vinit
|
||||||
|
vdisplay b
|
||||||
|
vfrustumculling 1
|
||||||
|
vfit
|
||||||
|
|
||||||
|
vdump $imagedir/${casename}_default_layer.png
|
||||||
|
|
||||||
|
# 1. Test a non-default Z layer:
|
||||||
|
# the object should not disappear from the screen
|
||||||
|
# due to wrong frustum culling operation
|
||||||
|
|
||||||
|
vzlayer add
|
||||||
|
vobjzlayer set b 1
|
||||||
|
# vfit is used to redraw the view, the box disappeared after this due to the issue 25400
|
||||||
|
vfit
|
||||||
|
|
||||||
|
vdump $imagedir/${casename}_new_layer.png
|
||||||
|
|
||||||
|
vzlayer del 1
|
||||||
|
# vfit is used to redraw the view, the textured box appeared again after this
|
||||||
|
vfit
|
||||||
|
|
||||||
|
vdump $imagedir/${casename}_after_delete_layer.png
|
||||||
|
|
||||||
|
# 2. Test a non-default display priority value:
|
||||||
|
# the object should not disappear from the screen
|
||||||
|
# due to wrong frustum culling operation
|
||||||
|
|
||||||
|
vpriority b
|
||||||
|
vpriority b 6
|
||||||
|
|
||||||
|
vdump $imagedir/${casename}_new_priority.png
|
||||||
|
|
||||||
|
set only_screen 1
|
Loading…
x
Reference in New Issue
Block a user