From 16d32f32ed93b06d56396f75e3738d9687b891b9 Mon Sep 17 00:00:00 2001 From: N0NameN0 Date: Mon, 10 May 2010 22:37:34 +0000 Subject: [PATCH] [ADD] I finnaly commiting GRRLIB_SetLightSpot ;) --- GRRLIB/GRRLIB/GRRLIB_3D.c | 39 ++++++++++++++++++++++++++++++ GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h | 1 + 2 files changed, 40 insertions(+) diff --git a/GRRLIB/GRRLIB/GRRLIB_3D.c b/GRRLIB/GRRLIB/GRRLIB_3D.c index 0ca028f..be5346e 100644 --- a/GRRLIB/GRRLIB/GRRLIB_3D.c +++ b/GRRLIB/GRRLIB/GRRLIB_3D.c @@ -700,6 +700,45 @@ void GRRLIB_SetLightSpec(u8 num, guVector dir, f32 shy, u32 lightcolor, u32 spec GX_SetChanMatColor(GX_COLOR1, (GXColor) { R(speccolor), G(speccolor), B(speccolor), 0xFF }); // couleur du reflet specular } +/** + * Set Spot light parameters. + * @param num Number of the light. It's a number from 0 to 7. + * @param pos Position of the spot light (x/y/z). + * @param lookat Where spot light look at (x/y/z). + * @param angAttn0 cone attenuation factor 0. + * @param angAttn1 cone attenuation factor 1. + * @param angAttn2 cone attenuation factor 2. + * @param distAttn0 Distance attenuation factor 0. + * @param distAttn1 Distance attenuation factor 1. + * @param distAttn2 Distance attenuation factor 2. + * @param lightcolor Color of the light in RGBA format. +*/ +void GRRLIB_SetLightSpot(u8 num, guVector pos, guVector lookat, f32 angAttn0, f32 angAttn1, f32 angAttn2, f32 distAttn0, f32 distAttn1, f32 distAttn2, u32 lightcolor) { + GXLightObj lobj; + guVector lpos = (guVector){ pos.x, pos.y, pos.z }; + guVector ldir = (guVector){ lookat.x-pos.x, lookat.y-pos.y, lookat.z-pos.z }; + guVecNormalize(&ldir); + + GRRLIB_Settings.lights |= (1<