1 /*---------------------------------------------------------------------------*
2   Project:  Dolphin GX library
3   File:     GXTransform.h
4 
5   Copyright 1998-2002 Nintendo.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: GXTransform.h,v $
14   Revision 1.2  2006/02/04 11:56:46  hashida
15   (none)
16 
17   Revision 1.1.1.1  2005/12/29 06:53:28  hiratsu
18   Initial import.
19 
20   Revision 1.1.1.1  2005/05/12 02:41:07  yasuh-to
21   transitioned from the Dolphin source tree
22 
23 
24     10    03/01/10 17:30 Hirose
25     Added GXSetZScaleOffset.
26 
27     9     02/07/24 09:07:00 Hirose
28     Resolved version conflicts.
29 
30     9     02/04/09 15:15 Hirose
31     const type specifier support. (worked by hiratsu@IRD)
32 
33     8     5/08/01 5:56p Carl
34     GXSetScissorBoxOffset now takes signed arguments.
35 
36     7     4/17/01 5:29p Tian
37     Changed all inlines to static inline
38 
39     6     12/11/00 5:54p Stevera
40     Added conditional #include "win32/win32.h" for pcemu
41 
42     5     11/06/00 4:06p Carl
43     Added GXSetClipMode.
44 
45     4     10/18/00 4:05p Carl
46     Latest round of HW2 modifications and minor updates.
47 
48     3     6/15/00 1:17p Carl
49     Fixed indexed normal matrix load issues.
50 
51     2     3/06/00 11:54a Alligator
52     change GXSetDefaultMtx to GXSetCurrentMtx
53 
54     8     11/18/99 2:32p Alligator
55     added defines for projection and viewport vector sizes
56 
57     7     11/12/99 1:22p Alligator
58     added GXProject, GXGetViewportv, GXGetProjectionv
59 
60     6     10/13/99 4:32p Alligator
61     change GXSetViewport, GXSetScissor to use xorig, yorig, wd, ht
62 
63     5     9/30/99 10:40p Yasu
64     Renamed some GX functions and enums
65 
66     4     9/17/99 11:24a Ryan
67     changed GXJitterViewport to GXSetViewportJitter
68 
69     3     9/01/99 4:27p Ryan
70     Added GXJitterViewport
71 
72     1     7/14/99 4:20p Alligator
73     split gx.h into individual header files for each major section of API
74   $NoKeywords: $
75  *---------------------------------------------------------------------------*/
76 
77 #ifndef __GXTRANSFORM_H__
78 #define __GXTRANSFORM_H__
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
84 /*---------------------------------------------------------------------------*/
85 #include <revolution/types.h>
86 #include <revolution/gx/GXEnum.h>
87 #include <revolution/gx/GXStruct.h>
88 
89 #ifdef WIN32
90 #include "win32/win32.h"
91 #endif
92 
93 #define GX_PROJECTION_SZ  7
94 #define GX_VIEWPORT_SZ    6
95 
96 /*---------------------------------------------------------------------------*/
97 void GXSetProjection ( const f32 mtx[4][4], GXProjectionType type );
98 void GXSetProjectionv ( const f32 *ptr );
99 void GXLoadPosMtxImm ( const f32 mtx[3][4], u32 id );
100 void GXLoadPosMtxIndx ( u16 mtx_indx, u32 id );
101 void GXLoadNrmMtxImm ( const f32 mtx[3][4], u32 id );
102 void GXLoadNrmMtxImm3x3 ( const f32 mtx[3][3], u32 id );
103 void GXLoadNrmMtxIndx3x3 ( u16 mtx_indx, u32 id );
104 void GXSetCurrentMtx ( u32 id );
105 void GXLoadTexMtxImm ( const f32 mtx[][4], u32 id, GXTexMtxType type );
106 void GXLoadTexMtxIndx ( u16 mtx_indx, u32 id, GXTexMtxType type );
107 
108 void GXProject (
109 	f32  x,          // model coordinates
110 	f32  y,
111 	f32  z,
112 	const f32  mtx[3][4],  // model-view matrix
113 	const f32* pm,         // projection matrix, as returned by GXGetProjectionv
114 	const f32* vp,         // viewport, as returned by GXGetViewportv
115 	f32* sx,         // screen coordinates
116 	f32* sy,
117 	f32* sz );
118 
119 void GXSetViewport(
120          f32 left,
121          f32 top,
122          f32 wd,
123          f32 ht,
124          f32 nearz,
125          f32 farz );
126 
GXSetViewportv(const f32 * vp)127 static inline void GXSetViewportv( const f32 *vp )
128 {   // Note: doesn't check for NULL ptr
129     GXSetViewport(vp[0], vp[1], vp[2], vp[3], vp[4], vp[5]);
130 }
131 
132 void GXSetViewportJitter(
133          f32 left,
134          f32 top,
135          f32 wd,
136          f32 ht,
137          f32 nearz,
138          f32 farz,
139 	 u32 field );
140 
141 void GXSetZScaleOffset  ( f32 scale, f32 offset );
142 
143 #if ( GX_REV != 1 )
144 void GXSetScissorBoxOffset( s32 x_off, s32 y_off );
145 #endif
146 
147 void GXSetClipMode( GXClipMode mode );
148 
149 /*---------------------------------------------------------------------------*/
150 #ifdef __cplusplus
151 }
152 #endif
153 
154 #endif // __GXTRANSFORM_H__
155