Use proper types

This commit is contained in:
Crayon2000 2022-11-20 14:40:19 -05:00
parent d3d4ce49b9
commit 423ff0881f
7 changed files with 31 additions and 30 deletions

View file

@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
- Fixed compatibility issues with devkitPPC release 39.
- Added `GRRLIB_LoadTTFFromFile()` to load a TTF from a file.
- Added `GRRLIB_Ellipse()` to draw an ellipse.
- Changed function arguments types in a few functions.
- Fixed documentation for `GRRLIB_Camera3dSettings()`, `GRRLIB_Screen2Texture()` and `GRRLIB_CompoEnd()`.
## [4.4.1][] - 2021-03-05

View file

@ -422,11 +422,11 @@ void GRRLIB_DrawTorus(f32 r, f32 R, int nsides, int rings, bool filled, u32 col)
*/
void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled, u32 col) {
for(int i = 0; i <= lats; i++) {
const f32 lat0 = M_PI * (-0.5F + (f32) (i - 1) / lats);
const f32 lat0 = M_PI * (-0.5f + (f32) (i - 1) / lats);
const f32 z0 = sinf(lat0);
const f32 zr0 = cosf(lat0);
const f32 lat1 = M_PI * (-0.5F + (f32) i / lats);
const f32 lat1 = M_PI * (-0.5f + (f32) i / lats);
const f32 z1 = sinf(lat1);
const f32 zr1 = cosf(lat1);
@ -486,7 +486,7 @@ void GRRLIB_DrawCube(f32 size, bool filled, u32 col) {
v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2;
v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2;
for (int i = 5; i >= 0; i--) {
for (s8 i = 5; i >= 0; i--) {
if(filled == true) {
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
}
@ -522,14 +522,14 @@ void GRRLIB_DrawCube(f32 size, bool filled, u32 col) {
* @param filled Wired or not.
* @param col Color of the cylinder.
*/
void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) {
void GRRLIB_DrawCylinder(f32 r, f32 h, u16 d, bool filled, u32 col) {
if(filled == true) {
GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2 * (d+1));
GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2 * (d + 1));
}
else {
GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2 * (d+1));
GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2 * (d + 1));
}
for(int i = 0; i <= d; i++) {
for(u16 i = 0; i <= d; i++) {
const f32 dx = cosf( M_PI * 2.0f * i / d );
const f32 dy = sinf( M_PI * 2.0f * i / d );
GX_Position3f32( r * dx, -0.5f * h, r * dy );
@ -550,7 +550,7 @@ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) {
GX_Position3f32(0.0f, -0.5f * h, 0.0f);
GX_Normal3f32(0.0f, -1.0f, 0.0f);
GX_Color1u32(col);
for(int i = 0; i <= d; i++) {
for(u16 i = 0; i <= d; i++) {
GX_Position3f32( r * cosf( M_PI * 2.0f * i / d ), -0.5f * h, r * sinf( M_PI * 2.0f * i / d ) );
GX_Normal3f32(0.0f, -1.0f, 0.0f);
GX_Color1u32(col);
@ -566,7 +566,7 @@ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) {
GX_Position3f32(0.0f, 0.5f * h, 0.0f);
GX_Normal3f32(0.0f, 1.0f, 0.0f);
GX_Color1u32(col);
for(int i = 0; i <= d; i++) {
for(u16 i = 0; i <= d; i++) {
GX_Position3f32( r * cosf( M_PI * 2.0f * i / d ), 0.5f * h, r * sinf( M_PI * 2.0f * i / d ) );
GX_Normal3f32(0.0f, 1.0f, 0.0f);
GX_Color1u32(col);
@ -582,14 +582,14 @@ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) {
* @param filled Wired or not.
* @param col Color of the cone.
*/
void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col) {
void GRRLIB_DrawCone(f32 r, f32 h, u16 d, bool filled, u32 col) {
if(filled == true) {
GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2 * (d+1));
GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2 * (d + 1));
}
else {
GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2 * (d+1));
GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2 * (d + 1));
}
for(int i = 0; i <= d; i++) {
for(u16 i = 0; i <= d; i++) {
const f32 dx = cosf( M_PI * 2.0f * i / d );
const f32 dy = sinf( M_PI * 2.0f * i / d );
GX_Position3f32( 0, -0.5f * h,0);
@ -610,7 +610,7 @@ void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col) {
GX_Position3f32(0.0f, 0.5f * h, 0.0f);
GX_Normal3f32(0.0f, 1.0f, 0.0f);
GX_Color1u32(col);
for(int i = 0; i <= d; i++) {
for(u16 i = 0; i <= d; i++) {
GX_Position3f32( r * cosf( M_PI * 2.0f * i / d ), 0.5f * h, r * sinf( M_PI * 2.0f * i / d ) );
GX_Normal3f32(0.0f, 1.0f, 0.0f);
GX_Color1u32(col);

View file

@ -164,8 +164,8 @@ void GRRLIB_SetTexture(GRRLIB_texImg *tex, bool rep);
void GRRLIB_DrawTorus(f32 r, f32 R, int nsides, int rings, bool filled, u32 col);
void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled, u32 col);
void GRRLIB_DrawCube(f32 size, bool filled, u32 col);
void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col);
void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col);
void GRRLIB_DrawCylinder(f32 r, f32 h, u16 d, bool filled, u32 col);
void GRRLIB_DrawCone(f32 r, f32 h, u16 d, bool filled, u32 col);
void GRRLIB_DrawTessPanel(f32 w, f32 wstep, f32 h, f32 hstep, bool filled, u32 col);
void GRRLIB_SetLightAmbient(u32 ambientcolor);
void GRRLIB_SetLightDiff(u8 num, guVector pos, f32 distattn, f32 brightness, u32 lightcolor);

View file

@ -47,42 +47,42 @@ int main() {
GRRLIB_ObjectViewTrans(0.0f,1.3f,0.0f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(0.0f,0.0f,90.0f);
GRRLIB_ObjectViewTrans(-1.3f,0.0f,0.0f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(0.0f,0.0f,180.0f);
GRRLIB_ObjectViewTrans(0.0f,-1.3f,0.0f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(0.0f,0.0f,-90.0f);
GRRLIB_ObjectViewTrans(1.3f,0.0f,0.0f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(-90.0f,0.0f,0.0f);
GRRLIB_ObjectViewTrans(0.0f,0.0f,-1.3f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(90.0f,0.0f,0.0f);
GRRLIB_ObjectViewTrans(0.0f,0.0f,1.3f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);

View file

@ -36,7 +36,7 @@ int main(int argc, char **argv) {
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_DrawTessPanel(6.2f, 0.17f, 3.7f, 0.1f, 0, 0xFFFFFFFF);
lightx+=0.05f;

View file

@ -47,42 +47,42 @@ int main() {
GRRLIB_ObjectViewTrans(0.0f,1.3f,0.0f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(0.0f,0.0f,90.0f);
GRRLIB_ObjectViewTrans(-1.3f,0.0f,0.0f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(0.0f,0.0f,180.0f);
GRRLIB_ObjectViewTrans(0.0f,-1.3f,0.0f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(0.0f,0.0f,-90.0f);
GRRLIB_ObjectViewTrans(1.3f,0.0f,0.0f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(-90.0f,0.0f,0.0f);
GRRLIB_ObjectViewTrans(0.0f,0.0f,-1.3f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(90.0f,0.0f,0.0f);
GRRLIB_ObjectViewTrans(0.0f,0.0f,1.3f);
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
GRRLIB_ObjectViewEnd();
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
GRRLIB_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF);
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);

View file

@ -36,7 +36,7 @@ int main(int argc, char **argv) {
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_DrawTessPanel(6.2f, 0.17f, 3.7f, 0.1f, 0, 0xFFFFFFFF);
lightx+=0.05f;