annotate light.c @ 29:6387573f9c85

*** empty log message ***
author gongo
date Sun, 05 Nov 2006 02:32:53 +0000
parents b6a1385f19be
children 8edae89a3877
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>
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
2 #include "libps2.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
3 #include "light.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
4
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
5 FMATRIX normal_light;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
6 FMATRIX light_color;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
7
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
8 void light_init(LIGHT *l)
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
9 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
10 /**Three lights in all.
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
11 The color of the light of "light0" is color0.
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
12 The color of the light of "light1" is color1.
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
13 The color of the light of "light2" is color2.
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
14 **/
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
15
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
16 l->light0[0] = 0.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
17 l->light0[1] = 0.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
18 l->light0[2] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
19 l->light0[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
20
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
21 l->light1[0] = 0.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
22 l->light1[1] = -1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
23 l->light1[2] = 0.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
24 l->light1[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
25
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
26 l->light2[0] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
27 l->light2[1] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
28 l->light2[2] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
29 l->light2[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
30
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
31 l->color0[0] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
32 l->color0[1] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
33 l->color0[2] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
34 l->color0[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
35
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
36 l->color1[0] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
37 l->color1[1] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
38 l->color1[2] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
39 l->color1[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
40
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
41 l->color2[0] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
42 l->color2[1] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
43 l->color2[2] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
44 l->color2[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
45
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
46 /*Reflection degree of light*/
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
47 l->ambient[0] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
48 l->ambient[1] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
49 l->ambient[2] = 0.4;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
50 l->ambient[3] = 1.0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
51
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
52 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
53
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
54 void light_set(LIGHT *l)
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
55 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
56 ps2_vu0_normal_light_matrix(normal_light, l->light0, l->light1, l->light2);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
57 ps2_vu0_light_color_matrix(light_color, l->color0, l->color1, l->color2, l->ambient);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
58 }