ea764884 |
1 | puts "============" |
2 | puts "CR25760" |
3 | puts "============" |
4 | puts "" |
5 | ####################################################################### |
6 | # Visualization - precision factor added to ZNear, ZFar in method ZFitAll() of Graphic3d_Camera is not enough |
7 | ####################################################################### |
8 | |
9 | vinit View1 w=409 h=409 |
10 | vclear |
11 | |
12 | proc test2d {} { |
13 | set pix1 {135 204} |
14 | set pix2 {204 187} |
15 | |
16 | for {set i 8} {$i <= 8} {incr i} { |
17 | set min_z [expr pow (-10, $i)] |
18 | set max_z [expr $min_z + 1000] |
19 | plane p1 0 0 $min_z 0 0 1 |
20 | plane p2 0 0 $max_z 0 0 1 |
21 | |
22 | mkface f1 p1 -1 0 -1 0 |
23 | mkface f2 p2 0 1 0 1 |
24 | |
25 | vclear |
26 | vdisplay f1 f2 |
27 | vtop |
28 | vfit |
29 | |
30 | for {set z [expr $max_z + 1.0]} {$z <= 1e10} {set z [expr abs ($z) * 1.2]} { |
31 | vviewparams -eye 0 0 $z |
32 | vmoveto {*}$pix1 |
33 | if { [checkcolor {*}$pix1 0 1 1] != 1 } { |
34 | puts "Error: 2D projection test failed with the following parameters:" |
35 | vviewparams |
36 | vzrange |
37 | puts "" |
38 | puts "z : $z" |
39 | puts "min_z: $min_z" |
40 | puts "max_z: $max_z" |
41 | return 0 |
42 | } |
43 | vmoveto {*}$pix2 |
44 | if { [checkcolor {*}$pix2 0 1 1] != 1 } { |
45 | puts "Error: 2D projection test failed with the following parameters:" |
46 | vviewparams |
47 | vzrange |
48 | puts "" |
49 | puts "z : $z" |
50 | puts "min_z: $min_z" |
51 | puts "max_z: $max_z" |
52 | return 0 |
53 | } |
54 | } |
55 | } |
56 | return 1 |
57 | } |
58 | |
59 | set tcl_precision 16 |
60 | |
61 | #################################################################### |
62 | # Test orthographic camera without frustum culling. # |
63 | #################################################################### |
64 | vcamera -ortho |
65 | vfrustumculling 0 |
66 | |
67 | if { [test2d] != 1 } { |
68 | puts "Error: 2D projection test failed: view frustum culling is OFF" |
69 | } |
70 | |
71 | #################################################################### |
72 | # Test orthographic camera with frustum culling. # |
73 | #################################################################### |
74 | vcamera -ortho |
75 | vfrustumculling 1 |
76 | |
77 | if { [test2d] != 1 } { |
78 | puts "Error: 2D projection test failed: view frustum culling is ON" |
79 | } |