2009-12-15 19:06:53 +00:00
|
|
|
/*===========================================
|
|
|
|
NoNameNo FAKE Unlimited 3D textured Cube rout ;)
|
|
|
|
Still the same technic used in the 2D version
|
|
|
|
============================================*/
|
|
|
|
#include <grrlib.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <wiiuse/wpad.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "gfx/girl.h"
|
|
|
|
#include "gfx/logo.h"
|
|
|
|
#include "gfx/font.h"
|
|
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
int i;
|
|
|
|
int screen_index = 0;
|
|
|
|
float t=0;
|
2009-12-15 20:02:26 +00:00
|
|
|
const int R=81;
|
|
|
|
const int r=71;
|
|
|
|
const int d=120;
|
2009-12-15 19:06:53 +00:00
|
|
|
float f=0;
|
|
|
|
float ff=0;
|
|
|
|
float spr=0;
|
|
|
|
int n=1;
|
|
|
|
float a=0;
|
|
|
|
float cubeZ=10.0f;
|
|
|
|
float camZ=30.0f;;
|
|
|
|
|
|
|
|
GRRLIB_Init();
|
|
|
|
WPAD_Init();
|
|
|
|
|
|
|
|
GRRLIB_Settings.antialias = false;
|
|
|
|
|
|
|
|
GRRLIB_texImg *tex_screen[9];
|
|
|
|
for(i=0; i<9; i++) {
|
|
|
|
tex_screen[i] = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->efbHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
GRRLIB_texImg *tex_girl = GRRLIB_LoadTexture(girl);
|
|
|
|
GRRLIB_texImg *tex_logo = GRRLIB_LoadTexture(logo);
|
|
|
|
GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font);
|
|
|
|
GRRLIB_InitTileSet(tex_font, 16, 16, 32);
|
|
|
|
|
|
|
|
|
2009-12-15 20:02:26 +00:00
|
|
|
for(i=0;i<=255;i+=1) {
|
2009-12-15 19:06:53 +00:00
|
|
|
GRRLIB_Printf((640-(16*16))/2, 200, tex_font, 0xFFFFFF00|i, 1, "HOW MANY 3D CUBE");
|
|
|
|
GRRLIB_Printf((640-(16*20))/2, 216, tex_font, 0xFFFFFF00|i, 1, "CAN YOU DISPLAY WITH");
|
|
|
|
GRRLIB_DrawImg((640-352)/2, 248, tex_logo, 0, 1, 1, 0xFFFFFF00|i);
|
|
|
|
GRRLIB_Printf((640-(16*28))/2, 480-16, tex_font, 0xFFFFFF00|i, 1, "BY NONAMENO FROM GRRLIB TEAM");
|
|
|
|
GRRLIB_Render();
|
|
|
|
}
|
2009-12-15 20:02:26 +00:00
|
|
|
for(i=255;i>=0;i-=2) {
|
2009-12-15 19:06:53 +00:00
|
|
|
GRRLIB_Printf((640-(16*16))/2, 200, tex_font, 0xFFFFFF00|i, 1, "HOW MANY 3D CUBE");
|
|
|
|
GRRLIB_Printf((640-(16*20))/2, 216, tex_font, 0xFFFFFF00|i, 1, "CAN YOU DISPLAY WITH");
|
|
|
|
GRRLIB_DrawImg((640-352)/2, 248, tex_logo, 0, 1, 1, 0xFFFFFF00|i);
|
|
|
|
GRRLIB_Printf((640-(16*28))/2, 480-16, tex_font, 0xFFFFFF00|i, 1, "BY NONAMENO FROM GRRLIB TEAM");
|
|
|
|
GRRLIB_Render();
|
|
|
|
}
|
|
|
|
|
2009-12-15 22:51:39 +00:00
|
|
|
GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
2009-12-15 19:06:53 +00:00
|
|
|
|
|
|
|
while(1) {
|
|
|
|
WPAD_ScanPads();
|
2009-12-15 22:51:39 +00:00
|
|
|
GRRLIB_Camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0);
|
2009-12-15 19:06:53 +00:00
|
|
|
|
|
|
|
GRRLIB_2dMode();
|
|
|
|
GRRLIB_DrawImg(0, 0, tex_screen[screen_index], 0, 1, 1, 0xFFFFFFFF);
|
|
|
|
|
2010-04-06 11:23:31 +00:00
|
|
|
GRRLIB_3dMode(0.1, 1000, 45, 1, 0);
|
2009-12-15 20:02:26 +00:00
|
|
|
GRRLIB_SetBlend(GRRLIB_BLEND_ALPHA);
|
2009-12-15 19:06:53 +00:00
|
|
|
|
|
|
|
|
2009-12-15 20:02:26 +00:00
|
|
|
cubeZ+=0.02f;
|
2010-01-05 22:04:33 +00:00
|
|
|
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,1,1,1);
|
2009-12-15 22:51:39 +00:00
|
|
|
GRRLIB_SetTexture(tex_girl, 0);
|
2009-12-15 19:06:53 +00:00
|
|
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_Position3f32(-1.0f,1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,0.0f);
|
|
|
|
GX_Position3f32(1.0f,1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,0.0f);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,1.0f);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,1.0f);
|
|
|
|
|
|
|
|
GX_Position3f32(1.0f,1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,0.0f);
|
|
|
|
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,0.0f);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,1.0f);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,1.0f);
|
|
|
|
|
|
|
|
GX_Position3f32(1.0f,1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,0.0f);
|
|
|
|
GX_Position3f32(1.0f,1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,0.0f);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,1.0f);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,1.0f);
|
|
|
|
|
|
|
|
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,0.0f);
|
|
|
|
GX_Position3f32(-1.0f,1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,0.0f);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,1.0f);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,1.0f);
|
|
|
|
|
|
|
|
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,0.0f);
|
|
|
|
GX_Position3f32(1.0f,1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,0.0f);
|
|
|
|
GX_Position3f32(1.0f,1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,1.0f);
|
|
|
|
GX_Position3f32(-1.0f,1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,1.0f);
|
|
|
|
|
|
|
|
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,0.0f);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,0.0f);
|
|
|
|
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(1.0f,1.0f);
|
|
|
|
GX_Position3f32(1.0f,-1.0f,1.0f);
|
2010-10-05 03:02:38 +00:00
|
|
|
GX_Color1u32(0xFFFFFFFF);
|
2009-12-15 20:02:26 +00:00
|
|
|
GX_TexCoord2f32(0.0f,1.0f);
|
2009-12-15 19:06:53 +00:00
|
|
|
GX_End();
|
|
|
|
|
|
|
|
a+=0.5f;
|
2009-12-15 20:02:26 +00:00
|
|
|
|
|
|
|
GRRLIB_2dMode();
|
|
|
|
GRRLIB_Screen2Texture(0, 0, tex_screen[screen_index], GX_FALSE);
|
2009-12-15 19:06:53 +00:00
|
|
|
GRRLIB_Printf((640-(16*6*5))/2+5, 200+5, tex_font, 0x00000088, 5, "%06d",(int)spr);
|
|
|
|
GRRLIB_Printf((640-(16*6*5))/2, 200, tex_font, 0xFFEEEE88, 5, "%06d",(int)spr);
|
|
|
|
|
|
|
|
GRRLIB_Render();
|
|
|
|
screen_index++;
|
2009-12-15 20:02:26 +00:00
|
|
|
screen_index %= 9;
|
|
|
|
spr+=0.1f;
|
|
|
|
t+=0.01f;
|
2009-12-15 19:06:53 +00:00
|
|
|
|
2010-10-05 03:02:38 +00:00
|
|
|
if(t>n*2*M_PI) {
|
2009-12-15 19:06:53 +00:00
|
|
|
n++;
|
|
|
|
f+=0.01f;
|
|
|
|
}
|
|
|
|
|
2010-10-05 03:02:38 +00:00
|
|
|
if(f>2*M_PI) {
|
2009-12-15 19:06:53 +00:00
|
|
|
f=0;
|
|
|
|
ff+=0.02f;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
|
|
|
|
}
|
|
|
|
GRRLIB_FreeTexture(tex_logo);
|
|
|
|
GRRLIB_FreeTexture(tex_girl);
|
|
|
|
GRRLIB_FreeTexture(tex_font);
|
|
|
|
for(i=0; i<9; i++) {
|
|
|
|
GRRLIB_FreeTexture(tex_screen[i]);
|
|
|
|
}
|
2011-03-16 01:24:01 +00:00
|
|
|
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
2009-12-15 19:06:53 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|