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