mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-12-23 02:39:19 +00:00
/more/ whitespace cleanup
This commit is contained in:
parent
1951835c9d
commit
c81b5bacb3
1 changed files with 33 additions and 40 deletions
|
@ -27,6 +27,8 @@ THE SOFTWARE.
|
|||
extern GRRLIB_drawSettings GRRLIB_Settings;
|
||||
extern Mtx GXmodelView2D;
|
||||
|
||||
static guVector axis = (guVector){0, 0, 1};
|
||||
|
||||
/**
|
||||
* Draw a texture.
|
||||
* @param xpos Specifies the x-coordinate of the upper-left corner.
|
||||
|
@ -44,8 +46,6 @@ void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
|
|||
u16 width, height;
|
||||
Mtx m, m1, m2, mv;
|
||||
|
||||
guVector axis = (guVector){0, 0, 1};
|
||||
|
||||
if (tex == NULL || tex->data == NULL) return ;
|
||||
|
||||
GX_InitTexObj(&texObj, tex->data, tex->w, tex->h,
|
||||
|
@ -59,14 +59,14 @@ void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
|
|||
GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
|
||||
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
|
||||
width = tex->w * 0.5;
|
||||
height = tex->h * 0.5;
|
||||
|
||||
guMtxIdentity (m1);
|
||||
guMtxScaleApply(m1, m1, scaleX, scaleY, 1.0);
|
||||
guMtxRotAxisDeg(m2, &axis, degrees);
|
||||
guMtxConcat (m2, m1, m);
|
||||
|
||||
width = tex->w * 0.5;
|
||||
height = tex->h * 0.5;
|
||||
|
||||
guMtxTransApply(m, m,
|
||||
xpos +width +tex->handlex
|
||||
-tex->offsetx +( scaleX *(-tex->handley *sin(-DegToRad(degrees))
|
||||
|
@ -95,10 +95,10 @@ void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
|
|||
GX_Color1u32 (color);
|
||||
GX_TexCoord2f32(0, 1);
|
||||
GX_End();
|
||||
|
||||
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
|
||||
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,8 +112,6 @@ void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
|
|||
GXTexObj texObj;
|
||||
Mtx m, m1, m2, mv;
|
||||
|
||||
guVector axis = (guVector){0, 0, 1};
|
||||
|
||||
if (tex == NULL || tex->data == NULL) return ;
|
||||
|
||||
GX_InitTexObj(&texObj, tex->data, tex->w, tex->h,
|
||||
|
@ -131,8 +129,7 @@ void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
|
|||
guMtxScaleApply(m1, m1, 1, 1, 1.0);
|
||||
guMtxRotAxisDeg(m2, &axis, 0);
|
||||
guMtxConcat (m2, m1, m);
|
||||
|
||||
guMtxConcat(GXmodelView2D, m, mv);
|
||||
guMtxConcat (GXmodelView2D, m, mv);
|
||||
|
||||
GX_LoadPosMtxImm(mv, GX_PNMTX0);
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
|
@ -152,10 +149,10 @@ void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
|
|||
GX_Color1u32 (color);
|
||||
GX_TexCoord2f32(0, 1);
|
||||
GX_End();
|
||||
|
||||
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
|
||||
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,17 +172,15 @@ void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
|
|||
GXTexObj texObj;
|
||||
f32 width, height;
|
||||
Mtx m, m1, m2, mv;
|
||||
|
||||
guVector axis = (guVector){0, 0, 1};
|
||||
f32 s1, s2, t1, t2;
|
||||
|
||||
if (tex == NULL || tex->data == NULL) return ;
|
||||
|
||||
// Frame Correction by spiffen
|
||||
f32 FRAME_CORR = 0.001f;
|
||||
f32 s1 = (( (frame%tex->nbtilew) ) /(f32)tex->nbtilew) +(FRAME_CORR/tex->w);
|
||||
f32 s2 = (( (frame%tex->nbtilew)+1) /(f32)tex->nbtilew) -(FRAME_CORR/tex->w);
|
||||
f32 t1 = (((int)(frame/tex->nbtilew) ) /(f32)tex->nbtileh) +(FRAME_CORR/tex->h);
|
||||
f32 t2 = (((int)(frame/tex->nbtilew)+1) /(f32)tex->nbtileh) -(FRAME_CORR/tex->h);
|
||||
// The 0.001f/x is the frame correction formula by spiffen
|
||||
s1 = (( (frame %tex->nbtilew) ) /(f32)tex->nbtilew) +(0.001f /tex->w);
|
||||
s2 = (( (frame %tex->nbtilew) +1) /(f32)tex->nbtilew) -(0.001f /tex->w);
|
||||
t1 = (((int)(frame /tex->nbtilew) ) /(f32)tex->nbtileh) +(0.001f /tex->h);
|
||||
t2 = (((int)(frame /tex->nbtilew) +1) /(f32)tex->nbtileh) -(0.001f /tex->h);
|
||||
|
||||
GX_InitTexObj(&texObj, tex->data,
|
||||
tex->tilew * tex->nbtilew, tex->tileh * tex->nbtileh,
|
||||
|
@ -215,6 +210,7 @@ void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
|
|||
-tex->offsety +( scaleX *(-tex->handley *cos(-DegToRad(degrees))
|
||||
+tex->handlex *sin(-DegToRad(degrees))) ),
|
||||
0);
|
||||
|
||||
guMtxConcat(GXmodelView2D, m, mv);
|
||||
|
||||
GX_LoadPosMtxImm(mv, GX_PNMTX0);
|
||||
|
@ -235,10 +231,10 @@ void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
|
|||
GX_Color1u32 (color);
|
||||
GX_TexCoord2f32(s1, t2);
|
||||
GX_End();
|
||||
|
||||
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
|
||||
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,17 +248,15 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
|
|||
const u32 color, const int frame) {
|
||||
GXTexObj texObj;
|
||||
Mtx m, m1, m2, mv;
|
||||
|
||||
guVector axis = (guVector){0, 0, 1};
|
||||
f32 s1, s2, t1, t2;
|
||||
|
||||
if (tex == NULL || tex->data == NULL) return ;
|
||||
|
||||
// Frame Correction by spiffen
|
||||
f32 FRAME_CORR = 0.001f;
|
||||
f32 s1 = (( (frame%tex->nbtilew) ) /(f32)tex->nbtilew) +(FRAME_CORR/tex->w);
|
||||
f32 s2 = (( (frame%tex->nbtilew)+1) /(f32)tex->nbtilew) -(FRAME_CORR/tex->w);
|
||||
f32 t1 = (((int)(frame/tex->nbtilew) ) /(f32)tex->nbtileh) +(FRAME_CORR/tex->h);
|
||||
f32 t2 = (((int)(frame/tex->nbtilew)+1) /(f32)tex->nbtileh) -(FRAME_CORR/tex->h);
|
||||
// The 0.001f/x is the frame correction formula by spiffen
|
||||
s1 = (( (frame %tex->nbtilew) ) /(f32)tex->nbtilew) +(0.001f /tex->w);
|
||||
s2 = (( (frame %tex->nbtilew) +1) /(f32)tex->nbtilew) -(0.001f /tex->w);
|
||||
t1 = (((int)(frame /tex->nbtilew) ) /(f32)tex->nbtileh) +(0.001f /tex->h);
|
||||
t2 = (((int)(frame /tex->nbtilew) +1) /(f32)tex->nbtileh) -(0.001f /tex->h);
|
||||
|
||||
GX_InitTexObj(&texObj, tex->data,
|
||||
tex->tilew * tex->nbtilew, tex->tileh * tex->nbtileh,
|
||||
|
@ -279,9 +273,8 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
|
|||
guMtxIdentity (m1);
|
||||
guMtxScaleApply(m1, m1, 1, 1, 1.0f);
|
||||
guMtxRotAxisDeg(m2, &axis, 0);
|
||||
guMtxConcat(m2, m1, m);
|
||||
|
||||
guMtxConcat(GXmodelView2D, m, mv);
|
||||
guMtxConcat (m2, m1, m);
|
||||
guMtxConcat (GXmodelView2D, m, mv);
|
||||
|
||||
GX_LoadPosMtxImm(mv, GX_PNMTX0);
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
|
@ -301,10 +294,10 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
|
|||
GX_Color1u32 (color);
|
||||
GX_TexCoord2f32(s1, t2);
|
||||
GX_End();
|
||||
|
||||
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
|
||||
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue