1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-09 18:50:54 +03:00

0031341: Visualization - Graphic3d_Layer::UpdateCulling() ignores Presentation range

Graphic3d_Layer::UpdateCulling() now takes into account BVH_Tree::EndPrimitive().
'vstatprofiler structs' now properly prints number of structures in case of no culling.
This commit is contained in:
kgv 2020-02-01 00:50:04 +03:00 committed by bugmaster
parent 18348b382e
commit a2803f37e7
3 changed files with 49 additions and 13 deletions

View File

@ -557,14 +557,18 @@ void Graphic3d_Layer::UpdateCulling (Standard_Integer theViewId,
} }
else else
{ {
Standard_Integer aIdx = aBVHTree->BegPrimitive (aNode); const Standard_Integer aStartIdx = aBVHTree->BegPrimitive (aNode);
const Graphic3d_CStructure* aStruct = isTrsfPers const Standard_Integer anEndIdx = aBVHTree->EndPrimitive (aNode);
? myBVHPrimitivesTrsfPers.GetStructureById (aIdx) for (Standard_Integer anIdx = aStartIdx; anIdx <= anEndIdx; ++anIdx)
: myBVHPrimitives.GetStructureById (aIdx);
if (aStruct->IsVisible (theViewId))
{ {
aStruct->MarkAsNotCulled(); const Graphic3d_CStructure* aStruct = isTrsfPers
++myNbStructuresNotCulled; ? myBVHPrimitivesTrsfPers.GetStructureById (anIdx)
: myBVHPrimitives.GetStructureById (anIdx);
if (aStruct->IsVisible (theViewId))
{
aStruct->MarkAsNotCulled();
++myNbStructuresNotCulled;
}
} }
if (aHead < 0) if (aHead < 0)
{ {

View File

@ -12479,7 +12479,9 @@ static Standard_Integer VStatProfiler (Draw_Interpretor& theDI,
else if (aFlag == "alllayers" else if (aFlag == "alllayers"
|| aFlag == "layers") aParam = Graphic3d_RenderingParams::PerfCounters_Layers; || aFlag == "layers") aParam = Graphic3d_RenderingParams::PerfCounters_Layers;
else if (aFlag == "allstructs" else if (aFlag == "allstructs"
|| aFlag == "structs") aParam = Graphic3d_RenderingParams::PerfCounters_Structures; || aFlag == "allstructures"
|| aFlag == "structs"
|| aFlag == "structures") aParam = Graphic3d_RenderingParams::PerfCounters_Structures;
else if (aFlag == "groups") aParam = Graphic3d_RenderingParams::PerfCounters_Groups; else if (aFlag == "groups") aParam = Graphic3d_RenderingParams::PerfCounters_Groups;
else if (aFlag == "allarrays" else if (aFlag == "allarrays"
|| aFlag == "fillarrays" || aFlag == "fillarrays"
@ -12548,13 +12550,20 @@ static Standard_Integer VStatProfiler (Draw_Interpretor& theDI,
{ {
theDI << searchInfo (aDict, "Rendered layers") << " "; theDI << searchInfo (aDict, "Rendered layers") << " ";
} }
else if (aFlag == "allstructs") else if (aFlag == "allstructs"
|| aFlag == "allstructures")
{ {
theDI << searchInfo (aDict, "Structs") << " "; theDI << searchInfo (aDict, "Structs") << " ";
} }
else if (aFlag == "structs") else if (aFlag == "structs"
|| aFlag == "structures")
{ {
theDI << searchInfo (aDict, "Rendered structs") << " "; TCollection_AsciiString aRend = searchInfo (aDict, "Rendered structs");
if (aRend.IsEmpty()) // all structures rendered
{
aRend = searchInfo (aDict, "Structs");
}
theDI << aRend << " ";
} }
else if (aFlag == "groups") else if (aFlag == "groups")
{ {
@ -14470,7 +14479,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"\n '-exposure value' Exposure value for tone mapping (0.0 value disables the effect)" "\n '-exposure value' Exposure value for tone mapping (0.0 value disables the effect)"
"\n '-whitepoint value' White point value for filmic tone mapping" "\n '-whitepoint value' White point value for filmic tone mapping"
"\n '-tonemapping mode' Tone mapping mode (disabled, filmic)" "\n '-tonemapping mode' Tone mapping mode (disabled, filmic)"
"\n '-perfCounters none|fps|cpu|layers|structures|groups|arrays|triagles|points" "\n '-perfCounters none|fps|cpu|layers|structures|groups|arrays|triangles|points"
"\n ' |gpuMem|frameTime|basic|extended|full|nofps|skipImmediate'" "\n ' |gpuMem|frameTime|basic|extended|full|nofps|skipImmediate'"
"\n Show/hide performance counters (flags can be combined)" "\n Show/hide performance counters (flags can be combined)"
"\n '-perfUpdateInterval nbSeconds' Performance counters update interval" "\n '-perfUpdateInterval nbSeconds' Performance counters update interval"
@ -14485,7 +14494,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
theCommands.Add("vstatprofiler", theCommands.Add("vstatprofiler",
"\n vstatprofiler [fps|cpu|allLayers|layers|allstructures|structures|groups" "\n vstatprofiler [fps|cpu|allLayers|layers|allstructures|structures|groups"
"\n |allArrays|fillArrays|lineArrays|pointArrays|textArrays" "\n |allArrays|fillArrays|lineArrays|pointArrays|textArrays"
"\n |triagles|points|geomMem|textureMem|frameMem" "\n |triangles|points|geomMem|textureMem|frameMem"
"\n |elapsedFrame|cpuFrameAverage|cpuPickingAverage|cpuCullingAverage|cpuDynAverage" "\n |elapsedFrame|cpuFrameAverage|cpuPickingAverage|cpuCullingAverage|cpuDynAverage"
"\n |cpuFrameMax|cpuPickingMax|cpuCullingMax|cpuDynMax]" "\n |cpuFrameMax|cpuPickingMax|cpuCullingMax|cpuDynMax]"
"\n [-noredraw]" "\n [-noredraw]"

23
tests/bugs/vis/bug31341 Normal file
View File

@ -0,0 +1,23 @@
puts "============="
puts "0031341: Visualization - Graphic3d_Layer::UpdateCulling() ignores Presentation range"
puts "============="
pload MODELING VISUALIZATION
# create big enough set of overlapped boxes, so that more than 1 structure appear on a leaf of BVH tree
set aList {}
for {set i 0} {$i < 2000} {incr i} { box b$i 2000-$i 2000-$i 2000-$i; lappend aList b$i }
vclear
vinit View1
vtop
vdefaults -autoTriang 0
vdisplay -dispMode 0 {*}$aList
vfit
vzoom 5
if { [vstatprofiler structs] != 1203 } { puts "Error: unexpected number of culled structures" }
vdump $::imagedir/${::casename}_zoom.png
vfit
vzoom 0.9
if { [vstatprofiler structs] != 2000 } { puts "Error: no culling is expected" }
vdump $::imagedir/${::casename}.png