0031189: Draw Harness, ViewerTest - send messages to Message::DefaultMessenger()
[occt.git] / tests / bugs / vis / bug24307_2
1 puts "========"
2 puts "OCC24307 Objects clipping algorithm using BVH performance test: Simple boxes test"
3 puts "========"
4
5 # object characteristics
6 set BOXES_NUM 10
7 set BOX_SIZE 100
8 set PERCENT_OF_INNER_BOXES 30
9
10 # window parameters
11 set SMALL_WIN_WIDTH 512
12 set SMALL_WIN_HEIGHT 512
13
14 # other
15 array set aBoxNames {}
16
17 pload VISUALIZATION MODELING
18 vclear
19 vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
20 vactivate small_wnd
21 vrenderparams -perfUpdateInterval 0
22 vrenderparams -frustumculling off
23 vautozfit 0
24 vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
25 vzrange 1 512
26 vremove -all -noinfo
27
28 set aInnerBoxesNum [expr $BOXES_NUM * $PERCENT_OF_INNER_BOXES / 100]
29 puts ""
30 set aDebugInfo "Total number of visible objects: "
31 append aDebugInfo $aInnerBoxesNum
32 puts $aDebugInfo
33 puts ""
34
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"
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 }
47 for {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 }
55 puts "$BOXES_NUM boxes generated."
56 puts ""
57
58 puts "Start displaying boxes without clipping..."
59 for {set i 0} {$i < $BOXES_NUM} {incr i} {
60   vdisplay -noupdate $aBoxNames($i)
61 }
62 puts [vfps]
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."
68 puts ""
69
70 verase
71
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)
76 }
77 puts [vfps]
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."
83
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"
87 }