1 /*---------------------------------------------------------------------------*
2   Project:  Dolphin GX library
3   File:     GXGet.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: GXGet.h,v $
14   Revision 1.3  2007/12/15 03:28:55  carlmu
15   Added GXGetViewport() as a static inline function.
16   This makes the APIs symmetric and now it corresponds to what the manual has described all along.
17 
18   Revision 1.2  2006/02/04 11:56:46  hashida
19   (none)
20 
21   Revision 1.1.1.1  2005/12/29 06:53:28  hiratsu
22   Initial import.
23 
24   Revision 1.1.1.1  2005/05/12 02:41:07  yasuh-to
25   Ported from dolphin sheath tree.
26 
27 
28     9    2002/07/24 9:07 Hirose
29     Resolved version conflicts.
30 
31     9    2002/04/09 15:15 Hirose
32     const type specifier support. (worked by hiratsu@IRD)
33 
34     8     2001/06/25 7:06p Hirose
35     Removed prototype of GXGetArray.
36 
37     7     2001/01/25 2:22p Carl
38     Added GXGetTexObjTlut.
39 
40     6     2001/01/24 7:19p Carl
41     Fixes for GXGetTexRegionAll.
42 
43     5     2001/01/24 4:28p Carl
44     New texture init and get functions added.
45 
46     4     2000/10/18 4:05p Carl
47     Latest round of HW2 modifications and minor updates.
48 
49     3     2000/05/12 6:05p Hirose
50     Changed definition of GXGetLight*v macros
51 
52     2     2000/04/11 1:03p Alligator
53     Added GXGetLight* functions
54 
55     8     1999/11/18 2:50p Hirose
56     Added GXGetTlutObj* functions
57 
58     7     1999/11/17 10:26p Hirose
59     Added GXGetTexObj* functions
60 
61     6     1999/11/12 1:22p Alligator
62     Added GXProject, GXGetViewportv, GXGetProjectionv
63 
64     5     1999/11/08 9:14a Alligator
65     Added GXGetTexObj
66 
67     4     1999/09/30 10:40p Yasu
68     Renamed some GX functions and enums
69 
70     3     1999/09/14 10:36a Ryan
71     Changed GXGetViewport to take all floats
72 
73     2     1999/07/20 6:10p Alligator
74     Added GXGetVtxDescv, GXGetVtxAttrFmtv
75 
76     1     1999/07/14 4:20p Alligator
77     Split gx.h into individual header files for each major section of API
78   $NoKeywords: $
79  *---------------------------------------------------------------------------*/
80 
81 #ifndef __GXGET_H__
82 #define __GXGET_H__
83 
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87 
88 #include <revolution/types.h>
89 #include <revolution/gx/GXEnum.h>
90 #include <revolution/gx/GXStruct.h>
91 
92 /*---------------------------------------------------------------------------*
93       GEOMETRY AND VERTEX FUNCTIONS
94  *---------------------------------------------------------------------------*/
95 void GXGetVtxDesc            ( GXAttr attr, GXAttrType *type );
96 void GXGetVtxDescv           ( GXVtxDescList *vcd );
97 void GXGetVtxAttrFmtv        ( GXVtxFmt fmt, GXVtxAttrFmtList *vat );
98 
99 void GXGetLineWidth          ( u8 *width, GXTexOffset *texOffsets );
100 void GXGetPointSize          ( u8 *pointSize, GXTexOffset *texOffsets );
101 
102 void GXGetVtxAttrFmt(
103     GXVtxFmt       idx,
104     GXAttr         attr,
105     GXCompCnt*     compCnt,
106     GXCompType*    compType,
107     u8*            shift );
108 
109 /*---------------------------------------------------------------------------*
110       TRANSFORMATION AND MATRIX FUNCTIONS
111  *---------------------------------------------------------------------------*/
112 void GXGetViewportv( f32* viewport );  // Used by GXProject
113 void GXGetProjectionv( f32* p );       // Used by GXProject
114 
GXGetViewport(f32 * left,f32 * top,f32 * wd,f32 * ht,f32 * nearz,f32 * farz)115 static inline void GXGetViewport( f32 *left, f32 *top,
116 				  f32 *wd, f32 *ht,
117 				  f32 *nearz, f32 *farz )
118 {   // Note: Doesn't check for NULL ptr
119     f32 vp[6];
120     GXGetViewportv(vp);
121     *left  = vp[0]; *top  = vp[1];
122     *wd    = vp[2]; *ht   = vp[3];
123     *nearz = vp[4]; *farz = vp[5];
124 }
125 
126 /*---------------------------------------------------------------------------*
127       CLIPPING AND CULLING FUNCTIONS
128  *---------------------------------------------------------------------------*/
129 void GXGetScissor(
130     u32*    left,
131     u32*    top,
132     u32*    width,
133     u32*    height );
134 
135 void GXGetCullMode( GXCullMode *mode );
136 
137 /*---------------------------------------------------------------------------*
138       LIGHTING OBJECT ACCESS FUNCTIONS
139  *---------------------------------------------------------------------------*/
140 void GXGetLightAttnA(
141         const GXLightObj* lt_obj,
142         f32*        a0,
143         f32*        a1,
144         f32*        a2 );
145 
146 void GXGetLightAttnK(
147         const GXLightObj* lt_obj,
148         f32*        k0,
149         f32*        k1,
150         f32*        k2 );
151 
152 void GXGetLightPos(
153         const GXLightObj* lt_obj,
154         f32*        x,
155         f32*        y,
156         f32*        z );
157 
158 #define GXGetLightPosv(lo, vec) \
159  (GXGetLightPos((lo), (f32*)(vec), (f32*)(vec)+1, (f32*)(vec)+2))
160 
161 void GXGetLightDir(
162         const GXLightObj* lt_obj,
163         f32*        nx,
164         f32*        ny,
165         f32*        nz );
166 
167 #define GXGetLightDirv(lo, vec) \
168  (GXGetLightDir((lo), (f32*)(vec), (f32*)(vec)+1, (f32*)(vec)+2))
169 
170 void GXGetLightColor(
171         const GXLightObj* lt_obj,
172         GXColor*    color );
173 
174 /*---------------------------------------------------------------------------*
175       TEXTURE OBJECT ACCESS FUNCTIONS
176  *---------------------------------------------------------------------------*/
177 void*         GXGetTexObjData  ( const GXTexObj* tex_obj );
178 u16           GXGetTexObjWidth ( const GXTexObj* tex_obj );
179 u16           GXGetTexObjHeight( const GXTexObj* tex_obj );
180 GXTexFmt      GXGetTexObjFmt   ( const GXTexObj* tex_obj );
181 GXTexWrapMode GXGetTexObjWrapS ( const GXTexObj* tex_obj );
182 GXTexWrapMode GXGetTexObjWrapT ( const GXTexObj* tex_obj );
183 GXBool        GXGetTexObjMipMap( const GXTexObj* tex_obj );
184 
185 void GXGetTexObjAll(
186         const GXTexObj* tex_obj,
187         void**          data,
188         u16*            width,
189         u16*            height,
190         GXTexFmt*       format,
191         GXTexWrapMode*  wrapS,
192         GXTexWrapMode*  wrapT,
193         GXBool*         mipMap );
194 
195 GXTexFilter   GXGetTexObjMinFilt  ( const GXTexObj* tex_obj );
196 GXTexFilter   GXGetTexObjMagFilt  ( const GXTexObj* tex_obj );
197 f32           GXGetTexObjMinLOD   ( const GXTexObj* tex_obj );
198 f32           GXGetTexObjMaxLOD   ( const GXTexObj* tex_obj );
199 f32           GXGetTexObjLODBias  ( const GXTexObj* tex_obj );
200 GXBool        GXGetTexObjBiasClamp( const GXTexObj* tex_obj );
201 GXBool        GXGetTexObjEdgeLOD  ( const GXTexObj* tex_obj );
202 GXAnisotropy  GXGetTexObjMaxAniso ( const GXTexObj* tex_obj );
203 
204 void GXGetTexObjLODAll (
205         const GXTexObj* tex_obj,
206         GXTexFilter*    min_filt,
207         GXTexFilter*    mag_filt,
208         f32*            min_lod,
209         f32*            max_lod,
210         f32*            lod_bias,
211         GXBool*         bias_clamp,
212         GXBool*         do_edge_lod,
213         GXAnisotropy*   max_aniso );
214 
215 u32 GXGetTexObjTlut( const GXTexObj* tex_obj );
216 
217 void*         GXGetTlutObjData      ( const GXTlutObj* tlut_obj );
218 GXTlutFmt     GXGetTlutObjFmt       ( const GXTlutObj* tlut_obj );
219 u16           GXGetTlutObjNumEntries( const GXTlutObj* tlut_obj );
220 
221 void GXGetTlutObjAll (
222         const GXTlutObj*      tlut_obj,
223         void**          data,
224         GXTlutFmt*      format,
225         u16*            numEntries );
226 
227 void GXGetTexRegionAll (
228         const GXTexRegion*    region,
229         GXBool*         is_cached,
230         GXBool*         is_32b_mipmap,
231         u32*            tmem_even,
232         u32*            size_even,
233         u32*            tmem_odd,
234         u32*            size_odd );
235 
236 void GXGetTlutRegionAll (
237         const GXTlutRegion*   region,
238         u32*            tmem_addr,
239         GXTlutSize*     tlut_size );
240 
241 /*---------------------------------------------------------------------------*/
242 #ifdef __cplusplus
243 }
244 #endif
245 
246 #endif // __GXGET_H__
247