7adcf8defa058ee79ae1ad8dc32b54583e036eaf
[occt.git] / tests / v3d / glsl / gouraud_spot1
1 puts "========"
2 puts "Per-vertex lighting using built-in GLSL program, one spot light source."
3 puts "Visual comparison with the reference snapshot should be performed for this test case."
4 puts "========"
5
6 # create objects
7 set anX 0.001
8 circle c 0 0 0 0.001
9 mkedge e c
10 wire   w e
11 plane  s
12 mkface f1 s w
13 mkface f2 s w
14 ttranslate f1 $anX -0.001 0
15
16 # display objects
17 vtop
18 vdisplay -dispMode 1 f1 f2
19 vsetlocation f2 $anX 0.001 0
20 vpoint vl $anX 0 0.001
21 vfit
22
23 # setup light
24 vcaps -ffp 0
25 vrenderparams -shadingModel vert
26 vlight clear
27 vlight add spotLight pos $anX 0 0.001 dir 0 0 -1 angle 60 constAtten 0.1 exponent 0.1 color RED1 headLight 0
28
29 set aColor1 [vreadpixel 205 180 rgb name]
30 set aColor2 [vreadpixel 205 220 rgb name]
31 if { "$aColor1" != "RED" || "$aColor2" != "RED" } {
32   puts "Error: expected color near the light spot is RED"
33 }
34
35 set aColor3 [vreadpixel 205 132 rgb name]
36 set aColor4 [vreadpixel 205 280 rgb name]
37 if { "$aColor3" != "RED" || "$aColor4" != "RED4" } {
38   puts "Error: expected color mid from the light spot is RED4"
39 }
40
41 set aColor5 [vreadpixel 205 100 rgb name]
42 set aColor6 [vreadpixel 205 306 rgb name]
43 if { "$aColor5" != "GRAY9" || "$aColor6" != "GRAY9" } {
44   puts "Error: expected color far from the light spot is GRAY9"
45 }