mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 15:02:20 +00:00
[CHG] Function should start with upper case character
This commit is contained in:
parent
bd928df11b
commit
c63ad06ac9
8 changed files with 41 additions and 43 deletions
|
@ -22,6 +22,15 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include <grrlib.h>
|
#include <grrlib.h>
|
||||||
|
|
||||||
|
// User should not directly modify these
|
||||||
|
static Mtx _GRR_view;
|
||||||
|
static guVector _GRR_cam = {0.0F, 0.0F, 0.0F},
|
||||||
|
_GRR_up = {0.0F, 1.0F, 0.0F},
|
||||||
|
_GRR_look = {0.0F, 0.0F, -100.0F};
|
||||||
|
static guVector _GRRaxisx = (guVector){1, 0, 0}; // DO NOT MODIFY!!!
|
||||||
|
static guVector _GRRaxisy = (guVector){0, 1, 0}; // Even at runtime
|
||||||
|
static guVector _GRRaxisz = (guVector){0, 0, 1}; // NOT ever!
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the background parameter when screen is cleared.
|
* Set the background parameter when screen is cleared.
|
||||||
* @param r Red component.
|
* @param r Red component.
|
||||||
|
@ -29,16 +38,10 @@ THE SOFTWARE.
|
||||||
* @param b Blue component.
|
* @param b Blue component.
|
||||||
* @param a Alpha component.
|
* @param a Alpha component.
|
||||||
*/
|
*/
|
||||||
void GRRLIB_setBackgroundColour(u8 r, u8 g, u8 b, u8 a) {
|
void GRRLIB_SetBackgroundColour(u8 r, u8 g, u8 b, u8 a) {
|
||||||
GX_SetCopyClear((GXColor){ r, g, b, a }, GX_MAX_Z24);
|
GX_SetCopyClear((GXColor){ r, g, b, a }, GX_MAX_Z24);
|
||||||
}
|
}
|
||||||
|
|
||||||
// user should not directly modify these
|
|
||||||
guVector _GRR_cam = {0.0F, 0.0F, 0.0F},
|
|
||||||
_GRR_up = {0.0F, 1.0F, 0.0F},
|
|
||||||
_GRR_look = {0.0F, 0.0F, -100.0F};
|
|
||||||
Mtx _GRR_view;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the camera parameter (contributed my chris_c aka DaShAmAn).
|
* Set the camera parameter (contributed my chris_c aka DaShAmAn).
|
||||||
* @param posx x posision of the cam.
|
* @param posx x posision of the cam.
|
||||||
|
@ -51,7 +54,7 @@ Mtx _GRR_view;
|
||||||
* @param looky y up posision of the cam.
|
* @param looky y up posision of the cam.
|
||||||
* @param lookz z up posision of the cam.
|
* @param lookz z up posision of the cam.
|
||||||
*/
|
*/
|
||||||
void GRRLIB_camera3dSettings(f32 posx, f32 posy, f32 posz,
|
void GRRLIB_Camera3dSettings(f32 posx, f32 posy, f32 posz,
|
||||||
f32 upx, f32 upy, f32 upz,
|
f32 upx, f32 upy, f32 upz,
|
||||||
f32 lookx, f32 looky, f32 lookz) {
|
f32 lookx, f32 looky, f32 lookz) {
|
||||||
|
|
||||||
|
@ -128,10 +131,6 @@ void GRRLIB_2dMode() {
|
||||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static guVector _GRRaxisx = (guVector){1,0,0}; // DO NOT MODIFY!!!
|
|
||||||
static guVector _GRRaxisy = (guVector){0,1,0}; // Even at runtime
|
|
||||||
static guVector _GRRaxisz = (guVector){0,0,1}; // NOT ever!
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the view matrix to draw object (contributed my chris_c aka DaShAmAn).
|
* Set the view matrix to draw object (contributed my chris_c aka DaShAmAn).
|
||||||
* @param posx x posision of the object.
|
* @param posx x posision of the object.
|
||||||
|
@ -141,7 +140,7 @@ static guVector _GRRaxisz = (guVector){0,0,1}; // NOT ever!
|
||||||
* @param angy y rotation angle of the object.
|
* @param angy y rotation angle of the object.
|
||||||
* @param angz z rotation angle of the object.
|
* @param angz z rotation angle of the object.
|
||||||
*/
|
*/
|
||||||
void GRRLIB_objectView(f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 angz) {
|
void GRRLIB_ObjectView(f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 angz) {
|
||||||
Mtx m, mv, rx, ry, rz;
|
Mtx m, mv, rx, ry, rz;
|
||||||
Mtx mvi ;
|
Mtx mvi ;
|
||||||
|
|
||||||
|
@ -166,7 +165,7 @@ void GRRLIB_objectView(f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 ang
|
||||||
* @param tex poiter to an image texture (GRRLIB_texImg format).
|
* @param tex poiter to an image texture (GRRLIB_texImg format).
|
||||||
* @param rep Texture Repeat Mode, True will repeat it, False won't.
|
* @param rep Texture Repeat Mode, True will repeat it, False won't.
|
||||||
*/
|
*/
|
||||||
void GRRLIB_setTexture(GRRLIB_texImg *tex, bool rep) {
|
void GRRLIB_SetTexture(GRRLIB_texImg *tex, bool rep) {
|
||||||
GXTexObj texObj;
|
GXTexObj texObj;
|
||||||
|
|
||||||
if (rep) {
|
if (rep) {
|
||||||
|
@ -187,4 +186,3 @@ void GRRLIB_setTexture(GRRLIB_texImg *tex, bool rep) {
|
||||||
GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
|
GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
|
||||||
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,12 +140,12 @@ void GRRLIB_GeckoPrintf (const char *text, ...);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// GRRLIB_3D.c - 3D functions for GRRLIB
|
// GRRLIB_3D.c - 3D functions for GRRLIB
|
||||||
void GRRLIB_setBackgroundColour(u8 r, u8 g, u8 b, u8 a);
|
void GRRLIB_SetBackgroundColour(u8 r, u8 g, u8 b, u8 a);
|
||||||
void GRRLIB_camera3dSettings(f32 posx, f32 posy, f32 posz, f32 upx, f32 upy, f32 upz, f32 lookx, f32 looky, f32 lookz);
|
void GRRLIB_Camera3dSettings(f32 posx, f32 posy, f32 posz, f32 upx, f32 upy, f32 upz, f32 lookx, f32 looky, f32 lookz);
|
||||||
void GRRLIB_3dMode(f32 minDist, f32 maxDist, f32 fov, bool texturemode);
|
void GRRLIB_3dMode(f32 minDist, f32 maxDist, f32 fov, bool texturemode);
|
||||||
void GRRLIB_2dMode();
|
void GRRLIB_2dMode();
|
||||||
void GRRLIB_objectView(f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 angz);
|
void GRRLIB_ObjectView(f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 angz);
|
||||||
void GRRLIB_setTexture(GRRLIB_texImg *tex, bool rep);
|
void GRRLIB_SetTexture(GRRLIB_texImg *tex, bool rep);
|
||||||
|
|
||||||
|
|
||||||
#endif // __GRRLIB_FNLIB_H__
|
#endif // __GRRLIB_FNLIB_H__
|
||||||
|
|
|
@ -155,7 +155,7 @@ int main() {
|
||||||
|
|
||||||
GRRLIB_texImg *tex_screen = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->efbHeight);
|
GRRLIB_texImg *tex_screen = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->efbHeight);
|
||||||
|
|
||||||
GRRLIB_setBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
GRRLIB_2dMode();
|
GRRLIB_2dMode();
|
||||||
|
@ -276,10 +276,10 @@ int main() {
|
||||||
GRRLIB_Screen2Texture(0, 0, tex_screen, GX_TRUE);
|
GRRLIB_Screen2Texture(0, 0, tex_screen, GX_TRUE);
|
||||||
|
|
||||||
|
|
||||||
GRRLIB_camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0);
|
GRRLIB_Camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0);
|
||||||
GRRLIB_3dMode(0.1,3000,45,1);
|
GRRLIB_3dMode(0.1,3000,45,1);
|
||||||
GRRLIB_setTexture(tex_screen,0);
|
GRRLIB_SetTexture(tex_screen,0);
|
||||||
GRRLIB_objectView(0,0,0, a,a*2,a*3);
|
GRRLIB_ObjectView(0,0,0, a,a*2,a*3);
|
||||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 16);
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 16);
|
||||||
GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2);
|
GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2);
|
||||||
GX_Color1u32(col[0]);
|
GX_Color1u32(col[0]);
|
||||||
|
|
|
@ -24,8 +24,8 @@ int main() {
|
||||||
|
|
||||||
GRRLIB_Settings.antialias = true;
|
GRRLIB_Settings.antialias = true;
|
||||||
|
|
||||||
GRRLIB_setBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
||||||
GRRLIB_camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);
|
GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
GRRLIB_2dMode();
|
GRRLIB_2dMode();
|
||||||
|
@ -35,7 +35,7 @@ int main() {
|
||||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) cubeZ--;
|
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) cubeZ--;
|
||||||
|
|
||||||
GRRLIB_3dMode(0.1,1000,45,0);
|
GRRLIB_3dMode(0.1,1000,45,0);
|
||||||
GRRLIB_objectView(0,0,cubeZ, a,a*2,a*3);
|
GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3);
|
||||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
||||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||||
GX_Color1u32(col[0]);
|
GX_Color1u32(col[0]);
|
||||||
|
|
|
@ -29,8 +29,8 @@ int main() {
|
||||||
|
|
||||||
GRRLIB_Settings.antialias = true;
|
GRRLIB_Settings.antialias = true;
|
||||||
|
|
||||||
GRRLIB_setBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
||||||
GRRLIB_camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);
|
GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
GRRLIB_2dMode();
|
GRRLIB_2dMode();
|
||||||
|
@ -40,8 +40,8 @@ int main() {
|
||||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) cubeZ--;
|
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) cubeZ--;
|
||||||
|
|
||||||
GRRLIB_3dMode(0.1,1000,45,1);
|
GRRLIB_3dMode(0.1,1000,45,1);
|
||||||
GRRLIB_setTexture(tex_girl,0);
|
GRRLIB_SetTexture(tex_girl,0);
|
||||||
GRRLIB_objectView(0,0,cubeZ, a,a*2,a*3);
|
GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3);
|
||||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
||||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||||
GX_Color1u32(col[0]);
|
GX_Color1u32(col[0]);
|
||||||
|
|
|
@ -37,8 +37,8 @@ int main() {
|
||||||
|
|
||||||
GRRLIB_Settings.antialias = true;
|
GRRLIB_Settings.antialias = true;
|
||||||
|
|
||||||
GRRLIB_setBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
||||||
GRRLIB_camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);
|
GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
GRRLIB_2dMode();
|
GRRLIB_2dMode();
|
||||||
|
@ -48,8 +48,8 @@ int main() {
|
||||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) cubeZ--;
|
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) cubeZ--;
|
||||||
|
|
||||||
GRRLIB_3dMode(0.1,1000,45,1);
|
GRRLIB_3dMode(0.1,1000,45,1);
|
||||||
GRRLIB_setTexture(tex_girl,0);
|
GRRLIB_SetTexture(tex_girl,0);
|
||||||
GRRLIB_objectView(0,0,cubeZ, a,a*2,a*3);
|
GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3);
|
||||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
||||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||||
GX_Color1u32(col[0]);
|
GX_Color1u32(col[0]);
|
||||||
|
|
|
@ -23,8 +23,8 @@ int main() {
|
||||||
GRRLIB_Settings.antialias = true;
|
GRRLIB_Settings.antialias = true;
|
||||||
|
|
||||||
|
|
||||||
GRRLIB_setBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
||||||
GRRLIB_camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);
|
GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
GRRLIB_2dMode();
|
GRRLIB_2dMode();
|
||||||
|
@ -33,7 +33,7 @@ int main() {
|
||||||
|
|
||||||
|
|
||||||
GRRLIB_3dMode(0.1,1000,45,0);
|
GRRLIB_3dMode(0.1,1000,45,0);
|
||||||
GRRLIB_objectView(0,0,-30, a,a*2,a*3);
|
GRRLIB_ObjectView(0,0,-30, a,a*2,a*3);
|
||||||
GX_Begin(GX_TRIANGLES, GX_VTXFMT0, logoNbFace * 3);
|
GX_Begin(GX_TRIANGLES, GX_VTXFMT0, logoNbFace * 3);
|
||||||
for(i=0; i<logoNbFace*3; i+=3) {
|
for(i=0; i<logoNbFace*3; i+=3) {
|
||||||
if(i<=(246*3*2))
|
if(i<=(246*3*2))
|
||||||
|
|
|
@ -67,11 +67,11 @@ int main() {
|
||||||
GRRLIB_Render();
|
GRRLIB_Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
GRRLIB_setBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
WPAD_ScanPads();
|
WPAD_ScanPads();
|
||||||
GRRLIB_camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0);
|
GRRLIB_Camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0);
|
||||||
|
|
||||||
GRRLIB_2dMode();
|
GRRLIB_2dMode();
|
||||||
GRRLIB_DrawImg(0, 0, tex_screen[screen_index], 0, 1, 1, 0xFFFFFFFF);
|
GRRLIB_DrawImg(0, 0, tex_screen[screen_index], 0, 1, 1, 0xFFFFFFFF);
|
||||||
|
@ -81,8 +81,8 @@ int main() {
|
||||||
|
|
||||||
|
|
||||||
cubeZ+=0.02f;
|
cubeZ+=0.02f;
|
||||||
GRRLIB_objectView((float)(((R + r-ff)*cos(t-f) - d*cos(((R + r-f)/r)*t)))/20.0f,(float)(((R + r-ff)*sin(t) - d*sin(((R + r)/r)*t)-f))/20.0f,sin(cubeZ)*10, a,a*2,a*3);
|
GRRLIB_ObjectView((float)(((R + r-ff)*cos(t-f) - d*cos(((R + r-f)/r)*t)))/20.0f,(float)(((R + r-ff)*sin(t) - d*sin(((R + r)/r)*t)-f))/20.0f,sin(cubeZ)*10, a,a*2,a*3);
|
||||||
GRRLIB_setTexture(tex_girl, 0);
|
GRRLIB_SetTexture(tex_girl, 0);
|
||||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
||||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||||
GX_Color1u32(col[0]);
|
GX_Color1u32(col[0]);
|
||||||
|
@ -176,12 +176,12 @@ int main() {
|
||||||
spr+=0.1f;
|
spr+=0.1f;
|
||||||
t+=0.01f;
|
t+=0.01f;
|
||||||
|
|
||||||
if(t>n*2*PI){
|
if(t>n*2*PI) {
|
||||||
n++;
|
n++;
|
||||||
f+=0.01f;
|
f+=0.01f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(f>2*PI){
|
if(f>2*PI) {
|
||||||
f=0;
|
f=0;
|
||||||
ff+=0.02f;
|
ff+=0.02f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue