PA_Mode7.h

00001 #ifndef PA_MODE7
00002 #define PA_MODE7
00003 
00004 #include "PA_Tile.h"
00005 
00006 
00007 // Mode 7 functions !!
00008 
00009 void hbl_mode7(void);
00010 
00011 extern const s32 DIV[160];
00012 
00013 
00014 #define M7_D_SH        7 // focal shift
00015 #define M7O_NORM       1 // object renormalization shift (by /2)
00016 
00017 // view frustrum limits
00018 #define M7_NEAR     16
00019 #define M7_FAR     384
00020 #define M7_LEFT   -120
00021 #define M7_RIGHT   120
00022 #define M7_TOP      80
00023 #define M7_BOTTOM  -80
00024 
00025 // the background uses a different far-plane than objects
00026 #define M7_FAR_BG  512
00027 
00028 
00029 typedef struct{
00030        s32 x, y, z;
00031 }VECTOR;
00032 
00033 typedef struct tagM7CAM
00034 {
00035     VECTOR pos;     
00036     int phi;        // yaw
00037     int theta;      // pitch
00038     VECTOR u;       // local x-axis (right)
00039     VECTOR v;       // local y-axis (up)
00040     VECTOR w;       // local z-axis (back)
00041 } M7CAM;
00042 
00043 
00044 typedef struct { 
00045        s16 pa, pb, pc, pd; s32 dx, dy; 
00046 } BGAFF_EX;
00047 
00048 /*#define PA_BGXX(screen, bg) _REG32(0x4000008 + (0x1000 * screen) + (bg << 4))
00049 #define PA_BGXY(screen, bg) _REG32(0x400000C + (0x1000 * screen) + (bg << 4))
00050 #define PA_BGXPA(screen, bg) _REG16(0x4000000 + (0x1000 * screen) + (bg << 4))
00051 #define PA_BGXPB(screen, bg) _REG16(0x4000002 + (0x1000 * screen) + (bg << 4))
00052 #define PA_BGXPC(screen, bg) _REG16(0x4000004 + (0x1000 * screen) + (bg << 4))
00053 #define PA_BGXPD(screen, bg) _REG16(0x4000006 + (0x1000 * screen) + (bg << 4))
00054 */
00055 
00056 
00057 
00058 // in mode7.c
00059 extern M7CAM _m7_cam;
00060 extern int _m7_horizon;
00061 extern BGAFF_EX _m7_bgaff_ex[192];  // affine parameters for each line
00062 
00063 
00064 
00065 
00066 
00067 #define X0    256<<8
00068 #define Y0     32<<8  // Default camera height -> 8192
00069 #define Z0    256<<8
00070 
00071 // DRV
00072 extern u8 PA_currentmode;
00073 
00074 
00075 
00076 
00077 // === GLOBALS ========================================================
00078 // DRV
00079 extern s32 mode7cam_x, mode7cam_y, mode7cam_z, mode7alpha;
00080 // DRV
00081 extern s32 mode7cos, mode7sin;     // temporaries for cos and sin alpha
00082 // DRV
00083 extern s16 mode7_distance;
00084 
00085 
00086 
00101 void PA_InitMode7(u8 bg_select);
00102 
00103 
00113 extern inline void PA_Mode7Angle(s16 angle){
00114     mode7alpha = angle&511;
00115        mode7cos = PA_Cos(mode7alpha);
00116        mode7sin = PA_Sin(mode7alpha);
00117 }
00118 
00119 
00120 
00130 extern inline void PA_Mode7MoveLeftRight(s16 x_deplac){
00131               mode7cam_x += x_deplac*mode7cos;
00132               mode7cam_z += x_deplac*mode7sin;
00133 }
00134 
00135 
00145 extern inline void PA_Mode7MoveForwardBack(s16 z_deplac){
00146               mode7cam_x += z_deplac*mode7sin;
00147               mode7cam_z -= z_deplac*mode7cos;
00148 }
00149 
00150 
00151 
00161 extern inline void PA_Mode7X(s16 mode7x){
00162               mode7cam_x = mode7x;
00163 }
00164 
00165 
00175 extern inline void PA_Mode7Z(s16 mode7z){
00176               mode7cam_z = mode7z;
00177 }
00178 
00179 
00180 
00192 extern inline void PA_Mode7SetPointXZ(s16 mode7x, s16 mode7z){
00193               mode7cam_x = mode7x;
00194               mode7cam_z = mode7z;
00195 }
00196 
00197 
00207 extern inline void PA_Mode7Height(s16 mode7y){
00208               mode7cam_y = mode7y;
00209 }
00210 
00211 
00212  // end of Mode7
00214 
00215 
00216 
00217 void m7_aff_calc(void);
00218 void m7_hbl_flr(void);
00219 void m7_horz_calc(void);
00220 
00221 #endif
00222 
00223 

Généré le Tue Dec 13 11:53:02 2005 pour PAlib par  doxygen 1.3.9.1