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