[CHG] Files cleanup

This commit is contained in:
Crayon2000 2010-01-05 22:28:13 +00:00
parent 45a9b43afb
commit 25876beeb9
2 changed files with 53 additions and 56 deletions

View file

@ -103,7 +103,6 @@ void GRRLIB_3dMode(f32 minDist, f32 maxDist, f32 fov, bool colormode, bool textu
if(texturemode==FALSE) GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
else GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
}
/**
@ -170,7 +169,6 @@ void GRRLIB_ObjectView(f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 ang
GX_LoadNrmMtxImm(mv, GX_PNMTX0);
}
/**
* Set the texture to an object (contributed by chris_c aka DaShAmAn).
* @param tex poiter to an image texture (GRRLIB_texImg format).
@ -199,13 +197,13 @@ void GRRLIB_SetTexture(GRRLIB_texImg *tex, bool rep) {
}
/**
* Initialise a Diffuse Light.
* @param id a light ID in libogc style : GX_LIGHT0,..., GX_LIGHT7).
* @param lpos a guVector x,y,z position of the light.
* @param lcol color of the light.
* Initialise a diffuse light.
* @param id A light ID in libogc style : GX_LIGHT0,..., GX_LIGHT7.
* @param lpos A guVector x,y,z position of the light.
* @param lcol Color of the light.
*/
void GRRLIB_InitLight(u8 id, guVector lpos, u32 lcol){
GXLightObj MyLight;
void GRRLIB_InitLight(u8 id, guVector lpos, u32 lcol) {
GXLightObj MyLight;
guVecMultiply(_GRR_view, &lpos, &lpos);
GX_InitLightPos(&MyLight, lpos.x, lpos.y, lpos.z);
GX_InitLightColor(&MyLight, (GXColor) { R(lcol), G(lcol),B(lcol), A(lcol) });
@ -214,9 +212,9 @@ GXLightObj MyLight;
}
/**
* All Light Off, colors come from the Vertex.
* All light off, colors come from the Vertex.
*/
void GRRLIB_LightOff(void){
void GRRLIB_LightOff(void) {
GX_SetNumChans(1);
GX_SetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE);
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
@ -224,12 +222,12 @@ void GRRLIB_LightOff(void){
/**
* Define what light to turn on and some other param.
* @param id light IDs of the desired switched ON lights (ORed) (ie GX_LIGHT0|GX_LIGHT7).
* @param id Light IDs of the desired switched ON lights (ORed) (ie GX_LIGHT0|GX_LIGHT7).
* @param ambcol Ambiant color u32 formated
* @param matcol Material color u32 formated.
* @param colsrc Material color sources comes from the Vertex ???? (True/False)
*/
void GRRLIB_LightSwitch(u8 id, u32 ambcol, u32 matcol, u8 colsrc){
void GRRLIB_LightSwitch(u8 id, u32 ambcol, u32 matcol, u8 colsrc) {
u8 src;
if(colsrc==0) src = GX_SRC_REG;
else src = GX_SRC_VTX;
@ -239,4 +237,3 @@ void GRRLIB_LightSwitch(u8 id, u32 ambcol, u32 matcol, u8 colsrc){
GX_SetChanAmbColor(GX_COLOR0A0, (GXColor) { R(ambcol), G(ambcol), B(ambcol), A(ambcol)});
GX_SetChanMatColor(GX_COLOR0A0, (GXColor) { R(matcol), G(matcol), B(matcol), A(matcol)});
}

View file

@ -31,10 +31,10 @@ typedef struct GRRLIB_3dObj {
#include "torus.h"
void GRRLIB_Draw3dObj(GRRLIB_3dObj obj, u32 col, bool tex, bool norm){
int i;
void GRRLIB_Draw3dObj(GRRLIB_3dObj obj, u32 col, bool tex, bool norm) {
int i;
GX_Begin(GX_TRIANGLES, GX_VTXFMT0, obj.NbFace*3);
for(i=0;i<obj.NbFace*3;i+=3){
for(i=0;i<obj.NbFace*3;i+=3) {
GX_Position3f32(obj.Pos[obj.FacPos[i]-1].x,obj.Pos[obj.FacPos[i]-1].y,-obj.Pos[obj.FacPos[i]-1].z);
if(col) GX_Color1u32 (col);
if(norm) GX_Normal3f32(obj.Nrm[obj.FacNrm[i]-1].x,obj.Nrm[obj.FacNrm[i]-1].y,-obj.Nrm[obj.FacNrm[i]-1].z);
@ -75,10 +75,10 @@ int main() {
GRRLIB_2dMode();
WPAD_ScanPads();
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_PLUS){if(Amb<255) Amb++; }
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_MINUS){if(Amb>0) Amb--; }
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A){zlight++; }
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B){zlight--; }
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_PLUS) {if(Amb<255) Amb++; }
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_MINUS) {if(Amb>0) Amb--; }
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A) {zlight++; }
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) {zlight--; }
GRRLIB_3dMode(0.1,1000,45,0,0,1);