diff light.c @ 0:0fae5658fb0b

Initial revision
author gongo
date Thu, 02 Nov 2006 08:55:19 +0000
parents
children b6a1385f19be
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/light.c	Thu Nov 02 08:55:19 2006 +0000
@@ -0,0 +1,62 @@
+#include <stdio.h>
+#include "libps2.h"
+#include "light.h"
+
+FMATRIX normal_light;
+FMATRIX light_color;
+
+void light_init(LIGHT *l)
+{
+  /**Three lights in all.
+     The color of the light of "light0" is color0.
+     The color of the light of "light1" is color1.
+     The color of the light of "light2" is color2.
+  **/
+
+  l->light0[0] = 0.0;
+  l->light0[1] = 0.0;
+  l->light0[2] = 1.0;
+  l->light0[3] = 1.0;
+
+  l->light1[0] = 0.0;
+  l->light1[1] = -1.0;
+  l->light1[2] = 0.0;
+  l->light1[3] = 1.0;
+
+  l->light2[0] = 1.0;
+  l->light2[1] = 1.0;
+  l->light2[2] = 1.0;
+  l->light2[3] = 1.0;
+
+  l->color0[0] = 0.4;
+  l->color0[1] = 0.4;
+  l->color0[2] = 0.4;
+  l->color0[3] = 1.0;
+
+  l->color1[0] = 0.4;
+  l->color1[1] = 0.4;
+  l->color1[2] = 0.4;
+  l->color1[3] = 1.0;
+
+  l->color2[0] = 0.4;
+  l->color2[1] = 0.4;
+  l->color2[2] = 0.4;
+  l->color2[3] = 1.0;
+
+  /*Reflection degree of light*/ 
+  l->ambient[0] = 0.4;
+  l->ambient[1] = 0.4;
+  l->ambient[2] = 0.4;
+  l->ambient[3] = 1.0;
+
+}
+
+void light_set(LIGHT *l)
+{
+  ps2_vu0_normal_light_matrix(normal_light, l->light0, l->light1, l->light2);
+  ps2_vu0_light_color_matrix(light_color, l->color0, l->color1, l->color2, l->ambient);
+}
+
+
+
+