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 set aWithoutClippingSnapshot $imagedir/${casename}_without.png
18 set aWithClippingSnapshot $imagedir/${casename}_with.png
19 set aDiffImage $imagedir/${casename}_diff.png
21 pload VISUALIZATION MODELING
22 vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
26 vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
31 set aInnerBoxesNum [expr $BOXES_NUM * $PERCENT_OF_INNER_BOXES / 100]
33 set aDebugInfo "Total number of visible objects: "
34 append aDebugInfo $aInnerBoxesNum
38 puts "Start boxes generation..."
39 set aInnerWidthStep [expr $SMALL_WIN_WIDTH / (2 * ($aInnerBoxesNum + 1))]
40 set aInnerHeightStep [expr $SMALL_WIN_HEIGHT / (2 * ($aInnerBoxesNum + 1))]
41 set aOuterStep [expr $BOX_SIZE * 3 / ($BOXES_NUM - $aInnerBoxesNum + 1)]
42 for {set i 0} {$i < $aInnerBoxesNum} {incr i} {
43 set aCurrName "inner_box"
45 set aX [expr - $SMALL_WIN_WIDTH / 4 + ($i + 1) * $aInnerWidthStep ]
46 set aY [expr - $SMALL_WIN_HEIGHT / 4 + ($i + 1) * $aInnerHeightStep ]
47 box $aCurrName $aX $aY 0 $BOX_SIZE $BOX_SIZE $BOX_SIZE
48 set aBoxNames($i) $aCurrName
50 for {set i $aInnerBoxesNum} {$i < $BOXES_NUM} {incr i} {
51 set aCurrName "outer_box"
53 set aX [expr - $SMALL_WIN_WIDTH - $BOX_SIZE * 3 + ($i - $aInnerBoxesNum + 1) * $aOuterStep]
54 set aY [expr - $SMALL_WIN_HEIGHT - $BOX_SIZE * 3 + ($i - $aInnerBoxesNum + 1) * $aOuterStep]
55 box $aCurrName $aX $aY 0 $BOX_SIZE $BOX_SIZE $BOX_SIZE
56 set aBoxNames($i) $aCurrName
58 puts "$BOXES_NUM boxes generated."
61 puts "Start displaying boxes without clipping..."
62 for {set i 0} {$i < $BOXES_NUM} {incr i} {
63 vdisplay -noupdate $aBoxNames($i)
66 vdump $aWithoutClippingSnapshot
67 puts "All boxes were displayed."
73 puts "Start displaying boxes with clipping..."
74 for {set i 0} {$i < $BOXES_NUM} {incr i} {
75 vdisplay -noupdate $aBoxNames($i)
78 vdump $aWithClippingSnapshot
79 puts "All boxes were displayed."
81 set aDiffImageResult [diffimage $aWithClippingSnapshot $aWithoutClippingSnapshot 0.1 0 0 $aDiffImage]
82 if {$aDiffImageResult != 0} {
83 puts "ERROR : Test failed: there is a difference between images rendered with and without clipping"