0027126: Create command checktrinfo to verify meshes
[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
17set aWithoutClippingSnapshot $imagedir/${casename}_without.png
18set aWithClippingSnapshot $imagedir/${casename}_with.png
19set aDiffImage $imagedir/${casename}_diff.png
20
21pload VISUALIZATION MODELING
22vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
23vactivate small_wnd
24vfrustumculling 0
25vautozfit 0
26vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
27vzrange 1 512
28vclear
29vremove -all -noinfo
30
31set aInnerBoxesNum [expr $BOXES_NUM * $PERCENT_OF_INNER_BOXES / 100]
32puts ""
33set aDebugInfo "Total number of visible objects: "
34append aDebugInfo $aInnerBoxesNum
35puts $aDebugInfo
36puts ""
37
38puts "Start boxes generation..."
39set aInnerWidthStep [expr $SMALL_WIN_WIDTH / (2 * ($aInnerBoxesNum + 1))]
40set aInnerHeightStep [expr $SMALL_WIN_HEIGHT / (2 * ($aInnerBoxesNum + 1))]
41set aOuterStep [expr $BOX_SIZE * 3 / ($BOXES_NUM - $aInnerBoxesNum + 1)]
42for {set i 0} {$i < $aInnerBoxesNum} {incr i} {
43 set aCurrName "inner_box"
44 append aCurrName $i
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
49}
50for {set i $aInnerBoxesNum} {$i < $BOXES_NUM} {incr i} {
51 set aCurrName "outer_box"
52 append aCurrName $i
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
57}
58puts "$BOXES_NUM boxes generated."
59puts ""
60
61puts "Start displaying boxes without clipping..."
62for {set i 0} {$i < $BOXES_NUM} {incr i} {
63 vdisplay -noupdate $aBoxNames($i)
64}
65puts [vfps]
66vdump $aWithoutClippingSnapshot
67puts "All boxes were displayed."
68puts ""
69
70verase
71
72vfrustumculling 1
73puts "Start displaying boxes with clipping..."
74for {set i 0} {$i < $BOXES_NUM} {incr i} {
75 vdisplay -noupdate $aBoxNames($i)
76}
77puts [vfps]
78vdump $aWithClippingSnapshot
79puts "All boxes were displayed."
80
81set aDiffImageResult [diffimage $aWithClippingSnapshot $aWithoutClippingSnapshot 0.1 0 0 $aDiffImage]
82if {$aDiffImageResult != 0} {
83 puts "ERROR : Test failed: there is a difference between images rendered with and without clipping"
84}
85
86verase