comparison light.c @ 0:0fae5658fb0b

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