1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
puts "========"
puts "OCC24307 Objects clipping algorithm using BVH performance test: Simple boxes test"
puts "========"
# object characteristics
set BOXES_NUM 10
set BOX_SIZE 100
set PERCENT_OF_INNER_BOXES 30
# window parameters
set SMALL_WIN_WIDTH 512
set SMALL_WIN_HEIGHT 512
# other
array set aBoxNames {}
set aWithoutClippingSnapshot $imagedir/${casename}_without.png
set aWithClippingSnapshot $imagedir/${casename}_with.png
set aDiffImage $imagedir/${casename}_diff.png
pload VISUALIZATION MODELING
vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
vactivate small_wnd
vfrustumculling 0
vautozfit 0
vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
vzrange 1 512
vclear
vremove -all -noinfo
set aInnerBoxesNum [expr $BOXES_NUM * $PERCENT_OF_INNER_BOXES / 100]
puts ""
set aDebugInfo "Total number of visible objects: "
append aDebugInfo $aInnerBoxesNum
puts $aDebugInfo
puts ""
puts "Start boxes generation..."
set aInnerWidthStep [expr $SMALL_WIN_WIDTH / (2 * ($aInnerBoxesNum + 1))]
set aInnerHeightStep [expr $SMALL_WIN_HEIGHT / (2 * ($aInnerBoxesNum + 1))]
set aOuterStep [expr $BOX_SIZE * 3 / ($BOXES_NUM - $aInnerBoxesNum + 1)]
for {set i 0} {$i < $aInnerBoxesNum} {incr i} {
set aCurrName "inner_box"
append aCurrName $i
set aX [expr - $SMALL_WIN_WIDTH / 4 + ($i + 1) * $aInnerWidthStep ]
set aY [expr - $SMALL_WIN_HEIGHT / 4 + ($i + 1) * $aInnerHeightStep ]
box $aCurrName $aX $aY 0 $BOX_SIZE $BOX_SIZE $BOX_SIZE
set aBoxNames($i) $aCurrName
}
for {set i $aInnerBoxesNum} {$i < $BOXES_NUM} {incr i} {
set aCurrName "outer_box"
append aCurrName $i
set aX [expr - $SMALL_WIN_WIDTH - $BOX_SIZE * 3 + ($i - $aInnerBoxesNum + 1) * $aOuterStep]
set aY [expr - $SMALL_WIN_HEIGHT - $BOX_SIZE * 3 + ($i - $aInnerBoxesNum + 1) * $aOuterStep]
box $aCurrName $aX $aY 0 $BOX_SIZE $BOX_SIZE $BOX_SIZE
set aBoxNames($i) $aCurrName
}
puts "$BOXES_NUM boxes generated."
puts ""
puts "Start displaying boxes without clipping..."
for {set i 0} {$i < $BOXES_NUM} {incr i} {
vdisplay -noupdate $aBoxNames($i)
}
puts [vfps]
vdump $aWithoutClippingSnapshot
puts "All boxes were displayed."
puts ""
verase
vfrustumculling 1
puts "Start displaying boxes with clipping..."
for {set i 0} {$i < $BOXES_NUM} {incr i} {
vdisplay -noupdate $aBoxNames($i)
}
puts [vfps]
vdump $aWithClippingSnapshot
puts "All boxes were displayed."
set aDiffImageResult [diffimage $aWithClippingSnapshot $aWithoutClippingSnapshot 0.1 0 0 $aDiffImage]
if {$aDiffImageResult != 0} {
puts "ERROR : Test failed: there is a difference between images rendered with and without clipping"
}
verase
|