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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
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
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
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
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
7
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
8 /*
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
9 void light_init(LIGHT *l)
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
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
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
16
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
17 l->light0[0] = 0.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
18 l->light0[1] = 0.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
19 l->light0[2] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
20 l->light0[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
21
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
22 l->light1[0] = 0.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
23 l->light1[1] = -1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
24 l->light1[2] = 0.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
25 l->light1[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
26
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
27 l->light2[0] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
28 l->light2[1] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
29 l->light2[2] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
30 l->light2[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
31
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
32 l->color0[0] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
33 l->color0[1] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
34 l->color0[2] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
35 l->color0[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
36
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
37 l->color1[0] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
38 l->color1[1] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
39 l->color1[2] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
40 l->color1[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
41
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
42 l->color2[0] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
43 l->color2[1] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
44 l->color2[2] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
45 l->color2[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
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
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
48 l->ambient[0] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
49 l->ambient[1] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
50 l->ambient[2] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
51 l->ambient[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
52
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
53 }
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
54 */
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
55
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
56 /*
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
57 void light_set(LIGHT *l)
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
58 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
59 ps2_vu0_normal_light_matrix(normal_light, l->light0, l->light1, l->light2);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
60 ps2_vu0_light_color_matrix(light_color, l->color0, l->color1, l->color2, l->ambient);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
61 }
90
8edae89a3877 compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
62 */