From 4ab8726ffe83bcbfc656b2809193c0459a826808 Mon Sep 17 00:00:00 2001 From: Crayon2000 Date: Thu, 7 Jan 2010 00:03:56 +0000 Subject: [PATCH] [CHG] Updated the README.html file --- GRRLIB/GRRLIB/GRRLIB_3D.c | 55 +++++++++++++++++++-------------------- README.html | 14 +++++----- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/GRRLIB/GRRLIB/GRRLIB_3D.c b/GRRLIB/GRRLIB/GRRLIB_3D.c index e8259c1..ed99484 100644 --- a/GRRLIB/GRRLIB/GRRLIB_3D.c +++ b/GRRLIB/GRRLIB/GRRLIB_3D.c @@ -252,6 +252,7 @@ void GRRLIB_DrawTorus(f32 r, f32 R, int nsides, int rings, bool filled){ f32 cosTheta, sinTheta; f32 cosTheta1, sinTheta1; f32 ringDelta, sideDelta; + f32 cosPhi, sinPhi, dist; ringDelta = 2.0 * M_PI / rings; sideDelta = 2.0 * M_PI / nsides; @@ -260,41 +261,39 @@ void GRRLIB_DrawTorus(f32 r, f32 R, int nsides, int rings, bool filled){ cosTheta = 1.0; sinTheta = 0.0; for (i = rings - 1; i >= 0; i--) { - theta1 = theta + ringDelta; - cosTheta1 = cos(theta1); - sinTheta1 = sin(theta1); - if(filled) GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2*(nsides+1)); - else GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2*(nsides+1)); - phi = 0.0; - for (j = nsides; j >= 0; j--) { - f32 cosPhi, sinPhi, dist; - - phi += sideDelta; - cosPhi = cos(phi); - sinPhi = sin(phi); - dist = R + r * cosPhi; - - GX_Position3f32(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); - GX_Normal3f32(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); - GX_Position3f32(cosTheta * dist, -sinTheta * dist, r * sinPhi); - GX_Normal3f32(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); - } - GX_End(); - theta = theta1; - cosTheta = cosTheta1; - sinTheta = sinTheta1; + theta1 = theta + ringDelta; + cosTheta1 = cos(theta1); + sinTheta1 = sin(theta1); + if(filled) GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2*(nsides+1)); + else GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2*(nsides+1)); + phi = 0.0; + for (j = nsides; j >= 0; j--) { + phi += sideDelta; + cosPhi = cos(phi); + sinPhi = sin(phi); + dist = R + r * cosPhi; + + GX_Position3f32(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); + GX_Normal3f32(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); + GX_Position3f32(cosTheta * dist, -sinTheta * dist, r * sinPhi); + GX_Normal3f32(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); + } + GX_End(); + theta = theta1; + cosTheta = cosTheta1; + sinTheta = sinTheta1; } } /** * Draw a Sphere (with normal). - * @param r Radius of the Sprhere. + * @param r Radius of the Sphere. * @param lats Number of lattitudes. * @param longs Number of Longitutes. * @param filled Wired or not. */ void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled) { - int i,j; + int i, j; for(i = 0; i <= lats; i++) { f32 lat0 = M_PI * (-0.5F + (f32) (i - 1) / lats); @@ -304,10 +303,10 @@ void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled) { f32 lat1 = M_PI * (-0.5F + (f32) i / lats); f32 z1 = sin(lat1); f32 zr1 = cos(lat1); - if(filled) GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2*(longs+1)); - else GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2*(longs+1)); + if(filled) GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2*(longs+1)); + else GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2*(longs+1)); for(j = 0; j <= longs; j++) { - f32 lng = 2 * M_PI * (f32) (j - 1) / longs; + f32 lng = 2 * M_PI * (f32) (j - 1) / longs; f32 x = cos(lng); f32 y = sin(lng); diff --git a/README.html b/README.html index 26addd1..bd01a70 100644 --- a/README.html +++ b/README.html @@ -97,7 +97,7 @@ are smart enough to convert these instructions. GRRLIB is supplied as source code. libjpeg is supplied as a precompiled library *1 libpngu is supplied as source code -libpng is supplied as a precompiled library +libpng is supplied as source code libz is supplied with devkitpro (Ie. preinstalled) libfat is supplied with devkitpro (Ie. preinstalled) libfreetype is supplied as a precompiled library @@ -114,23 +114,23 @@ libz comes preinstalled with devkitPro, so we can move directly to libpng... To install libpng *2 c: cd \grr\trunk\GRRLIB\lib\png - make install + make clean all install Next up the list is libpngu *2 c: cd \grr\trunk\GRRLIB\lib\pngu make clean all install -To install libfreetype *2 - c: - cd \grr\trunk\GRRLIB\lib\freetype - make install - Next up the list is libjpeg *2 *3 c: cd \grr\trunk\GRRLIB\lib\jpeg make install +Next up the list is libfreetype *2 + c: + cd \grr\trunk\GRRLIB\lib\freetype + make install + *2 A Windows batch-file and a Linux shell-script are included which will install the libpng, libpngu, libjpeg and libfreetype libraries in a single command: