0032155: Tests - remove broken command OCC280
[occt.git] / tests / bugs / vis / bug24307_2
CommitLineData
b7cd4ba7 1puts "========"
2puts "OCC24307 Objects clipping algorithm using BVH performance test: Simple boxes test"
3puts "========"
4
5# object characteristics
6set BOXES_NUM 10
7set BOX_SIZE 100
8set PERCENT_OF_INNER_BOXES 30
9
10# window parameters
11set SMALL_WIN_WIDTH 512
12set SMALL_WIN_HEIGHT 512
13
14# other
15array set aBoxNames {}
16
b7cd4ba7 17pload VISUALIZATION MODELING
15669413 18vclear
b7cd4ba7 19vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
20vactivate small_wnd
15669413 21vrenderparams -perfUpdateInterval 0
0e3025bc 22vrenderparams -frustumculling off
b7cd4ba7 23vautozfit 0
24vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
25vzrange 1 512
b7cd4ba7 26vremove -all -noinfo
27
28set aInnerBoxesNum [expr $BOXES_NUM * $PERCENT_OF_INNER_BOXES / 100]
29puts ""
30set aDebugInfo "Total number of visible objects: "
31append aDebugInfo $aInnerBoxesNum
32puts $aDebugInfo
33puts ""
34
35puts "Start boxes generation..."
36set aInnerWidthStep [expr $SMALL_WIN_WIDTH / (2 * ($aInnerBoxesNum + 1))]
37set aInnerHeightStep [expr $SMALL_WIN_HEIGHT / (2 * ($aInnerBoxesNum + 1))]
38set aOuterStep [expr $BOX_SIZE * 3 / ($BOXES_NUM - $aInnerBoxesNum + 1)]
39for {set i 0} {$i < $aInnerBoxesNum} {incr i} {
40 set aCurrName "inner_box"
41 append aCurrName $i
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
46}
47for {set i $aInnerBoxesNum} {$i < $BOXES_NUM} {incr i} {
48 set aCurrName "outer_box"
49 append aCurrName $i
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
54}
55puts "$BOXES_NUM boxes generated."
56puts ""
57
58puts "Start displaying boxes without clipping..."
59for {set i 0} {$i < $BOXES_NUM} {incr i} {
60 vdisplay -noupdate $aBoxNames($i)
61}
62puts [vfps]
15669413 63vrenderparams -perfCounters none
64vdump $imagedir/${casename}_cull_off_ref.png
65vrenderparams -perfCounters verbose|nofps|nocpu
66vdump $imagedir/${casename}_cull_off.png
b7cd4ba7 67puts "All boxes were displayed."
68puts ""
69
70verase
71
0e3025bc 72vrenderparams -frustumculling on
b7cd4ba7 73puts "Start displaying boxes with clipping..."
74for {set i 0} {$i < $BOXES_NUM} {incr i} {
75 vdisplay -noupdate $aBoxNames($i)
76}
77puts [vfps]
15669413 78vrenderparams -perfCounters none
79vdump $imagedir/${casename}_cull_on_ref.png
80vrenderparams -perfCounters verbose|nofps|nocpu
81vdump $imagedir/${casename}_cull_on.png
b7cd4ba7 82puts "All boxes were displayed."
83
15669413 84set aDiffImageResult [diffimage $imagedir/${casename}_cull_on_ref.png $imagedir/${casename}_cull_off_ref.png 0.1 0 0 $imagedir/${casename}_diff.png]
b7cd4ba7 85if {$aDiffImageResult != 0} {
86 puts "ERROR : Test failed: there is a difference between images rendered with and without clipping"
87}