diff --git a/src/Graphic3d/Graphic3d_Layer.cxx b/src/Graphic3d/Graphic3d_Layer.cxx index a94e38a17c..2fb67ab20e 100644 --- a/src/Graphic3d/Graphic3d_Layer.cxx +++ b/src/Graphic3d/Graphic3d_Layer.cxx @@ -557,14 +557,18 @@ void Graphic3d_Layer::UpdateCulling (Standard_Integer theViewId, } else { - Standard_Integer aIdx = aBVHTree->BegPrimitive (aNode); - const Graphic3d_CStructure* aStruct = isTrsfPers - ? myBVHPrimitivesTrsfPers.GetStructureById (aIdx) - : myBVHPrimitives.GetStructureById (aIdx); - if (aStruct->IsVisible (theViewId)) + const Standard_Integer aStartIdx = aBVHTree->BegPrimitive (aNode); + const Standard_Integer anEndIdx = aBVHTree->EndPrimitive (aNode); + for (Standard_Integer anIdx = aStartIdx; anIdx <= anEndIdx; ++anIdx) { - aStruct->MarkAsNotCulled(); - ++myNbStructuresNotCulled; + const Graphic3d_CStructure* aStruct = isTrsfPers + ? myBVHPrimitivesTrsfPers.GetStructureById (anIdx) + : myBVHPrimitives.GetStructureById (anIdx); + if (aStruct->IsVisible (theViewId)) + { + aStruct->MarkAsNotCulled(); + ++myNbStructuresNotCulled; + } } if (aHead < 0) { diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index d1aa802c10..c2d8b0f594 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -12479,7 +12479,9 @@ static Standard_Integer VStatProfiler (Draw_Interpretor& theDI, else if (aFlag == "alllayers" || aFlag == "layers") aParam = Graphic3d_RenderingParams::PerfCounters_Layers; 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 == "allarrays" || aFlag == "fillarrays" @@ -12548,13 +12550,20 @@ static Standard_Integer VStatProfiler (Draw_Interpretor& theDI, { theDI << searchInfo (aDict, "Rendered layers") << " "; } - else if (aFlag == "allstructs") + else if (aFlag == "allstructs" + || aFlag == "allstructures") { 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") { @@ -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 '-whitepoint value' White point value for filmic tone mapping" "\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 Show/hide performance counters (flags can be combined)" "\n '-perfUpdateInterval nbSeconds' Performance counters update interval" @@ -14485,7 +14494,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands) theCommands.Add("vstatprofiler", "\n vstatprofiler [fps|cpu|allLayers|layers|allstructures|structures|groups" "\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 |cpuFrameMax|cpuPickingMax|cpuCullingMax|cpuDynMax]" "\n [-noredraw]" diff --git a/tests/bugs/vis/bug31341 b/tests/bugs/vis/bug31341 new file mode 100644 index 0000000000..7678162fee --- /dev/null +++ b/tests/bugs/vis/bug31341 @@ -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