9c86076b |
1 | puts "===========" |
2 | puts "OCC28036" |
3 | puts "Visualization, AIS_ColoredShape - handle correctly nested compounds within Shaded display mode" |
4 | puts "===========" |
5 | puts "" |
6 | |
7 | pload MODELING VISUALIZATION |
8 | |
9 | clear |
10 | box b1 0 0 0 100 200 1 |
11 | box b2 150 0 0 100 50 1 |
12 | box b3 150 50 0 100 150 1 |
13 | |
14 | for {set i 1} {$i <= 3} {incr i} { tcopy b${i} b1_${i}; ttranslate b1_${i} 0 -300 0 } |
15 | for {set i 1} {$i <= 3} {incr i} { tcopy b${i} b2_${i}; ttranslate b2_${i} 0 0 0 } |
16 | for {set i 1} {$i <= 3} {incr i} { tcopy b${i} b3_${i}; ttranslate b3_${i} 0 300 0 } |
17 | |
18 | # make a reference scene with per-object colors |
19 | vclear |
20 | vinit View1 |
21 | vsetdispmode 1 |
22 | vaxo |
23 | |
24 | vdisplay b1_1 b1_2 b1_3 |
25 | vsetcolor b1_1 RED |
26 | vsetcolor b1_2 GREEN |
27 | vsetcolor b1_3 BLUE1 |
28 | |
29 | vdisplay b2_1 b2_2 b2_3 |
30 | vsetcolor b2_1 RED |
31 | vsetcolor b2_2 GREEN |
32 | vsetcolor b2_3 BLUE1 |
33 | |
34 | vdisplay b3_1 b3_2 b3_3 |
35 | vsetcolor b3_1 RED |
36 | vsetcolor b3_2 GREEN |
37 | vsetcolor b3_3 BLUE1 |
38 | vfit |
39 | vdump $imagedir/${casename}_ref.png |
40 | |
41 | # make a scene with sub-colors and nested compounds |
42 | for {set j 1} {$j <= 3} {incr j} { compound b${j}_2 b${j}_3 b${j}_23 } |
43 | for {set j 1} {$j <= 3} {incr j} { compound b${j}_1 b${j}_23 b${j}_123 } |
44 | compound b1_123 b2_123 b3_123 b123_123 |
45 | |
46 | vclear |
47 | vdisplay b123_123 |
48 | |
49 | compound b1_23 b2_23 b3_23 b123_23 |
50 | vaspects b123_123 -subshapes b123_23 -setColor GREEN |
51 | |
52 | vaspects b123_123 -subshapes b1_123 -setColor RED |
53 | vaspects b123_123 -subshapes b2_123 -setColor RED |
54 | vaspects b123_123 -subshapes b3_123 -setColor RED |
55 | |
56 | compound b2_3 b3_3 b23_3 |
57 | vaspects b123_123 -subshapes b1_3 -setColor BLUE1 |
58 | vaspects b123_123 -subshapes b23_3 -setColor BLUE1 |
59 | |
60 | if { [vreadpixel 50 250 rgb name] != "RED3" } { puts "Error: wrong color" } |
61 | if { [vreadpixel 175 175 rgb name] != "RED3" } { puts "Error: wrong color" } |
62 | if { [vreadpixel 300 100 rgb name] != "RED3" } { puts "Error: wrong color" } |
63 | |
64 | if { [vreadpixel 100 310 rgb name] != "GREEN3"} { puts "Error: wrong color" } |
65 | if { [vreadpixel 200 230 rgb name] != "GREEN3"} { puts "Error: wrong color" } |
66 | if { [vreadpixel 320 170 rgb name] != "GREEN3"} { puts "Error: wrong color" } |
67 | |
68 | if { [vreadpixel 130 280 rgb name] != "BLUE3" } { puts "Error: wrong color" } |
69 | if { [vreadpixel 250 200 rgb name] != "BLUE3" } { puts "Error: wrong color" } |
70 | if { [vreadpixel 350 150 rgb name] != "BLUE3" } { puts "Error: wrong color" } |
71 | |
72 | vdump $imagedir/${casename}.png |