diff --git a/GRRLIB/GRRLIB/GRRLIB_3D.c b/GRRLIB/GRRLIB/GRRLIB_3D.c index be5346e..9bf4ba6 100644 --- a/GRRLIB/GRRLIB/GRRLIB_3D.c +++ b/GRRLIB/GRRLIB/GRRLIB_3D.c @@ -325,7 +325,7 @@ void GRRLIB_ObjectViewInv(f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 * Set the texture to an object (contributed by chris_c aka DaShAmAn). * @param tex poiter to an image texture (GRRLIB_texImg format). * @param rep Texture Repeat Mode, True will repeat it, False won't. -*/ + */ void GRRLIB_SetTexture(GRRLIB_texImg *tex, bool rep) { GXTexObj texObj; @@ -356,7 +356,7 @@ void GRRLIB_SetTexture(GRRLIB_texImg *tex, bool rep) { * @param rings Number of rings. * @param filled Wired or not. * @param col Color of the torus. -*/ + */ void GRRLIB_DrawTorus(f32 r, f32 R, int nsides, int rings, bool filled, u32 col) { int i, j; f32 theta, phi, theta1; @@ -405,7 +405,7 @@ void GRRLIB_DrawTorus(f32 r, f32 R, int nsides, int rings, bool filled, u32 col) * @param longs Number of longitutes. * @param filled Wired or not. * @param col Color of the sphere. -*/ + */ void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled, u32 col) { int i, j; f32 lat0, z0, zr0, @@ -443,7 +443,7 @@ void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled, u32 col) { * @param size Size of the cube edge. * @param filled Wired or not. * @param col Color of the cube. -*/ + */ void GRRLIB_DrawCube(f32 size, bool filled, u32 col) { static f32 n[6][3] = { @@ -504,7 +504,7 @@ void GRRLIB_DrawCube(f32 size, bool filled, u32 col) { * @param d Dencity of slice. * @param filled Wired or not. * @param col Color of the cylinder. -*/ + */ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) { int i; f32 dx, dy; @@ -555,7 +555,7 @@ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) { * @param d Dencity of slice. * @param filled Wired or not. * @param col Color of the cone. -*/ + */ void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col) { int i; f32 dx, dy; @@ -594,8 +594,8 @@ void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col) { * @param h Height of the pannel. * @param hstep Size the de height slices. * @param filled Wired or not. - * @param col Color of the cone. -*/ + * @param col Color in RGBA format. + */ void GRRLIB_DrawTessPanel(f32 w, f32 wstep, f32 h, f32 hstep, bool filled, u32 col) { f32 x,y,tmpx, tmpy; int tmp; @@ -619,13 +619,11 @@ void GRRLIB_DrawTessPanel(f32 w, f32 wstep, f32 h, f32 hstep, bool filled, u32 c } } - - /** * Set ambient color. * When no diffuse ligth is shinig on a object, the color is equal to ambient color. * @param ambientcolor Ambient color in RGBA format. -*/ + */ void GRRLIB_SetLightAmbient(u32 ambientcolor) { GX_SetChanAmbColor(GX_COLOR0A0, (GXColor) { R(ambientcolor), G(ambientcolor), B(ambientcolor), 0xFF}); } @@ -637,7 +635,7 @@ void GRRLIB_SetLightAmbient(u32 ambientcolor) { * @param distattn Distance attenuation. * @param brightness Brightness of the light. The value should be between 0 and 1. * @param lightcolor Color of the light in RGBA format. -*/ + */ void GRRLIB_SetLightDiff(u8 num, guVector pos, f32 distattn, f32 brightness, u32 lightcolor) { GXLightObj MyLight; guVector lpos = {pos.x, pos.y, pos.z}; @@ -663,7 +661,7 @@ void GRRLIB_SetLightDiff(u8 num, guVector pos, f32 distattn, f32 brightness, u32 * @param shy Shyniness of the specular. ( between 4 and 254) * @param lightcolor Color of the light in RGBA format. * @param speccolor Specular color in RGBA format.. -*/ + */ void GRRLIB_SetLightSpec(u8 num, guVector dir, f32 shy, u32 lightcolor, u32 speccolor) { Mtx mr,mv; GXLightObj MyLight; @@ -712,37 +710,37 @@ void GRRLIB_SetLightSpec(u8 num, guVector dir, f32 shy, u32 lightcolor, u32 spec * @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); + 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< @@ -7,42 +7,42 @@ #include #include -#include "font.h" +#include "Snap_ITC_12.h" extern Mtx _GRR_view; int main(int argc, char **argv) { - f32 lightx=0.0f; + f32 lightx=0.0f; GRRLIB_Init(); - GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font); - GRRLIB_InitTileSet(tex_font, 16, 16, 32); + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(Snap_ITC_12); + GRRLIB_InitTileSet(tex_font, 17, 22, 32); WPAD_Init(); GRRLIB_SetBackgroundColour(0x40, 0x40, 0x40, 0xFF); while(1) { - GRRLIB_2dMode(); + GRRLIB_2dMode(); WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break; - GRRLIB_Camera3dSettings(0.0f,0.0f,3.0f, 0,1,0, 0,0,0); + GRRLIB_Camera3dSettings(0.0f,0.0f,3.0f, 0,1,0, 0,0,0); - GRRLIB_SetLightAmbient(0x404040FF); + GRRLIB_SetLightAmbient(0x404040FF); - GRRLIB_SetLightSpot(1, (guVector){ sin(lightx)*2.5f, 0.8f, 0 }, (guVector){ sin(lightx)*2.5f, 0.0f, 0.0f }, -4.0f, 5.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0x0000FFFF); - GRRLIB_SetLightSpot(2, (guVector){ -sin(lightx)*2.5f, 0.8f, 0 }, (guVector){ -sin(lightx)*2.5f, 0.0f, 0.0f }, -4.0f, 5.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0xFF0000FF); + GRRLIB_SetLightSpot(1, (guVector){ sin(lightx)*2.5f, 0.8f, 0 }, (guVector){ sin(lightx)*2.5f, 0.0f, 0.0f }, -4.0f, 5.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0x0000FFFF); + GRRLIB_SetLightSpot(2, (guVector){ -sin(lightx)*2.5f, 0.8f, 0 }, (guVector){ -sin(lightx)*2.5f, 0.0f, 0.0f }, -4.0f, 5.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0xFF0000FF); - GRRLIB_3dMode(0.1,1000,45,0,1); - GRRLIB_ObjectView(0,-0.8,0, -90,0,0,1,1,1); - GRRLIB_DrawTessPanel(6.2f,0.17f,3.7f,0.1f,0,0xFFFFFFFF); + GRRLIB_3dMode(0.1,1000,45,0,1); + GRRLIB_ObjectView(0,-0.8,0, -90,0,0,1,1,1); + GRRLIB_DrawTessPanel(6.2f,0.17f,3.7f,0.1f,0,0xFFFFFFFF); - lightx+=0.05f; + lightx+=0.05f; - GRRLIB_2dMode(); - GRRLIB_Printf((640-(16*28))/2, 480-16, tex_font, 0xFFFFFFFF, 1, "GRRLIB SPOT LIGHT SAMPLE 1"); + GRRLIB_2dMode(); + GRRLIB_Printf((640-(17*26))/2, 480-25, tex_font, 0xFFFFFFFF, 1, "GRRLIB SPOT LIGHT SAMPLE 1"); GRRLIB_Render();