vi.h 4.8 KB
/**********************************************************************
  $B#G#o#N#o#G#o%F%9%H%W%m%0%i%`$r%(!<%8%s%08!::MQ$KJQ99$7$?$b$N(B
  vi.c$B$O$+$J$jJ,$+$j$K$/$$%W%m%0%i%`$@$C$?$N$GA4LL2~D{$7$^$7$?!#(B

  File          : vi.h
  Creater       : Masaki Wada
  E-Mail Address: wada@hamster.nintendo.co.jp
 
 **********************************************************************/



/* $B3F<oHFMQDj5A(B */
#define GLIST_LEN 2048

#define FAST3D 0
#define LINE3D 1

/* $B8!::$K;HMQ$9$k#R#A#M%(%j%"$NNs5s@k8@(B */
enum RAM_AREA{ STANDARD,      /* $BI8=`$N#4#M%(%j%"(B   */
	       EXTEND_1ST,   /*  $B3HD%#18DL\$N#2#M(B  */
	       EXTEND_2ND   /*   $B3HD%#28DL\$N#2#M(B */
};

/* $B8!::=g=x%j%9%H(B */  
typedef struct{
    int           VideoMode;         /* $BI=<($9$k;~$N%S%G%*%b!<%I(B */
    int           NumColorBits;      /* $B?'$NI=8=%S%C%H?t(B */
    int           ScreenWidth;       /* $B2#%5%$%:(B */
    int           ScreenHeight;      /* $B=D%5%$%:(B */    
    enum RAM_AREA RamArea;           /* $B;HMQ$9$k#R#A#M%(%j%"(B */
    int           Index;             /* $B8!::4o$KAw$k8=:_$N8!::2hLLHV9f(B */
    void          (*Function)(void); /* $B3F!9$N4X?t(B */
} TEST_STRUCT;

/* $BF0E*NN0h$NG[CV(B */
typedef struct {
    Mtx	  projection;
    
    Mtx	  modeling1;
    Mtx   modeling2;
    Mtx   modeling3;
    Mtx   modeling4;

    Mtx   modeling5;
    Mtx   modeling6;
    Mtx   modeling7;
    Mtx   modeling8;
    Mtx   modeling9;
    Mtx   modeling10;
    Mtx   modeling11;
    Mtx   modeling12;
    Mtx   modeling13;
    Mtx   modeling14;
    Mtx   modeling15;
    Mtx   modeling16;
    Mtx   modeling17;
    Mtx   modeling18;
    
    Mtx	  viewing;
    Mtx   identity;
    Gfx	  glist[GLIST_LEN];
    
    Vtx   Vertex[16];
    Vp    mvp;

    /* $B:{Ln$5$s%W%m%0%i%`IA2hMQ%^%H%j%/%972(B */
    Mtx   floor_rotatex;
    Mtx   floor_rotatey;
    Mtx   floor_rotatez;

    Mtx   floor_translate;

    Mtx   floor_model0;
    Mtx   floor_model1;
    Mtx   floor_model2;
    Mtx   floor_model3;
    Mtx   floor_model4;
    Mtx   floor_model5;
    Mtx   floor_model6;
    Mtx   floor_model7;
    Mtx   floor_model8;
   
} ViDynamic;

/* $B2hLL$N>pJs9=B$BN(B */  
typedef struct{
    float  XScale;              /* $B#XJ}8~$N3HBgN((B   */
    float  YScale;              /* $B#YJ}8~$N3HBgN((B   */
    int    DitherEnable;        /* $B%G%#%6%j%s%0>pJs(B */  
    int    ViDitherEnable;      /* $B%G%#%6%U%#%k%?!<(B */
    int    ViGammaEnable;       /* $B%,%s%^Jd@5(B       */
    int    ViDivotEnable;       /* $B%G%#%\%C%HJd@5(B   */
    int    TranslateHorizontal; /* $BITL@(B */
    int    TranslateVertical;   /* $BITL@(B */
}CONFIGRATION;

/* $B%G%#%6%j%s%0>pJs(B */
const int DitherTypes[]={
    G_CD_DISABLE,
    G_CD_NOISE,
    G_CD_MAGICSQ,
    G_CD_BAYER
};

/* $B4J0W$J#2<!85:BI89=B$BN(B */
typedef struct{
    int x;
    int y;
}COORDINATES;

/* $B4J0WE*$J#3<!85:BI89=B$BN(B */
typedef struct{
    float x;
    float y;
    float z;
} DIMENSION3;

/* $B4J0WE*$J#2<!85:BI89=B$BN(B */
typedef struct{
    float x;
    float y;
} DIMENSION2;

/* $B%F%9%H%Q%?!<%s$N<1JLHV9fI=<(MQ9=B$BN(B */
typedef struct{
    int   Index;            /* $B<1JLHV9f(B      */
    int   x;               /*  $BI=<(#X:BI8(B   */
    int   y;              /*   $BI=<(#Y:BI8(B  */
    float Magnification; /*    $BI=<(G\N((B   */
}INDEX_INFO;
 
/* $B%/%j%"%+%i!<@_DjMQ9=B$BN(B */
typedef struct{
    u32 Color16;
    u32 Color32;
}COLOR;

/* $BBeI=?'$N@_Dj(B */
const COLOR BLACK = { ( GPACK_RGBA5551( 0x00, 0x00, 0x00, 1) << 16 |
			GPACK_RGBA5551( 0x00, 0x00, 0x00, 1)         ),
		      ( 0x00 << 24 |
			0x00 << 16 |
			0x00 <<  8 |
			0xff        )                        };
		      
const COLOR WHITE = { ( GPACK_RGBA5551( 0xff, 0xff, 0xff, 1) << 16 |
			GPACK_RGBA5551( 0xff, 0xff, 0xff, 1)         ),
		      ( 0xff << 24 |
			0xff << 16 |
			0xff <<  8 |
			0xff        )                        };
		      
const COLOR RED   = { ( GPACK_RGBA5551( 0xff, 0x00, 0x00, 1) << 16 |
			GPACK_RGBA5551( 0xff, 0x00, 0x00, 1)         ),
		      ( 0xff << 24 |
			0x00 << 16 |
			0x00 <<  8 |
			0xff        )                        };
		      
const COLOR GREEN = { ( GPACK_RGBA5551( 0x00, 0xff, 0x00, 1) << 16 |
			GPACK_RGBA5551( 0x00, 0xff, 0x00, 1)         ),
		      ( 0x00 << 24 |
			0xff << 16 |
			0x00 <<  8 |
			0xff        )                        };
		      
const COLOR BLUE  = { ( GPACK_RGBA5551( 0x00, 0x00, 0xff, 1) << 16 |
			GPACK_RGBA5551( 0x00, 0x00, 0xff, 1)         ),
		      ( 0x00 << 24 |
			0x00 << 16 |
			0xff <<  8 |
			0xff        )                        };
		      
const COLOR GRAY  = { ( GPACK_RGBA5551( 0x80, 0x80, 0x80, 1) << 16 |
			GPACK_RGBA5551( 0x80, 0x80, 0x80, 1)         ),
		      ( 0x40 << 24 |
			0x40 << 16 |
			0x40 <<  8 |
			0xff        )                        };