00001 #ifndef _PA_3D
00002 #define _PA_3D
00003 #include <nds.h>
00004 #include <malloc.h>
00005 #include <nds/arm9/image.h>
00006
00007
00008 extern const u8 PAlib[];
00009 extern const u32 PAlib_size[];
00010
00011 #define texPCX 1
00012 #define texBIN 2
00013
00021 extern int textureID;
00022 extern float angle3dX, angle3dY;
00023 extern float viseeX, viseeY, viseeZ;
00024
00025
00026
00043 void PA_Init3D(void);
00049 void PA_LoadSplash3D(void);
00074 void PA_Init3DDrawing(float x1, float y1, float z1, float x2, float y2, float z2);
00075
00076
00077
00078
00113 void PA_glulookat(float eyex, float eyey, float eyez, float lookAtx, float lookAty, float lookAtz, float upx, float upy, float upz);
00120 extern inline void PA_image8to16(sImage* img)
00121 {
00122 int i;
00123
00124 u16* temp = (u16*)malloc(img->height*img->width*2);
00125
00126 for(i = 0; i < img->height * img->width; i++)
00127 temp[i] = img->palette[img->data8[i]] | (1<<15);
00128
00129 img->data16 = temp;
00130 }
00131
00132
00133 void PA_VueKeys(void);
00149 extern inline void PA_LoadTexture(int numtexture, u8* nomtexture, int mode){
00150 if(mode == texBIN){
00151 glBindTexture(0, numtexture);
00152 glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0,TEXGEN_TEXCOORD, (u8*)nomtexture);
00153 }
00154 else if(mode == texPCX){
00155 sImage pcx;
00156 loadPCX((u8*)nomtexture, &pcx);
00157 PA_image8to16(&pcx);
00158 glBindTexture(0, numtexture);
00159 glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD, pcx.data8);
00160 }
00161 }
00170 extern inline void PA_Texture(int numtexture){
00171 glBindTexture(0, numtexture);
00172 }
00214 void PA_3DBox(float x, float y, float z, float longueur, float largeur, float hauteur,float rotatex, float rotatey, float rotatez, uint8 red, uint8 green, uint8 blue);
00256 void PA_3DBoxTexture(float x, float y, float z, float longueur, float largeur, float hauteur,float rotatex, float rotatey, float rotatez,uint8 red, uint8 green, uint8 blue);
00257
00258
00259
00274 extern inline void PA_Rotate3D(float x,float y,float z){
00275 glRotateX(x);
00276 glRotateY(y);
00277 glRotateZ(z);
00278 }
00293 extern inline void PA_Translate3D(float x, float y, float z){
00294 glTranslate3f32(floatof32(x),floatof32(y),floatof32(z));
00295 }
00310 extern inline void PA_Scale3D(float x, float y, float z){
00311 MATRIX_SCALE = floatof32(x);
00312 MATRIX_SCALE = floatof32(y);
00313 MATRIX_SCALE = floatof32(z);
00314 }
00329 extern inline void PA_Vertex3D(float x, float y, float z){
00330 glVertex3v16(floatov16(x),floatov16(y),floatov16(z));
00331 }
00337 extern inline void PA_3Dto2D(){
00338 MATRIX_IDENTITY = 0;
00339 }
00340
00341
00353 extern inline void PA_Vertex2D(int x, int y){
00354 float x1 = (float)((x*0.36)/256)-0.18;
00355 float y1 = (float)((y*0.28)/192)-0.14;
00356 glVertex3v16(floatov16(x1),floatov16(y1),floatov16(-0.2));
00357 }
00369 extern inline void PA_TexCoord(float x, float y){
00370 glTexCoord1i(TEXTURE_PACK(intot16((int)x),intot16((int)y)));
00371 }
00372
00373
00374
00376
00377
00378 #endif