More whitespace changes & comments

This commit is contained in:
csBlueChip 2009-09-03 02:58:58 +00:00
parent 9bd2aebaec
commit 1951835c9d

View file

@ -44,6 +44,8 @@ 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,9 +61,9 @@ void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
width = tex->w * 0.5;
height = tex->h * 0.5;
guMtxIdentity (m1);
guMtxScaleApply(m1, m1, scaleX, scaleY, 1.0);
guVector axis = (guVector) {0, 0, 1};
guMtxRotAxisDeg(m2, &axis, degrees);
guMtxConcat (m2, m1, m);
@ -93,8 +95,8 @@ 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_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
}
@ -107,13 +109,13 @@ void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
*/
void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
const u32 color) {
if (tex == NULL || tex->data == NULL) {
return;
}
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,
GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
@ -127,7 +129,6 @@ void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
guMtxIdentity (m1);
guMtxScaleApply(m1, m1, 1, 1, 1.0);
guVector axis = (guVector) {0, 0, 1};
guMtxRotAxisDeg(m2, &axis, 0);
guMtxConcat (m2, m1, m);
@ -151,8 +152,8 @@ 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_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
}
@ -171,14 +172,14 @@ void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
const f32 degrees, const f32 scaleX, const f32 scaleY,
const u32 color, const int frame) {
if (tex == NULL || tex->data == NULL) {
return;
}
GXTexObj texObj;
f32 width, height;
Mtx m, m1, m2, mv;
guVector axis = (guVector){0, 0, 1};
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);
@ -195,18 +196,17 @@ void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
width = tex->tilew * 0.5f;
height = tex->tileh * 0.5f;
guMtxIdentity (m1);
guMtxScaleApply(m1, m1, scaleX, scaleY, 1.0f);
guVector axis = (guVector) {0, 0, 1};
guMtxRotAxisDeg(m2, &axis, degrees);
guMtxConcat (m2, m1, m);
guMtxTransApply(m, m,
xpos +width +tex->handlex
-tex->offsetx +( scaleX *(-tex->handley *sin(-DegToRad(degrees))
@ -235,8 +235,8 @@ 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_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
}
@ -250,13 +250,13 @@ void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
*/
void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
const u32 color, const int frame) {
if (tex == NULL || tex->data == NULL) {
return;
}
GXTexObj texObj;
Mtx m, m1, m2, mv;
guVector axis = (guVector){0, 0, 1};
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);
@ -273,14 +273,11 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
guMtxIdentity (m1);
guMtxScaleApply(m1, m1, 1, 1, 1.0f);
guVector axis = (guVector) {0, 0, 1};
guMtxRotAxisDeg(m2, &axis, 0);
guMtxConcat(m2, m1, m);
@ -304,8 +301,8 @@ 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_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
}
@ -314,17 +311,18 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
* Call this function after drawing.
*/
void GRRLIB_Render (void) {
GX_DrawDone();
GX_DrawDone(); // Tell the GX engine we are done drawing
GX_InvalidateTexAll();
fb ^= 1; // Flip framebuffer
fb ^= 1; // Toggle framebuffer index
GX_SetZMode (GX_TRUE, GX_LEQUAL, GX_TRUE);
GX_SetColorUpdate(GX_TRUE);
GX_CopyDisp (xfb[fb], GX_TRUE);
VIDEO_SetNextFramebuffer(xfb[fb]);
VIDEO_Flush();
VIDEO_WaitVSync();
VIDEO_SetNextFramebuffer(xfb[fb]); // Select eXternal Frame Buffer
VIDEO_Flush(); // Flush video buffer to screen
VIDEO_WaitVSync(); // Wait for screen to update
// Interlaced screens require two frames to update
if (rmode->viTVMode &VI_NON_INTERLACE) VIDEO_WaitVSync() ;
}