0030439: Visualization - extend fonts search within Font_FontMgr::FindFont() on Linux
[occt.git] / tests / bugs / vis / bug24307_1
1 puts "========"
2 puts "OCC24307 Objects clipping algorithm using BVH performance test: Solid spheres test"
3 puts "========"
4
5 # define objects' location parameters and their characteristics
6 set SPHERES_NUM 10
7 set SPERE_RADIUS 100
8 set SPHERE_FINENESS 10
9 set PERCENT_OF_INNER_SPHERES 30
10
11 # window parameters
12 set SMALL_WIN_WIDTH 512
13 set SMALL_WIN_HEIGHT 512
14
15 # other
16 array set aSphereNames {}
17
18 pload VISUALIZATION MODELING
19 vclear
20 vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
21 vactivate small_wnd
22 vrenderparams -perfUpdateInterval 0
23 vrenderparams -frustumculling off
24 vautozfit 0
25 vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
26 vzrange 1 512
27 vremove -all -noinfo
28
29 puts [vdrawsphere tmp_sph $SPHERE_FINENESS]
30 vremove -noinfo tmp_sph
31
32 set aInnerSpheresNum [expr $SPHERES_NUM * $PERCENT_OF_INNER_SPHERES / 100]
33 puts ""
34 set aDebugInfo "Total number of visible objects: "
35 append aDebugInfo $aInnerSpheresNum
36 puts $aDebugInfo
37 puts ""
38
39 puts "Start displaying spheres without clipping..."
40 set aInnerWidthStep [expr $SMALL_WIN_WIDTH / ($aInnerSpheresNum + 1)]
41 set aInnerHeightStep [expr $SMALL_WIN_HEIGHT / ($aInnerSpheresNum + 1)]
42 set aOuterStep [expr $SPERE_RADIUS * 3 / ($SPHERES_NUM - $aInnerSpheresNum + 1)]
43 for {set i 0} {$i < $aInnerSpheresNum} {incr i} {
44   set aCurrName "inner_sph"
45   append aCurrName $i
46   set aX [expr - $SMALL_WIN_WIDTH / 2 + ($i + 1) * $aInnerWidthStep ]
47   set aY [expr - $SMALL_WIN_HEIGHT / 2 + ($i + 1) * $aInnerHeightStep ]
48   vdrawsphere $aCurrName $SPHERE_FINENESS $aX $aY 0 $SPERE_RADIUS 0 0
49   set aSphereNames($i) $aCurrName
50 }
51 for {set i $aInnerSpheresNum} {$i < $SPHERES_NUM} {incr i} {
52   set aCurrName "outer_sph"
53   append aCurrName $i
54   set aX [expr - $SMALL_WIN_WIDTH - $SPERE_RADIUS * 3 + ($i - $aInnerSpheresNum + 1) * $aOuterStep ]
55   set aY [expr - $SMALL_WIN_HEIGHT - $SPERE_RADIUS * 3 + ($i - $aInnerSpheresNum + 1) * $aOuterStep ]
56   vdrawsphere $aCurrName $SPHERE_FINENESS $aX $aY 0 $SPERE_RADIUS 0 0
57   set aSphereNames($i) $aCurrName
58 }
59 puts [vfps]
60 vrenderparams -perfCounters none
61 vdump $imagedir/${casename}_cull_off_ref.png
62 vrenderparams -perfCounters verbose|nofps|nocpu
63 vdump $imagedir/${casename}_cull_off.png
64 puts "All spheres were displayed."
65 puts ""
66
67 verase
68
69 puts "Start displaying spheres with clipping..."
70 vrenderparams -frustumculling on
71 vdisplayall
72 puts [vfps]
73 vrenderparams -perfCounters none
74 vdump $imagedir/${casename}_cull_on_ref.png
75 vrenderparams -perfCounters verbose|nofps|nocpu
76 vdump $imagedir/${casename}_cull_on.png
77 puts "All spheres were displayed."
78 puts ""
79
80 set aDiffImageResult [diffimage $imagedir/${casename}_cull_on_ref.png $imagedir/${casename}_cull_off_ref.png 0.1 0 0 $imagedir/${casename}_diff.png]
81 if {$aDiffImageResult != 0} {
82   puts "ERROR : Test failed: there is a difference between images rendered with and without clipping"
83 }