view light.c @ 19:8ab79a86aa73

*** empty log message ***
author gongo
date Sat, 04 Nov 2006 09:13:06 +0000
parents b6a1385f19be
children 8edae89a3877
line wrap: on
line source

#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);
}