0032208: Tests - refactor visualization tests to cover several graphic drivers
[occt.git] / tests / opengl / data / shading / vert_color
1 puts "============"
2 puts "0032198: Visualization, TKOpenGl - per-vertex lighting ignores back/front material colors"
3 puts "============"
4 puts ""
5
6 set aVerts {
7   {{0 55 0} { 0 75  0} {20 55  0}}
8   {{0 75 0} { 0 55 20} {20 55  0}}
9   {{0 55 0} { 0 55 20} { 0 75  0}}
10   {{0 55 0} {20 55  0} { 0 55 20}}
11 }
12 set aColors {
13   {{1.0 0.0 0.0} {0.0 1.0 0.0} {0.0 0.0 1.0}}
14   {{1.0 1.0 0.0} {1.0 1.0 1.0} {0.0 1.0 1.0}}
15   {{0.5 0.0 0.0} {0.0 0.0 0.5} {0.0 0.5 0.0}}
16   {{0.5 0.5 0.0} {0.0 0.5 0.5} {0.5 0.0 0.5}}
17 }
18 set aNormals {
19   { 0  0 -1}
20   { 1  1  1}
21   {-1  0  0}
22   { 0 -1  0}
23 }
24
25 proc genTris {theFrom theTo theColors} {
26   set aTris ""
27   for {set t $theFrom} {$t <= $theTo} {incr t} {
28     for {set n 0} {$n < 3} {incr n} {
29       set aVert [lindex $::aVerts   $t]
30       set aCol  [lindex $::aColors  $t]
31       set aNorm [lindex $::aNormals $t]
32       set aTris "$aTris v [lindex $aVert $n] n $aNorm"
33       if { $theColors == 1 } { set aTris "$aTris c [lindex $aCol $n]" }
34     }
35   }
36   return $aTris
37 }
38
39 set aTris1  [genTris 0 3 0]
40 set aTris1c [genTris 0 3 1]
41 set aTris2  [genTris 0 1 0]
42 set aTris2c [genTris 0 1 1]
43
44 pload MODELING VISUALIZATION
45 vclear
46 vinit View1
47 vviewparams -scale 10 -proj -0.3 -0.7 0.6 -up 0.013 0.65 0.75 -at 35.4 61.8 31.5
48 vdrawparray t1  triangles {*}$aTris1
49 vdrawparray t1c triangles {*}$aTris1c
50 vdrawparray t2  triangles {*}$aTris2
51 vdrawparray t2c triangles {*}$aTris2c
52 vdrawparray t3  triangles {*}$aTris2
53 vdrawparray t3c triangles {*}$aTris2c
54 vlocation t1  -location  0 0  0
55 vlocation t2  -location 30 0  0
56 vlocation t3  -location 60 0  0
57 vlocation t1c -location  0 0 30
58 vlocation t2c -location 30 0 30
59 vlocation t3c -location 60 0 30
60 vaspects t1  -color GREEN -backfaceColor RED
61 vaspects t2  -color GREEN -backfaceColor RED
62 vaspects t1c -color GREEN -backfaceColor RED
63 vaspects t2c -color GREEN -backfaceColor RED
64 vaspects t3  -color WHITE -backfaceColor WHITE
65 vaspects t3c -color WHITE -backfaceColor WHITE
66
67 vrenderparams -shadingModel VERT
68 vdump ${imagedir}/${casename}_vert.png
69 vrenderparams -shadingModel PHONG
70 vdump ${imagedir}/${casename}_phong.png
71 vrenderparams -shadingModel FLAT
72 vdump ${imagedir}/${casename}_flat.png
73 vrenderparams -shadingModel UNLIT
74 vdump ${imagedir}/${casename}_unlit.png
75 vrenderparams -shadingModel PBR
76 vdump ${imagedir}/${casename}_pbr.png