Mercurial > hg > old > magoroku_racing
annotate light.c @ 91:cb6c6de125dc
halfway
author | Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 26 May 2011 14:44:03 +0900 |
parents | 8edae89a3877 |
children | 0b65ca27f113 |
rev | line source |
---|---|
0 | 1 #include <stdio.h> |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
2 //#include "libps2.h" |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
3 //#include "light.h" |
0 | 4 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
5 //FMATRIX normal_light; |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
6 //FMATRIX light_color; |
0 | 7 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
8 /* |
0 | 9 void light_init(LIGHT *l) |
10 { | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
11 //Three lights in all. |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
12 // The color of the light of "light0" is color0. |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
13 // The color of the light of "light1" is color1. |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
14 // The color of the light of "light2" is color2. |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
15 |
0 | 16 |
17 l->light0[0] = 0.0; | |
18 l->light0[1] = 0.0; | |
19 l->light0[2] = 1.0; | |
20 l->light0[3] = 1.0; | |
21 | |
22 l->light1[0] = 0.0; | |
23 l->light1[1] = -1.0; | |
24 l->light1[2] = 0.0; | |
25 l->light1[3] = 1.0; | |
26 | |
27 l->light2[0] = 1.0; | |
28 l->light2[1] = 1.0; | |
29 l->light2[2] = 1.0; | |
30 l->light2[3] = 1.0; | |
31 | |
32 l->color0[0] = 0.4; | |
33 l->color0[1] = 0.4; | |
34 l->color0[2] = 0.4; | |
35 l->color0[3] = 1.0; | |
36 | |
37 l->color1[0] = 0.4; | |
38 l->color1[1] = 0.4; | |
39 l->color1[2] = 0.4; | |
40 l->color1[3] = 1.0; | |
41 | |
42 l->color2[0] = 0.4; | |
43 l->color2[1] = 0.4; | |
44 l->color2[2] = 0.4; | |
45 l->color2[3] = 1.0; | |
46 | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
47 //Reflection degree of light |
0 | 48 l->ambient[0] = 0.4; |
49 l->ambient[1] = 0.4; | |
50 l->ambient[2] = 0.4; | |
51 l->ambient[3] = 1.0; | |
52 | |
53 } | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
54 */ |
0 | 55 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
56 /* |
0 | 57 void light_set(LIGHT *l) |
58 { | |
59 ps2_vu0_normal_light_matrix(normal_light, l->light0, l->light1, l->light2); | |
60 ps2_vu0_light_color_matrix(light_color, l->color0, l->color1, l->color2, l->ambient); | |
61 } | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
62 */ |