From 3397798833a699d97b7a8ccfb9afb348722e1e2a Mon Sep 17 00:00:00 2001 From: Crayon2000 Date: Fri, 14 May 2010 02:31:28 +0000 Subject: [PATCH] [CHG] The font for 3D_Light4 demo as changed --- GRRLIB/GRRLIB/GRRLIB_3D.c | 62 ++- examples/3D_Light4/source/Snap_ITC_12.c | 402 ++++++++++++++++++ .../source/{font.h => Snap_ITC_12.h} | 17 +- examples/3D_Light4/source/Snap_ITC_12.png | Bin 0 -> 6310 bytes examples/3D_Light4/source/font.c | 67 --- examples/3D_Light4/source/font.png | Bin 932 -> 0 bytes examples/3D_Light4/source/main.c | 32 +- 7 files changed, 456 insertions(+), 124 deletions(-) create mode 100644 examples/3D_Light4/source/Snap_ITC_12.c rename examples/3D_Light4/source/{font.h => Snap_ITC_12.h} (59%) create mode 100644 examples/3D_Light4/source/Snap_ITC_12.png delete mode 100644 examples/3D_Light4/source/font.c delete mode 100644 examples/3D_Light4/source/font.png 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<DM!fUC$!nSA z)n0X0P3}w)#JnoeV}Jg)TOm98Oq27US;-MQJ8tEFulxl_6AeXi{0sGOFln@}4ga63 z>r+_R{m#t$-*~!m5%>DC5BH~4d>IjU*QdVjn*?A)^a=!mKNqn%iuwbmQg1Sw> zWryGqDssrEI@v+;D#JeL=mGuNI$gJ%jtA;=_GP96F8S#zd0RM*HvkR(w(B~2$Yk7+ zhV;j?YjW5M|HzuwAGGDZdJU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`jlz>BqhS4OTl^T|McnvP7ryV zAmg9S30~QZD|=ps^Z67N&A+4SjB!?uA?Rwt$(ZW=Oq^a0000000000Snv<4xnH#}UeZti0000 @@ -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();