2010-05-01 14:29:28 +00:00
|
|
|
/*===========================================
|
|
|
|
NoNameNo
|
|
|
|
|
|
|
|
A little Specular light sample code
|
|
|
|
============================================*/
|
|
|
|
#include <grrlib.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <wiiuse/wpad.h>
|
|
|
|
|
|
|
|
#include "gfx/font9x12.h"
|
|
|
|
|
|
|
|
|
|
|
|
int main() {
|
2010-05-01 18:02:42 +00:00
|
|
|
f32 rot = 0.0f;
|
2021-11-27 16:14:09 +00:00
|
|
|
float shininess = 10.0f;
|
2010-05-01 14:29:28 +00:00
|
|
|
|
|
|
|
GRRLIB_Init();
|
|
|
|
WPAD_Init();
|
|
|
|
|
|
|
|
GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font9x12);
|
|
|
|
GRRLIB_InitTileSet(tex_font, 9, 12, 32);
|
|
|
|
|
|
|
|
GRRLIB_Settings.antialias = true;
|
|
|
|
|
|
|
|
GRRLIB_SetBackgroundColour(0x40, 0x40, 0x40, 0xFF);
|
|
|
|
|
|
|
|
while(1) {
|
2010-05-01 18:02:42 +00:00
|
|
|
GRRLIB_Camera3dSettings(0.0f,0.0f,10.0f, 0,1,0, 0,0,0);
|
2010-05-01 14:29:28 +00:00
|
|
|
|
|
|
|
WPAD_ScanPads();
|
|
|
|
|
|
|
|
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break;
|
2021-11-27 16:14:09 +00:00
|
|
|
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A) shininess+=1;
|
|
|
|
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) shininess-=1;
|
2010-05-01 14:29:28 +00:00
|
|
|
|
|
|
|
GRRLIB_3dMode(0.1,1000,45,0,1);
|
|
|
|
|
2010-05-01 18:02:42 +00:00
|
|
|
// dir param of GRRLIB_SetLightSpec function have to be a crazy 0,0,0 value
|
2010-05-01 14:29:28 +00:00
|
|
|
// there is a bug in libogc about this
|
2021-06-26 17:14:43 +00:00
|
|
|
// https://devkitpro.org/viewtopic.php?f=7&t=1933
|
2010-05-01 14:29:28 +00:00
|
|
|
// we are waiting for a fix from libogc devs
|
2010-05-01 18:02:42 +00:00
|
|
|
GRRLIB_SetLightAmbient(0x404040FF);
|
2021-11-27 16:14:09 +00:00
|
|
|
GRRLIB_SetLightSpec(0, (guVector){0.0f,0.0f,0.0f}, shininess, 0xFFFFFFFF, 0xFFFFFFFF);
|
2010-05-01 17:38:22 +00:00
|
|
|
|
2010-05-01 18:02:42 +00:00
|
|
|
GRRLIB_ObjectViewBegin();
|
|
|
|
GRRLIB_ObjectViewTrans(0.0f,1.3f,0.0f);
|
|
|
|
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
|
|
|
|
GRRLIB_ObjectViewEnd();
|
2010-05-01 17:38:22 +00:00
|
|
|
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
|
|
|
|
|
2010-05-01 18:02:42 +00:00
|
|
|
GRRLIB_ObjectViewBegin();
|
|
|
|
GRRLIB_ObjectViewRotate(0.0f,0.0f,90.0f);
|
|
|
|
GRRLIB_ObjectViewTrans(-1.3f,0.0f,0.0f);
|
|
|
|
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
|
|
|
|
GRRLIB_ObjectViewEnd();
|
2010-05-01 17:38:22 +00:00
|
|
|
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
|
|
|
|
|
2010-05-01 18:02:42 +00:00
|
|
|
GRRLIB_ObjectViewBegin();
|
|
|
|
GRRLIB_ObjectViewRotate(0.0f,0.0f,180.0f);
|
|
|
|
GRRLIB_ObjectViewTrans(0.0f,-1.3f,0.0f);
|
|
|
|
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
|
|
|
|
GRRLIB_ObjectViewEnd();
|
2010-05-01 17:38:22 +00:00
|
|
|
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
|
|
|
|
|
2010-05-01 18:02:42 +00:00
|
|
|
GRRLIB_ObjectViewBegin();
|
|
|
|
GRRLIB_ObjectViewRotate(0.0f,0.0f,-90.0f);
|
|
|
|
GRRLIB_ObjectViewTrans(1.3f,0.0f,0.0f);
|
|
|
|
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
|
|
|
|
GRRLIB_ObjectViewEnd();
|
2010-05-01 17:38:22 +00:00
|
|
|
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
|
|
|
|
|
2010-05-01 18:02:42 +00:00
|
|
|
GRRLIB_ObjectViewBegin();
|
|
|
|
GRRLIB_ObjectViewRotate(-90.0f,0.0f,0.0f);
|
|
|
|
GRRLIB_ObjectViewTrans(0.0f,0.0f,-1.3f);
|
|
|
|
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
|
|
|
|
GRRLIB_ObjectViewEnd();
|
2010-05-01 17:38:22 +00:00
|
|
|
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
|
|
|
|
|
2010-05-01 18:02:42 +00:00
|
|
|
GRRLIB_ObjectViewBegin();
|
|
|
|
GRRLIB_ObjectViewRotate(90.0f,0.0f,0.0f);
|
|
|
|
GRRLIB_ObjectViewTrans(0.0f,0.0f,1.3f);
|
|
|
|
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
|
|
|
|
GRRLIB_ObjectViewEnd();
|
2010-05-01 17:38:22 +00:00
|
|
|
GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF);
|
|
|
|
|
2010-05-01 18:02:42 +00:00
|
|
|
GRRLIB_ObjectViewBegin();
|
|
|
|
GRRLIB_ObjectViewRotate(rot,rot*2,rot*3);
|
|
|
|
GRRLIB_ObjectViewEnd();
|
2010-05-01 17:38:22 +00:00
|
|
|
GRRLIB_DrawCube( 0.6f, true, 0x102050FF);
|
|
|
|
|
2010-05-01 14:29:28 +00:00
|
|
|
|
|
|
|
rot+=0.8f;
|
|
|
|
|
|
|
|
GRRLIB_2dMode();
|
2021-11-27 16:14:09 +00:00
|
|
|
GRRLIB_Printf(50, 60, tex_font, 0xFFFFFFFF, 1, "Use ( A / B ) to change the shininess value: %d ",(int)shininess);
|
2010-05-01 14:29:28 +00:00
|
|
|
GRRLIB_Render();
|
|
|
|
}
|
|
|
|
GRRLIB_FreeTexture(tex_font);
|
2011-03-16 01:24:01 +00:00
|
|
|
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
2010-05-01 14:29:28 +00:00
|
|
|
|
|
|
|
exit(0);
|
|
|
|
}
|