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