2 puts "OCC24307 Objects clipping algorithm using BVH performance test: Simple boxes test"
5 # object characteristics
8 set PERCENT_OF_INNER_BOXES 30
11 set SMALL_WIN_WIDTH 512
12 set SMALL_WIN_HEIGHT 512
15 array set aBoxNames {}
17 pload VISUALIZATION MODELING
19 vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
21 vrenderparams -perfUpdateInterval 0
22 vrenderparams -frustumculling off
24 vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
28 set aInnerBoxesNum [expr $BOXES_NUM * $PERCENT_OF_INNER_BOXES / 100]
30 set aDebugInfo "Total number of visible objects: "
31 append aDebugInfo $aInnerBoxesNum
35 puts "Start boxes generation..."
36 set aInnerWidthStep [expr $SMALL_WIN_WIDTH / (2 * ($aInnerBoxesNum + 1))]
37 set aInnerHeightStep [expr $SMALL_WIN_HEIGHT / (2 * ($aInnerBoxesNum + 1))]
38 set aOuterStep [expr $BOX_SIZE * 3 / ($BOXES_NUM - $aInnerBoxesNum + 1)]
39 for {set i 0} {$i < $aInnerBoxesNum} {incr i} {
40 set aCurrName "inner_box"
42 set aX [expr - $SMALL_WIN_WIDTH / 4 + ($i + 1) * $aInnerWidthStep ]
43 set aY [expr - $SMALL_WIN_HEIGHT / 4 + ($i + 1) * $aInnerHeightStep ]
44 box $aCurrName $aX $aY 0 $BOX_SIZE $BOX_SIZE $BOX_SIZE
45 set aBoxNames($i) $aCurrName
47 for {set i $aInnerBoxesNum} {$i < $BOXES_NUM} {incr i} {
48 set aCurrName "outer_box"
50 set aX [expr - $SMALL_WIN_WIDTH - $BOX_SIZE * 3 + ($i - $aInnerBoxesNum + 1) * $aOuterStep]
51 set aY [expr - $SMALL_WIN_HEIGHT - $BOX_SIZE * 3 + ($i - $aInnerBoxesNum + 1) * $aOuterStep]
52 box $aCurrName $aX $aY 0 $BOX_SIZE $BOX_SIZE $BOX_SIZE
53 set aBoxNames($i) $aCurrName
55 puts "$BOXES_NUM boxes generated."
58 puts "Start displaying boxes without clipping..."
59 for {set i 0} {$i < $BOXES_NUM} {incr i} {
60 vdisplay -noupdate $aBoxNames($i)
63 vrenderparams -perfCounters none
64 vdump $imagedir/${casename}_cull_off_ref.png
65 vrenderparams -perfCounters verbose|nofps|nocpu
66 vdump $imagedir/${casename}_cull_off.png
67 puts "All boxes were displayed."
72 vrenderparams -frustumculling on
73 puts "Start displaying boxes with clipping..."
74 for {set i 0} {$i < $BOXES_NUM} {incr i} {
75 vdisplay -noupdate $aBoxNames($i)
78 vrenderparams -perfCounters none
79 vdump $imagedir/${casename}_cull_on_ref.png
80 vrenderparams -perfCounters verbose|nofps|nocpu
81 vdump $imagedir/${casename}_cull_on.png
82 puts "All boxes were displayed."
84 set aDiffImageResult [diffimage $imagedir/${casename}_cull_on_ref.png $imagedir/${casename}_cull_off_ref.png 0.1 0 0 $imagedir/${casename}_diff.png]
85 if {$aDiffImageResult != 0} {
86 puts "ERROR : Test failed: there is a difference between images rendered with and without clipping"