1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - GX -
3   File:     g3c.c
4 
5   Copyright 2003-2008 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   $Date:: 2009-06-19#$
14   $Rev: 10786 $
15   $Author: okajima_manabu $
16  *---------------------------------------------------------------------------*/
17 //
18 //      -DSDK_WIN32 -DSDK_HAS_LONG_LONG_INT for GCC
19 //      -DSDK_WIN32                         for VC or BCB
20 //
21 #ifdef   SDK_WIN32
22 #include <nitro_win32.h>
23 #else
24 #include <nitro/gx/g3c.h>
25 #include <nitro/mi/dma.h>
26 #include <nitro/mi/memory.h>
27 #include "../include/gxasm.h"
28 #endif
29 
30 #include <nitro/code32.h>              // includes byte access
31 /*---------------------------------------------------------------------------*
32   Name:         G3CS_Direct0
33 
34   Description:  Makes a geometry command with no parameters on a display list.
35                 Note that the command is packed.
36 
37   Arguments:    info       a pointer to GXDLInfo
38                 op         a geometry command(GXOP_xxxxxxx)
39 
40   Returns:      none
41  *---------------------------------------------------------------------------*/
G3CS_Direct0(GXDLInfo * info,int op)42 void G3CS_Direct0(GXDLInfo *info, int op)
43 {
44     SDK_NULL_ASSERT(info);
45     GX_VALID_OPCODE_ASSERT(op);
46 
47     if (op != G3OP_NOP && ((u32)info->curr_cmd & 0x3) != 0)
48     {
49         info->param0_cmd_flg = TRUE;
50     }
51 
52     *info->curr_cmd = (u8)(op);        // byte access
53 }
54 
55 
56 /*---------------------------------------------------------------------------*
57   Name:         G3CS_Direct1
58 
59   Description:  Makes a geometry command with a parameter on a display list.
60                 Note that the command is packed.
61 
62   Arguments:    info       a pointer to GXDLInfo
63                 op         a geometry command(GXOP_xxxxxxx)
64                 param0     a parameter
65 
66   Returns:      none
67  *---------------------------------------------------------------------------*/
G3CS_Direct1(GXDLInfo * info,int op,u32 param0)68 void G3CS_Direct1(GXDLInfo *info, int op, u32 param0)
69 {
70     SDK_NULL_ASSERT(info);
71     GX_VALID_OPCODE_ASSERT(op);
72 
73     info->param0_cmd_flg = FALSE;
74 
75     *info->curr_cmd = (u8)(op);        // byte access
76     *info->curr_param = param0;
77 }
78 
79 
80 /*---------------------------------------------------------------------------*
81   Name:         G3CS_Direct2
82 
83   Description:  Makes a geometry command with two parameters on a display list.
84                 Note that the command is packed.
85 
86   Arguments:    info       a pointer to GXDLInfo
87                 op         a geometry command(GXOP_xxxxxxx)
88                 param0     a parameter
89                 param1     a parameter
90 
91   Returns:      none
92  *---------------------------------------------------------------------------*/
G3CS_Direct2(GXDLInfo * info,int op,u32 param0,u32 param1)93 void G3CS_Direct2(GXDLInfo *info, int op, u32 param0, u32 param1)
94 {
95     SDK_NULL_ASSERT(info);
96     GX_VALID_OPCODE_ASSERT(op);
97 
98     info->param0_cmd_flg = FALSE;
99 
100     *info->curr_cmd = (u8)(op);        // byte access
101     *(info->curr_param + 0) = param0;
102     *(info->curr_param + 1) = param1;
103 }
104 
105 
106 /*---------------------------------------------------------------------------*
107   Name:         G3CS_Direct3
108 
109   Description:  Makes a geometry command with three parameters on a display list.
110                 Note that the command is packed.
111 
112   Arguments:    info       a pointer to GXDLInfo
113                 op         a geometry command(GXOP_xxxxxxx)
114                 param0     a parameter
115                 param1     a parameter
116                 param2     a parameter
117 
118 
119   Returns:      none
120  *---------------------------------------------------------------------------*/
G3CS_Direct3(GXDLInfo * info,int op,u32 param0,u32 param1,u32 param2)121 void G3CS_Direct3(GXDLInfo *info, int op, u32 param0, u32 param1, u32 param2)
122 {
123     SDK_NULL_ASSERT(info);
124     GX_VALID_OPCODE_ASSERT(op);
125 
126     info->param0_cmd_flg = FALSE;
127 
128     *info->curr_cmd = (u8)(op);        // byte access
129     *(info->curr_param + 0) = param0;
130     *(info->curr_param + 1) = param1;
131     *(info->curr_param + 2) = param2;
132 }
133 
134 
135 /*---------------------------------------------------------------------------*
136   Name:         G3CS_DirectN
137 
138   Description:  Makes a geometry command with nParams parameters on a display list.
139                 Note that the command is packed.
140 
141   Arguments:    info       a pointer to GXDLInfo
142                 op         a geometry command(GXOP_xxxxxxx)
143                 nParams    the number of parameters
144                 params     parameters
145 
146   Returns:      none
147  *---------------------------------------------------------------------------*/
G3CS_DirectN(GXDLInfo * info,int op,int nParams,const u32 * params)148 void G3CS_DirectN(GXDLInfo *info, int op, int nParams, const u32 *params)
149 {
150     SDK_NULL_ASSERT(info);
151     SDK_NULL_ASSERT(params);
152     SDK_NULL_ASSERT(info->curr_cmd);
153     SDK_NULL_ASSERT(info->curr_param);
154 
155     if (nParams == 0)
156     {
157         G3CS_Direct0(info, op);
158         return;
159     }
160 
161     info->param0_cmd_flg = FALSE;
162 
163     *info->curr_cmd = (u8)(op);        // byte access
164     while (--nParams >= 0)
165     {
166         *(info->curr_param + nParams) = *(params + nParams);
167     }
168 }
169 
170 
171 /*---------------------------------------------------------------------------*
172   Name:         G3CS_LoadMtx44
173 
174   Description:  Make a geometry command which loads a 4x4 matrix
175                 to the current matrix.
176 
177   Arguments:    info       a pointer to GXDLInfo
178                 m          a pointer to a constant 4x4 matrix
179 
180   Returns:      none
181  *---------------------------------------------------------------------------*/
G3CS_LoadMtx44(GXDLInfo * info,const MtxFx44 * m)182 void G3CS_LoadMtx44(GXDLInfo *info, const MtxFx44 *m)
183 {
184     SDK_NULL_ASSERT(info);
185     SDK_NULL_ASSERT(info->curr_cmd);
186     SDK_NULL_ASSERT(info->curr_param);
187     SDK_NULL_ASSERT(m);
188 
189     info->param0_cmd_flg = FALSE;
190 
191     *info->curr_cmd = G3OP_MTX_LOAD_4x4;        // byte access
192 #ifndef SDK_WIN32
193     MI_Copy64B(&m->_00, (void *)info->curr_param);
194 #else
195     *(info->curr_param + 0) = (u32)m->_00;
196     *(info->curr_param + 1) = (u32)m->_01;
197     *(info->curr_param + 2) = (u32)m->_02;
198     *(info->curr_param + 3) = (u32)m->_03;
199 
200     *(info->curr_param + 4) = (u32)m->_10;
201     *(info->curr_param + 5) = (u32)m->_11;
202     *(info->curr_param + 6) = (u32)m->_12;
203     *(info->curr_param + 7) = (u32)m->_13;
204 
205     *(info->curr_param + 8) = (u32)m->_20;
206     *(info->curr_param + 9) = (u32)m->_21;
207     *(info->curr_param + 10) = (u32)m->_22;
208     *(info->curr_param + 11) = (u32)m->_23;
209 
210     *(info->curr_param + 12) = (u32)m->_30;
211     *(info->curr_param + 13) = (u32)m->_31;
212     *(info->curr_param + 14) = (u32)m->_32;
213     *(info->curr_param + 15) = (u32)m->_33;
214 #endif
215 }
216 
217 
218 /*---------------------------------------------------------------------------*
219   Name:         G3CS_LoadMtx43
220 
221   Description:  Make a geometry command which loads a 4x3 matrix
222                 to the current matrix.
223 
224   Arguments:    info       a pointer to GXDLInfo
225                 m          a pointer to a constant 4x3 matrix
226 
227   Returns:      none
228  *---------------------------------------------------------------------------*/
G3CS_LoadMtx43(GXDLInfo * info,const MtxFx43 * m)229 void G3CS_LoadMtx43(GXDLInfo *info, const MtxFx43 *m)
230 {
231     SDK_NULL_ASSERT(info);
232     SDK_NULL_ASSERT(info->curr_cmd);
233     SDK_NULL_ASSERT(info->curr_param);
234     SDK_NULL_ASSERT(m);
235 
236     info->param0_cmd_flg = FALSE;
237 
238     *info->curr_cmd = G3OP_MTX_LOAD_4x3;        // byte access
239 #ifndef SDK_WIN32
240     MI_Copy48B(&m->_00, (void *)info->curr_param);
241 #else
242     *(info->curr_param + 0) = (u32)m->_00;
243     *(info->curr_param + 1) = (u32)m->_01;
244     *(info->curr_param + 2) = (u32)m->_02;
245 
246     *(info->curr_param + 3) = (u32)m->_10;
247     *(info->curr_param + 4) = (u32)m->_11;
248     *(info->curr_param + 5) = (u32)m->_12;
249 
250     *(info->curr_param + 6) = (u32)m->_20;
251     *(info->curr_param + 7) = (u32)m->_21;
252     *(info->curr_param + 8) = (u32)m->_22;
253 
254     *(info->curr_param + 9) = (u32)m->_30;
255     *(info->curr_param + 10) = (u32)m->_31;
256     *(info->curr_param + 11) = (u32)m->_32;
257 #endif
258 }
259 
260 
261 /*---------------------------------------------------------------------------*
262   Name:         G3CS_MultMtx44
263 
264   Description:  Makes a geometry command which multiplies the current matrix
265                 by a 4x4 matrix from the left.
266 
267   Arguments:    info       a pointer to GXDLInfo
268                 m          a pointer to a constant 4x4 matrix
269 
270   Returns:      none
271  *---------------------------------------------------------------------------*/
G3CS_MultMtx44(GXDLInfo * info,const MtxFx44 * m)272 void G3CS_MultMtx44(GXDLInfo *info, const MtxFx44 *m)
273 {
274     SDK_NULL_ASSERT(info);
275     SDK_NULL_ASSERT(info->curr_cmd);
276     SDK_NULL_ASSERT(info->curr_param);
277     SDK_NULL_ASSERT(m);
278 
279     info->param0_cmd_flg = FALSE;
280 
281     *info->curr_cmd = G3OP_MTX_MULT_4x4;        // byte access
282 #ifndef SDK_WIN32
283     MI_Copy64B(&m->_00, (void *)info->curr_param);
284 #else
285     *(info->curr_param + 0) = (u32)m->_00;
286     *(info->curr_param + 1) = (u32)m->_01;
287     *(info->curr_param + 2) = (u32)m->_02;
288     *(info->curr_param + 3) = (u32)m->_03;
289 
290     *(info->curr_param + 4) = (u32)m->_10;
291     *(info->curr_param + 5) = (u32)m->_11;
292     *(info->curr_param + 6) = (u32)m->_12;
293     *(info->curr_param + 7) = (u32)m->_13;
294 
295     *(info->curr_param + 8) = (u32)m->_20;
296     *(info->curr_param + 9) = (u32)m->_21;
297     *(info->curr_param + 10) = (u32)m->_22;
298     *(info->curr_param + 11) = (u32)m->_23;
299 
300     *(info->curr_param + 12) = (u32)m->_30;
301     *(info->curr_param + 13) = (u32)m->_31;
302     *(info->curr_param + 14) = (u32)m->_32;
303     *(info->curr_param + 15) = (u32)m->_33;
304 #endif
305 }
306 
307 
308 /*---------------------------------------------------------------------------*
309   Name:         G3CS_MultMtx43
310 
311   Description:  Make a geometry command which multiplies the current matrix
312                 by a 4x3 matrix from the left.
313 
314   Arguments:    info       a pointer to GXDLInfo
315                 m          a pointer to a constant 4x3 matrix
316 
317   Returns:      none
318  *---------------------------------------------------------------------------*/
G3CS_MultMtx43(GXDLInfo * info,const MtxFx43 * m)319 void G3CS_MultMtx43(GXDLInfo *info, const MtxFx43 *m)
320 {
321     SDK_NULL_ASSERT(info);
322     SDK_NULL_ASSERT(info->curr_cmd);
323     SDK_NULL_ASSERT(info->curr_param);
324     SDK_NULL_ASSERT(m);
325 
326     info->param0_cmd_flg = FALSE;
327 
328     *info->curr_cmd = G3OP_MTX_MULT_4x3;        // byte access
329 #ifndef SDK_WIN32
330     MI_Copy48B(&m->_00, (void *)info->curr_param);
331 #else
332     *(info->curr_param + 0) = (u32)m->_00;
333     *(info->curr_param + 1) = (u32)m->_01;
334     *(info->curr_param + 2) = (u32)m->_02;
335 
336     *(info->curr_param + 3) = (u32)m->_10;
337     *(info->curr_param + 4) = (u32)m->_11;
338     *(info->curr_param + 5) = (u32)m->_12;
339 
340     *(info->curr_param + 6) = (u32)m->_20;
341     *(info->curr_param + 7) = (u32)m->_21;
342     *(info->curr_param + 8) = (u32)m->_22;
343 
344     *(info->curr_param + 9) = (u32)m->_30;
345     *(info->curr_param + 10) = (u32)m->_31;
346     *(info->curr_param + 11) = (u32)m->_32;
347 #endif
348 }
349 
350 
351 /*---------------------------------------------------------------------------*
352   Name:         G3CS_MultMtx33
353 
354   Description:  Makes a geometry command which multiplies the current matrix
355                 by a 3x3 matrix from the left.
356 
357   Arguments:    info       a pointer to GXDLInfo
358                 m          a pointer to a constant 3x3 matrix
359 
360   Returns:      none
361  *---------------------------------------------------------------------------*/
G3CS_MultMtx33(GXDLInfo * info,const MtxFx33 * m)362 void G3CS_MultMtx33(GXDLInfo *info, const MtxFx33 *m)
363 {
364     SDK_NULL_ASSERT(info);
365     SDK_NULL_ASSERT(info->curr_cmd);
366     SDK_NULL_ASSERT(info->curr_param);
367     SDK_NULL_ASSERT(m);
368 
369     info->param0_cmd_flg = FALSE;
370 
371     *info->curr_cmd = G3OP_MTX_MULT_3x3;        // byte access
372 #ifndef SDK_WIN32
373     MI_Copy36B(&m->_00, (void *)info->curr_param);
374 #else
375     *(info->curr_param + 0) = (u32)m->_00;
376     *(info->curr_param + 1) = (u32)m->_01;
377     *(info->curr_param + 2) = (u32)m->_02;
378 
379     *(info->curr_param + 3) = (u32)m->_10;
380     *(info->curr_param + 4) = (u32)m->_11;
381     *(info->curr_param + 5) = (u32)m->_12;
382 
383     *(info->curr_param + 6) = (u32)m->_20;
384     *(info->curr_param + 7) = (u32)m->_21;
385     *(info->curr_param + 8) = (u32)m->_22;
386 #endif
387 }
388 
389 /*---------------------------------------------------------------------------*
390   Name:         G3CS_MultTransMtx33
391 
392   Description:  Make a geometry command which multiplies and translates matrix together.
393 
394   Arguments:    info       a pointer to GXDLInfo
395                 mtx        a pointer to a constant 3x3 matrix
396                 trans      a pointer to a constant translation vector
397 
398   Returns:      none
399  *---------------------------------------------------------------------------*/
G3CS_MultTransMtx33(GXDLInfo * info,const MtxFx33 * mtx,const VecFx32 * trans)400 void G3CS_MultTransMtx33(GXDLInfo *info, const MtxFx33 *mtx, const VecFx32 *trans)
401 {
402     SDK_NULL_ASSERT(info);
403     SDK_NULL_ASSERT(mtx);
404     SDK_NULL_ASSERT(trans);
405     SDK_NULL_ASSERT(info->curr_cmd);
406     SDK_NULL_ASSERT(info->curr_param);
407 
408     info->param0_cmd_flg = FALSE;
409 
410     *info->curr_cmd = G3OP_MTX_MULT_4x3;
411 #ifndef SDK_WIN32
412     MI_Copy36B(&mtx->_00, (void *)info->curr_param);
413     MI_CpuCopy32(trans, (u32 *)info->curr_param + 9, sizeof(VecFx32));
414 #else
415     *((u32 *)info->curr_param + 0) = (u32)mtx->_00;
416     *((u32 *)info->curr_param + 1) = (u32)mtx->_01;
417     *((u32 *)info->curr_param + 2) = (u32)mtx->_02;
418 
419     *((u32 *)info->curr_param + 3) = (u32)mtx->_10;
420     *((u32 *)info->curr_param + 4) = (u32)mtx->_11;
421     *((u32 *)info->curr_param + 5) = (u32)mtx->_12;
422 
423     *((u32 *)info->curr_param + 6) = (u32)mtx->_20;
424     *((u32 *)info->curr_param + 7) = (u32)mtx->_21;
425     *((u32 *)info->curr_param + 8) = (u32)mtx->_22;
426 
427     *((u32 *)info->curr_param + 9) = trans->x;
428     *((u32 *)info->curr_param + 10) = trans->y;
429     *((u32 *)info->curr_param + 11) = trans->z;
430 #endif
431 }
432 
433 
434 
435 #include <nitro/codereset.h>
436 
437 
438 /*---------------------------------------------------------------------------*
439   Name:         G3C_Direct0
440 
441   Description:  Makes a geometry command with a parameter on a display list.
442                 Note that the command is packed.
443                 Also, the pointers of GXDLInfo proceed.
444 
445   Arguments:    info       a pointer to GXDLInfo
446                 op         a geometry command(GXOP_xxxxxxx)
447                 param0     a parameter
448 
449   Returns:      none
450  *---------------------------------------------------------------------------*/
G3C_Direct0(GXDLInfo * info,int op)451 void G3C_Direct0(GXDLInfo *info, int op)
452 {
453     G3CS_Direct0(info, op);
454     G3C_UpdateGXDLInfo(info, 0);
455 }
456 
457 
458 /*---------------------------------------------------------------------------*
459   Name:         G3C_Direct1
460 
461   Description:  Makes a geometry command with a parameter on a display list.
462                 Note that the command is packed.
463                 Also, the pointers of GXDLInfo proceed.
464 
465   Arguments:    info       a pointer to GXDLInfo
466                 op         a geometry command(GXOP_xxxxxxx)
467                 param0     a parameter
468 
469   Returns:      none
470  *---------------------------------------------------------------------------*/
G3C_Direct1(GXDLInfo * info,int op,u32 param0)471 void G3C_Direct1(GXDLInfo *info, int op, u32 param0)
472 {
473     G3CS_Direct1(info, op, param0);
474 
475     G3C_UpdateGXDLInfo(info, 1);
476 }
477 
478 
479 /*---------------------------------------------------------------------------*
480   Name:         G3C_Direct2
481 
482   Description:  Makes a geometry command with two parameters on a display list.
483                 Note that the command is packed.
484                 Also, the pointers of GXDLInfo proceed.
485 
486   Arguments:    info       a pointer to GXDLInfo
487                 op         a geometry command(GXOP_xxxxxxx)
488                 param0     a parameter
489                 param1     a parameter
490 
491   Returns:      none
492  *---------------------------------------------------------------------------*/
G3C_Direct2(GXDLInfo * info,int op,u32 param0,u32 param1)493 void G3C_Direct2(GXDLInfo *info, int op, u32 param0, u32 param1)
494 {
495     G3CS_Direct2(info, op, param0, param1);
496 
497     G3C_UpdateGXDLInfo(info, 2);
498 }
499 
500 
501 /*---------------------------------------------------------------------------*
502   Name:         G3C_Direct3
503 
504   Description:  Makes a geometry command with three parameters on a display list.
505                 Note that the command is packed.
506                 Also, the pointers of GXDLInfo proceed.
507 
508   Arguments:    info       a pointer to GXDLInfo
509                 op         a geometry command(GXOP_xxxxxxx)
510                 param0     a parameter
511                 param1     a parameter
512                 param2     a parameter
513 
514   Returns:      none
515  *---------------------------------------------------------------------------*/
G3C_Direct3(GXDLInfo * info,int op,u32 param0,u32 param1,u32 param2)516 void G3C_Direct3(GXDLInfo *info, int op, u32 param0, u32 param1, u32 param2)
517 {
518     G3CS_Direct3(info, op, param0, param1, param2);
519 
520     G3C_UpdateGXDLInfo(info, 3);
521 }
522 
523 
524 /*---------------------------------------------------------------------------*
525   Name:         G3C_DirectN
526 
527   Description:  Makes a geometry command with nParams parameters on a display list.
528                 Note that the command is packed.
529                 Also, the pointers of GXDLInfo proceed.
530 
531   Arguments:    info       a pointer to GXDLInfo
532                 op         a geometry command(GXOP_xxxxxxx)
533                 nParams    the number of parameters
534                 params     parameters
535 
536   Returns:      none
537  *---------------------------------------------------------------------------*/
G3C_DirectN(GXDLInfo * info,int op,int nParams,const u32 * params)538 void G3C_DirectN(GXDLInfo *info, int op, int nParams, const u32 *params)
539 {
540     G3CS_DirectN(info, op, nParams, params);
541 
542     G3C_UpdateGXDLInfo(info, nParams);
543 }
544 
545 
546 /*---------------------------------------------------------------------------*
547   Name:         G3C_UpdateGXDLInfo
548 
549   Description:  Updates a display list pointer of '*info'.
550 
551   Arguments:    info       a pointer to GXDLInfo
552                 n          an index to proceed
553 
554   Returns:      none
555  *---------------------------------------------------------------------------*/
G3C_UpdateGXDLInfo(GXDLInfo * info,int n)556 void G3C_UpdateGXDLInfo(GXDLInfo *info, int n)
557 {
558     info->curr_param += n;
559 
560     SDK_TASSERTMSG(((u32)(info->curr_param) - (u32)info->bottom <= info->length),
561                   "Buffer overflow ! : Current DL buffer doesn't have enough capacity for new commands\n");
562 
563     if (((u32)(++info->curr_cmd) & 0x3) == 0)
564     {
565         if (info->param0_cmd_flg)
566         {
567             // code for hardware bug in geometry fifo.
568             *(u32 *)(info->curr_param++) = 0;
569             info->param0_cmd_flg = FALSE;
570         }
571         info->curr_cmd = (u8 *)(info->curr_param++);
572     }
573 
574     SDK_TASSERTMSG(((u32)(info->curr_cmd) - (u32)info->bottom <= info->length),
575                   "Buffer overflow ! : Current DL buffer doesn't have enough capacity for new commands\n");
576 }
577 
578 
579 /*---------------------------------------------------------------------------*
580   Name:         G3C_Nop
581 
582   Description:  Makes a geometry command which does nothing on a display list.
583                 Note that the command is packed.
584                 Also, the pointers of GXDLInfo proceed.
585 
586   Arguments:    info       a pointer to GXDLInfo
587 
588   Returns:      none
589  *---------------------------------------------------------------------------*/
G3C_Nop(GXDLInfo * info)590 void G3C_Nop(GXDLInfo *info)
591 {
592     G3CS_Nop(info);
593     G3C_UpdateGXDLInfo(info, G3OP_NOP_NPARAMS);
594 }
595 
596 
597 /*---------------------------------------------------------------------------*
598   Name:         G3C_MtxMode
599 
600   Description:  Makes a geometry command, which sets a matrix mode,
601                 on a display list. Note that the command is packed.
602                 Also, the pointers of GXDLInfo proceed.
603 
604   Arguments:    info       a pointer to GXDLInfo
605                 mode       a matrix mode
606 
607   Returns:      none
608  *---------------------------------------------------------------------------*/
G3C_MtxMode(GXDLInfo * info,GXMtxMode mode)609 void G3C_MtxMode(GXDLInfo *info, GXMtxMode mode)
610 {
611     G3CS_MtxMode(info, mode);
612     G3C_UpdateGXDLInfo(info, G3OP_MTX_MODE_NPARAMS);
613 }
614 
615 
616 /*---------------------------------------------------------------------------*
617   Name:         G3C_PushMtx
618 
619   Description:  Makes a geometry command, which stores a current matrix to
620                 the top of the matrix stack and increments the stack pointer,
621                 on a display list. Note that the command is packed.
622                 Also, the pointers of GXDLInfo proceed.
623 
624   Arguments:    info       a pointer to GXDLInfo
625 
626   Returns:      none
627  *---------------------------------------------------------------------------*/
G3C_PushMtx(GXDLInfo * info)628 void G3C_PushMtx(GXDLInfo *info)
629 {
630     G3CS_PushMtx(info);
631     G3C_UpdateGXDLInfo(info, G3OP_MTX_PUSH_NPARAMS);
632 }
633 
634 
635 /*---------------------------------------------------------------------------*
636   Name:         G3C_PopMtx
637 
638   Description:  Makes a geometry command, which pops the num'th matrix
639                 from the matrix stack pointer on the stack,
640                 and adds num to the pointer. Note that the command is packed.
641                 Also, the pointers of GXDLInfo proceed.
642 
643   Arguments:    info       a pointer to GXDLInfo
644                 num        an offset to the stack pointer
645 
646   Returns:      none
647  *---------------------------------------------------------------------------*/
G3C_PopMtx(GXDLInfo * info,int num)648 void G3C_PopMtx(GXDLInfo *info, int num)
649 {
650     G3CS_PopMtx(info, num);
651     G3C_UpdateGXDLInfo(info, G3OP_MTX_POP_NPARAMS);
652 }
653 
654 
655 /*---------------------------------------------------------------------------*
656   Name:         G3C_StoreMtx
657 
658   Description:  Makes a geometry command, which stores a current matrix
659                 to the num'th matrix from the matrix stack pointer on the stack,
660                 on a display list. Note that the command is packed.
661                 Also, the pointers of GXDLInfo proceed.
662 
663   Arguments:    info       a pointer to GXDLInfo
664                 num        an offset to the stack pointer
665 
666   Returns:      none
667  *---------------------------------------------------------------------------*/
G3C_StoreMtx(GXDLInfo * info,int num)668 void G3C_StoreMtx(GXDLInfo *info, int num)
669 {
670     G3CS_StoreMtx(info, num);
671     G3C_UpdateGXDLInfo(info, G3OP_MTX_STORE_NPARAMS);
672 }
673 
674 
675 /*---------------------------------------------------------------------------*
676   Name:         G3C_RestoreMtx
677 
678   Description:  Makes a geometry command, which gets the num'th matrix from
679                 the matrix stack pointer on the stack, on a display list.
680                 Note that the command is packed.
681                 Also, the pointers of GXDLInfo proceed.
682 
683   Arguments:    info       a pointer to GXDLInfo
684                 num        an offset to the stack pointer
685 
686   Returns:      none
687  *---------------------------------------------------------------------------*/
G3C_RestoreMtx(GXDLInfo * info,int num)688 void G3C_RestoreMtx(GXDLInfo *info, int num)
689 {
690     G3CS_RestoreMtx(info, num);
691     G3C_UpdateGXDLInfo(info, G3OP_MTX_RESTORE_NPARAMS);
692 }
693 
694 
695 /*---------------------------------------------------------------------------*
696   Name:         G3C_Identity
697 
698   Description:  Makes a geometry command, which sets an identity matrix
699                 to the current matrix, on a display list.
700                 Note that the command is packed.
701                 Also, the pointers of GXDLInfo proceed.
702 
703   Arguments:    info       a pointer to GXDLInfo
704 
705   Returns:      none
706  *---------------------------------------------------------------------------*/
G3C_Identity(GXDLInfo * info)707 void G3C_Identity(GXDLInfo *info)
708 {
709     G3CS_Identity(info);
710     G3C_UpdateGXDLInfo(info, G3OP_MTX_IDENTITY_NPARAMS);
711 }
712 
713 
714 /*---------------------------------------------------------------------------*
715   Name:         G3C_LoadMtx44
716 
717   Description:  Make a geometry command which loads a 4x4 matrix
718                 to the current matrix.
719                 Also, the pointers of GXDLInfo proceed.
720 
721   Arguments:    info       a pointer to GXDLInfo
722                 m          a pointer to a constant 4x4 matrix
723 
724   Returns:      none
725  *---------------------------------------------------------------------------*/
G3C_LoadMtx44(GXDLInfo * info,const MtxFx44 * m)726 void G3C_LoadMtx44(GXDLInfo *info, const MtxFx44 *m)
727 {
728     G3CS_LoadMtx44(info, m);
729     G3C_UpdateGXDLInfo(info, G3OP_MTX_LOAD_4x4_NPARAMS);
730 }
731 
732 
733 /*---------------------------------------------------------------------------*
734   Name:         G3C_LoadMtx43
735 
736   Description:  Make a geometry command which loads a 4x3 matrix
737                 to the current matrix.
738                 Also, the pointers of GXDLInfo proceed.
739 
740   Arguments:    info       a pointer to GXDLInfo
741                 m          a pointer to a constant 4x3 matrix
742 
743   Returns:      none
744  *---------------------------------------------------------------------------*/
G3C_LoadMtx43(GXDLInfo * info,const MtxFx43 * m)745 void G3C_LoadMtx43(GXDLInfo *info, const MtxFx43 *m)
746 {
747     G3CS_LoadMtx43(info, m);
748     G3C_UpdateGXDLInfo(info, G3OP_MTX_LOAD_4x3_NPARAMS);
749 }
750 
751 
752 /*---------------------------------------------------------------------------*
753   Name:         G3C_MultMtx44
754 
755   Description:  Makes a geometry command which multiplies the current matrix
756                 by a 4x4 matrix from the left.
757                 Also, the pointers of GXDLInfo proceed.
758 
759   Arguments:    info       a pointer to GXDLInfo
760                 m          a pointer to a constant 4x4 matrix
761 
762   Returns:      none
763  *---------------------------------------------------------------------------*/
G3C_MultMtx44(GXDLInfo * info,const MtxFx44 * m)764 void G3C_MultMtx44(GXDLInfo *info, const MtxFx44 *m)
765 {
766     G3CS_MultMtx44(info, m);
767     G3C_UpdateGXDLInfo(info, G3OP_MTX_MULT_4x4_NPARAMS);
768 }
769 
770 
771 /*---------------------------------------------------------------------------*
772   Name:         G3C_MultMtx43
773 
774   Description:  Make a geometry command which multiplies the current matrix
775                 by a 4x3 matrix from the left.
776                 Also, the pointers of GXDLInfo proceed.
777 
778   Arguments:    info       a pointer to GXDLInfo
779                 m          a pointer to a constant 4x3 matrix
780 
781   Returns:      none
782  *---------------------------------------------------------------------------*/
G3C_MultMtx43(GXDLInfo * info,const MtxFx43 * m)783 void G3C_MultMtx43(GXDLInfo *info, const MtxFx43 *m)
784 {
785     G3CS_MultMtx43(info, m);
786     G3C_UpdateGXDLInfo(info, G3OP_MTX_MULT_4x3_NPARAMS);
787 }
788 
789 
790 /*---------------------------------------------------------------------------*
791   Name:         G3C_MultMtx33
792 
793   Description:  Makes a geometry command which multiplies the current matrix
794                 by a 3x3 matrix from the left.
795                 Also, the pointers of GXDLInfo proceed.
796 
797   Arguments:    info       a pointer to GXDLInfo
798                 m          a pointer to a constant 3x3 matrix
799 
800   Returns:      none
801  *---------------------------------------------------------------------------*/
G3C_MultMtx33(GXDLInfo * info,const MtxFx33 * m)802 void G3C_MultMtx33(GXDLInfo *info, const MtxFx33 *m)
803 {
804     G3CS_MultMtx33(info, m);
805     G3C_UpdateGXDLInfo(info, G3OP_MTX_MULT_3x3_NPARAMS);
806 }
807 
808 /*---------------------------------------------------------------------------*
809   Name:         G3C_MultTransMtx33
810 
811   Description:  Make a geometry command which multiplies and translates matrix together.
812 
813   Arguments:    info       a pointer to GXDLInfo
814                 mtx        a pointer to a constant 3x3 matrix
815                 trans      a pointer to a constant translation vector
816 
817   Returns:      none
818  *---------------------------------------------------------------------------*/
G3C_MultTransMtx33(GXDLInfo * info,const MtxFx33 * mtx,const VecFx32 * trans)819 void G3C_MultTransMtx33(GXDLInfo *info, const MtxFx33 *mtx, const VecFx32 *trans)
820 {
821     G3CS_MultTransMtx33(info, mtx, trans);
822     G3C_UpdateGXDLInfo(info, G3OP_MTX_MULT_4x3_NPARAMS);
823 }
824 
825 /*---------------------------------------------------------------------------*
826   Name:         G3C_Scale
827 
828   Description:  Makes a geometry command, which multiplies the current matrix
829                 by a scale matrix. Note that the command is packed.
830                 Also, the pointers of GXDLInfo proceed.
831 
832   Arguments:    info       a pointer to GXDLInfo
833                 x          X coordinate of a scale
834                 y          Y coordinate of a scale
835                 z          Z coordinate of a scale
836 
837   Returns:      none
838  *---------------------------------------------------------------------------*/
G3C_Scale(GXDLInfo * info,fx32 x,fx32 y,fx32 z)839 void G3C_Scale(GXDLInfo *info, fx32 x, fx32 y, fx32 z)
840 {
841     G3CS_Scale(info, x, y, z);
842     G3C_UpdateGXDLInfo(info, G3OP_MTX_SCALE_NPARAMS);
843 }
844 
845 
846 /*---------------------------------------------------------------------------*
847   Name:         G3C_Translate
848 
849   Description:  Makes a geometry command, which multiplies the current matrix
850                 by a translation matrix. Note that the command is packed.
851                 Also, the pointers of GXDLInfo proceed.
852 
853   Arguments:    info       a pointer to GXDLInfo
854                 x          X coordinate of a translation vector
855                 y          Y coordinate of a translation vector
856                 z          Z coordinate of a translation vector
857 
858   Returns:      none
859  *---------------------------------------------------------------------------*/
G3C_Translate(GXDLInfo * info,fx32 x,fx32 y,fx32 z)860 void G3C_Translate(GXDLInfo *info, fx32 x, fx32 y, fx32 z)
861 {
862     G3CS_Translate(info, x, y, z);
863     G3C_UpdateGXDLInfo(info, G3OP_MTX_TRANS_NPARAMS);
864 }
865 
866 
867 /*---------------------------------------------------------------------------*
868   Name:         G3C_Color
869 
870   Description:  Makes a geometry command, which sends a vertex color.
871                 Also, the pointers of GXDLInfo proceed.
872 
873   Arguments:    info       a pointer to GXDLInfo
874                 rgb        a vertex color(R:5, G:5, B:5)
875 
876   Returns:      none
877  *---------------------------------------------------------------------------*/
G3C_Color(GXDLInfo * info,GXRgb rgb)878 void G3C_Color(GXDLInfo *info, GXRgb rgb)
879 {
880     G3CS_Color(info, rgb);
881     G3C_UpdateGXDLInfo(info, G3OP_COLOR_NPARAMS);
882 }
883 
884 
885 /*---------------------------------------------------------------------------*
886   Name:         G3C_Normal
887 
888   Description:  Makes a geometry command, which sends a normal vector.
889                 Also, the pointers of GXDLInfo proceed.
890 
891   Arguments:    info       a pointer to GXDLInfo
892                 x          X coordinate of a normal vector
893                 y          Y coordinate of a normal vector
894                 z          Z coordinate of a normal vector
895 
896   Returns:      none
897  *---------------------------------------------------------------------------*/
G3C_Normal(GXDLInfo * info,fx16 x,fx16 y,fx16 z)898 void G3C_Normal(GXDLInfo *info, fx16 x, fx16 y, fx16 z)
899 {
900     G3CS_Normal(info, x, y, z);
901     G3C_UpdateGXDLInfo(info, G3OP_NORMAL_NPARAMS);
902 }
903 
904 
905 /*---------------------------------------------------------------------------*
906   Name:         G3C_TexCoord
907 
908   Description:  Makes a geometry command, which sends a texture coordinate.
909                 Also, the pointers of GXDLInfo proceed.
910 
911   Arguments:    info       a pointer to GXDLInfo
912                 s          an S of a texture coordinate
913                 t          a T of a texture coordinate
914 
915   Returns:      none
916  *---------------------------------------------------------------------------*/
G3C_TexCoord(GXDLInfo * info,fx32 s,fx32 t)917 void G3C_TexCoord(GXDLInfo *info, fx32 s, fx32 t)
918 {
919     G3CS_TexCoord(info, s, t);
920     G3C_UpdateGXDLInfo(info, G3OP_TEXCOORD_NPARAMS);
921 }
922 
923 
924 /*---------------------------------------------------------------------------*
925   Name:         G3C_Vtx
926 
927   Description:  Makes a geometry command, which sends a vertex as a fx16 vector.
928                 Also, the pointers of GXDLInfo proceed.
929 
930   Arguments:    info       a pointer to GXDLInfo
931                 x          X coordinate of a vertex
932                 y          Y coordinate of a vertex
933                 z          Z coordinate of a vertex
934 
935   Returns:      none
936  *---------------------------------------------------------------------------*/
G3C_Vtx(GXDLInfo * info,fx16 x,fx16 y,fx16 z)937 void G3C_Vtx(GXDLInfo *info, fx16 x, fx16 y, fx16 z)
938 {
939     G3CS_Vtx(info, x, y, z);
940     G3C_UpdateGXDLInfo(info, G3OP_VTX_16_NPARAMS);
941 }
942 
943 
944 /*---------------------------------------------------------------------------*
945   Name:         G3C_Vtx10
946 
947   Description:  Makes a geometry command, which sends a vertex as a s3.6 vector.
948                 Also, the pointers of GXDLInfo proceed.
949 
950   Arguments:    info       a pointer to GXDLInfo
951                 x          X coordinate of a vertex
952                 y          Y coordinate of a vertex
953                 z          Z coordinate of a vertex
954 
955   Returns:      none
956  *---------------------------------------------------------------------------*/
G3C_Vtx10(GXDLInfo * info,fx16 x,fx16 y,fx16 z)957 void G3C_Vtx10(GXDLInfo *info, fx16 x, fx16 y, fx16 z)
958 {
959     G3CS_Vtx10(info, x, y, z);
960     G3C_UpdateGXDLInfo(info, G3OP_VTX_10_NPARAMS);
961 }
962 
963 
964 /*---------------------------------------------------------------------------*
965   Name:         G3C_VtxXY
966 
967   Description:  Makes a geometry command, which sends XY components of a vertex.
968                 The Z coordinate is the same to the vertex sent just before.
969                 Also, the pointers of GXDLInfo proceed.
970 
971   Arguments:    info       a pointer to GXDLInfo
972                 x          X coordinate of a vertex
973                 y          Y coordinate of a vertex
974 
975   Returns:      none
976  *---------------------------------------------------------------------------*/
G3C_VtxXY(GXDLInfo * info,fx16 x,fx16 y)977 void G3C_VtxXY(GXDLInfo *info, fx16 x, fx16 y)
978 {
979     G3CS_VtxXY(info, x, y);
980     G3C_UpdateGXDLInfo(info, G3OP_VTX_XY_NPARAMS);
981 }
982 
983 
984 /*---------------------------------------------------------------------------*
985   Name:         G3C_VtxXZ
986 
987   Description:  Makes a geometry command, which sends XZ components of a vertex.
988                 The Y coordinate is the same to the vertex sent just before.
989                 Also, the pointers of GXDLInfo proceed.
990 
991   Arguments:    info       a pointer to GXDLInfo
992                 x          X coordinate of a vertex
993                 z          Z coordinate of a vertex
994 
995   Returns:      none
996  *---------------------------------------------------------------------------*/
G3C_VtxXZ(GXDLInfo * info,fx16 x,fx16 z)997 void G3C_VtxXZ(GXDLInfo *info, fx16 x, fx16 z)
998 {
999     G3CS_VtxXZ(info, x, z);
1000     G3C_UpdateGXDLInfo(info, G3OP_VTX_XZ_NPARAMS);
1001 }
1002 
1003 
1004 /*---------------------------------------------------------------------------*
1005   Name:         G3C_VtxYZ
1006 
1007   Description:  Makes a geometry command, which sends YZ components of a vertex.
1008                 The X component is the same to the vertex sent just before.
1009                 Also, the pointers of GXDLInfo proceed.
1010 
1011   Arguments:    info       a pointer to GXDLInfo
1012                 y          Y coordinate of a vertex
1013                 z          Z coordinate of a vertex
1014 
1015   Returns:      none
1016  *---------------------------------------------------------------------------*/
G3C_VtxYZ(GXDLInfo * info,fx16 y,fx16 z)1017 void G3C_VtxYZ(GXDLInfo *info, fx16 y, fx16 z)
1018 {
1019     G3CS_VtxYZ(info, y, z);
1020     G3C_UpdateGXDLInfo(info, G3OP_VTX_YZ_NPARAMS);
1021 }
1022 
1023 
1024 /*---------------------------------------------------------------------------*
1025   Name:         G3C_VtxDiff
1026 
1027   Description:  Makes a geometry commnad, which sends a vector as an offset
1028                 to the last vertex sent.
1029                 Also, the pointers of GXDLInfo proceed.
1030 
1031   Arguments:    info       a pointer to GXDLInfo
1032                 x          X coordinate of an offset
1033                 y          Y coordinate of an offset
1034                 z          Z coordinate of an offset
1035 
1036   Returns:      none
1037  *---------------------------------------------------------------------------*/
G3C_VtxDiff(GXDLInfo * info,fx16 x,fx16 y,fx16 z)1038 void G3C_VtxDiff(GXDLInfo *info, fx16 x, fx16 y, fx16 z)
1039 {
1040     G3CS_VtxDiff(info, x, y, z);
1041     G3C_UpdateGXDLInfo(info, G3OP_VTX_DIFF_NPARAMS);
1042 }
1043 
1044 
1045 /*---------------------------------------------------------------------------*
1046   Name:         G3C_PolygonAttr
1047 
1048   Description:  Makes a geometry command, which sends attributes for polygons.
1049                 Also, the pointers of GXDLInfo proceed.
1050 
1051   Arguments:    info       a pointer to GXDLInfo
1052                 light      a 4bits field specifying light enable/disable
1053                 polyMode   a polygon mode
1054                 cullMode   a cull mode
1055                 polygonID  a polygon ID
1056                 alpha      an alpha value
1057                 misc       miscellaneous flags
1058 
1059   Returns:      none
1060  *---------------------------------------------------------------------------*/
G3C_PolygonAttr(GXDLInfo * info,int light,GXPolygonMode polyMode,GXCull cullMode,int polygonID,int alpha,int misc)1061 void G3C_PolygonAttr(GXDLInfo *info, int light, GXPolygonMode polyMode, GXCull cullMode, int polygonID, int alpha, int misc     // GXPolygonAttrMisc
1062     )
1063 {
1064     G3CS_PolygonAttr(info, light, polyMode, cullMode, polygonID, alpha, misc);
1065     G3C_UpdateGXDLInfo(info, G3OP_POLYGON_ATTR_NPARAMS);
1066 }
1067 
1068 
1069 /*---------------------------------------------------------------------------*
1070   Name:         G3C_TexImageParam
1071 
1072   Description:  Makes a geometry command, which sends parameters for a texture.
1073                 Also, the pointers of GXDLInfo proceed.
1074 
1075   Arguments:    info       a pointer to GXDLInfo
1076                 texFmt     format of a texture
1077                 texGen     selects the source of a texture coordinate
1078                 s          the size of a texture in the direction of the S-axis
1079                 t          the size of a texture in the direction of the T-axis
1080                 repeat     repeat
1081                 flip       flip
1082                 pltt0      use/not use the color of pltt. 0
1083                 addr       the offset address in the texture image slots
1084                            (shift 3bits internally)
1085 
1086   Returns:      none
1087  *---------------------------------------------------------------------------*/
G3C_TexImageParam(GXDLInfo * info,GXTexFmt texFmt,GXTexGen texGen,GXTexSizeS s,GXTexSizeT t,GXTexRepeat repeat,GXTexFlip flip,GXTexPlttColor0 pltt0,u32 addr)1088 void G3C_TexImageParam(GXDLInfo *info,
1089                        GXTexFmt texFmt,
1090                        GXTexGen texGen,
1091                        GXTexSizeS s, GXTexSizeT t, GXTexRepeat repeat, GXTexFlip flip,
1092                        GXTexPlttColor0 pltt0, u32 addr)
1093 {
1094     G3CS_TexImageParam(info, texFmt, texGen, s, t, repeat, flip, pltt0, addr);
1095 
1096     G3C_UpdateGXDLInfo(info, G3OP_TEXIMAGE_PARAM_NPARAMS);
1097 }
1098 
1099 
1100 /*---------------------------------------------------------------------------*
1101   Name:         G3C_TexPlttBase
1102 
1103   Description:  Makes a geometry command, which sends a base address of
1104                 a texture palette.
1105                 Also, the pointers of GXDLInfo proceed.
1106 
1107   Arguments:    info       a pointer to GXDLInfo
1108                 addr       the offset address in the texture palette slots
1109                 texFmt     format of a texture
1110 
1111   Returns:      none
1112  *---------------------------------------------------------------------------*/
G3C_TexPlttBase(GXDLInfo * info,u32 addr,GXTexFmt texfmt)1113 void G3C_TexPlttBase(GXDLInfo *info, u32 addr, GXTexFmt texfmt)
1114 {
1115     G3CS_TexPlttBase(info, addr, texfmt);
1116 
1117     G3C_UpdateGXDLInfo(info, G3OP_TEXPLTT_BASE_NPARAMS);
1118 }
1119 
1120 
1121 /*---------------------------------------------------------------------------*
1122   Name:         G3C_MaterialColorDiffAmb
1123 
1124   Description:  Makes a geometry command, which sends diffuse and ambient.
1125                 Also, the pointers of GXDLInfo proceed.
1126 
1127   Arguments:    info           a pointer to GXDLInfo
1128                 diffuse        a diffuse color
1129                 ambient        an ambient color
1130                 IsSetVtxColor  sets a diffuse color as a vertex color if TRUE
1131 
1132   Returns:      none
1133  *---------------------------------------------------------------------------*/
G3C_MaterialColorDiffAmb(GXDLInfo * info,GXRgb diffuse,GXRgb ambient,BOOL IsSetVtxColor)1134 void G3C_MaterialColorDiffAmb(GXDLInfo *info, GXRgb diffuse, GXRgb ambient, BOOL IsSetVtxColor)
1135 {
1136     G3CS_MaterialColorDiffAmb(info, diffuse, ambient, IsSetVtxColor);
1137     G3C_UpdateGXDLInfo(info, G3OP_DIF_AMB_NPARAMS);
1138 }
1139 
1140 
1141 /*---------------------------------------------------------------------------*
1142   Name:         G3C_MaterialColorSpecEmi
1143 
1144   Description:  Makes a geometry command, which sends specular and emission.
1145                 Also, the pointers of GXDLInfo proceed.
1146 
1147   Arguments:    info           a pointer to GXDLInfo
1148                 specular       a specular color
1149                 emission       an emission color
1150                 IsShininess    use the shininess table to change a specular
1151                                color if TRUE
1152 
1153   Returns:      none
1154  *---------------------------------------------------------------------------*/
G3C_MaterialColorSpecEmi(GXDLInfo * info,GXRgb specular,GXRgb emission,BOOL IsShininess)1155 void G3C_MaterialColorSpecEmi(GXDLInfo *info, GXRgb specular, GXRgb emission, BOOL IsShininess)
1156 {
1157     G3CS_MaterialColorSpecEmi(info, specular, emission, IsShininess);
1158     G3C_UpdateGXDLInfo(info, G3OP_SPE_EMI_NPARAMS);
1159 }
1160 
1161 
1162 /*---------------------------------------------------------------------------*
1163   Name:         G3C_LightVector
1164 
1165   Description:  Makes a geometry command, which sends a light vector.
1166                 Also, the pointers of GXDLInfo proceed.
1167 
1168   Arguments:    info       a pointer to GXDLInfo
1169                 lightID    light ID
1170                 x          X coordinate of a light vector
1171                 y          Y coordinate of a light vector
1172                 z          Z coordinate of a light vector
1173 
1174   Returns:      none
1175  *---------------------------------------------------------------------------*/
G3C_LightVector(GXDLInfo * info,GXLightId lightID,fx16 x,fx16 y,fx16 z)1176 void G3C_LightVector(GXDLInfo *info, GXLightId lightID, fx16 x, fx16 y, fx16 z)
1177 {
1178     G3CS_LightVector(info, lightID, x, y, z);
1179     G3C_UpdateGXDLInfo(info, G3OP_LIGHT_VECTOR_NPARAMS);
1180 }
1181 
1182 
1183 /*---------------------------------------------------------------------------*
1184   Name:         G3C_LightColor
1185 
1186   Description:  Makes a geometry command, which sends a light color.
1187                 Also, the pointers of GXDLInfo proceed.
1188 
1189   Arguments:    info       a pointer to GXDLInfo
1190                 lightID    light ID
1191                 rgb        a light color(R:5, G:5, B:5)
1192 
1193   Returns:      none
1194  *---------------------------------------------------------------------------*/
G3C_LightColor(GXDLInfo * info,GXLightId lightID,GXRgb rgb)1195 void G3C_LightColor(GXDLInfo *info, GXLightId lightID, GXRgb rgb)
1196 {
1197     G3CS_LightColor(info, lightID, rgb);
1198     G3C_UpdateGXDLInfo(info, G3OP_LIGHT_COLOR_NPARAMS);
1199 }
1200 
1201 
1202 /*---------------------------------------------------------------------------*
1203   Name:         G3C_Shininess
1204 
1205   Description:  Makes a geometry command, which sets up the shininess table.
1206                 Also, the pointers of GXDLInfo proceed.
1207 
1208   Arguments:    info       a pointer to GXDLInfo
1209                 table      a pointer to the shininess data(32 words)
1210 
1211   Returns:      none
1212  *---------------------------------------------------------------------------*/
G3C_Shininess(GXDLInfo * info,const u32 * table)1213 void G3C_Shininess(GXDLInfo *info, const u32 *table)
1214 {
1215     G3CS_Shininess(info, table);
1216     G3C_UpdateGXDLInfo(info, G3OP_SHININESS_NPARAMS);
1217 }
1218 
1219 
1220 /*---------------------------------------------------------------------------*
1221   Name:         G3C_Begin
1222 
1223   Description:  Makes a geometry command, which starts sending primitives.
1224                 Also, the pointers of GXDLInfo proceed.
1225 
1226   Arguments:    info       a pointer to GXDLInfo
1227                 primitive  the type of primitives
1228 
1229   Returns:      none
1230  *---------------------------------------------------------------------------*/
G3C_Begin(GXDLInfo * info,GXBegin primitive)1231 void G3C_Begin(GXDLInfo *info, GXBegin primitive)
1232 {
1233     G3CS_Begin(info, primitive);
1234     G3C_UpdateGXDLInfo(info, G3OP_BEGIN_NPARAMS);
1235 }
1236 
1237 
1238 /*---------------------------------------------------------------------------*
1239   Name:         G3C_End
1240 
1241   Description:  Makes a geometry command, which ends sending primitives.
1242                 Also, the pointers of GXDLInfo proceed.
1243 
1244   Arguments:    info       a pointer to GXDLInfo
1245 
1246   Returns:      none
1247  *---------------------------------------------------------------------------*/
G3C_End(GXDLInfo * info)1248 void G3C_End(GXDLInfo *info)
1249 {
1250     G3CS_End(info);
1251     G3C_UpdateGXDLInfo(info, G3OP_END_NPARAMS);
1252 }
1253 
1254 
1255 /*---------------------------------------------------------------------------*
1256   Name:         G3C_SwapBuffers
1257 
1258   Description:  Makes a geometry command, which swaps the polygon list RAM,
1259                 the vertex RAM, etc.
1260                 Also, the pointers of GXDLInfo proceed.
1261 
1262   Arguments:    info       a pointer to GXDLInfo
1263                 am         auto sort/manual sort
1264                 zw         Z buffer/W buffer
1265 
1266   Returns:      none
1267  *---------------------------------------------------------------------------*/
G3C_SwapBuffers(GXDLInfo * info,GXSortMode am,GXBufferMode zw)1268 void G3C_SwapBuffers(GXDLInfo *info, GXSortMode am, GXBufferMode zw)
1269 {
1270     G3CS_SwapBuffers(info, am, zw);
1271     G3C_UpdateGXDLInfo(info, G3OP_SWAP_BUFFERS_NPARAMS);
1272 }
1273 
1274 
1275 /*---------------------------------------------------------------------------*
1276   Name:         G3C_ViewPort
1277 
1278   Description:  Makes a geometry command, which specifies viewport.
1279                 Also, the pointers of GXDLInfo proceed.
1280 
1281   Arguments:    info       a pointer to GXDLInfo
1282                 x1         the X coordinate of the lower left
1283                 y1         the Y coordinate of the lower left
1284                 x2         the X coordinate of the upper right
1285                 y2         the Y coordinate of the upper right
1286 
1287   Returns:      none
1288  *---------------------------------------------------------------------------*/
G3C_ViewPort(GXDLInfo * info,int x1,int y1,int x2,int y2)1289 void G3C_ViewPort(GXDLInfo *info, int x1, int y1, int x2, int y2)
1290 {
1291     G3CS_ViewPort(info, x1, y1, x2, y2);
1292     G3C_UpdateGXDLInfo(info, G3OP_VIEWPORT_NPARAMS);
1293 }
1294 
1295 
1296 /*---------------------------------------------------------------------------*
1297   Name:         G3C_BoxTest
1298 
1299   Description:  Makes a geometry command, which tests if a box is
1300                 in the frustum or not.
1301                 Also, the pointers of GXDLInfo proceed.
1302 
1303   Arguments:    info       a pointer to GXDLInfo
1304                 box        a pointer to GXBoxTestParam
1305 
1306   Returns:      none
1307  *---------------------------------------------------------------------------*/
G3C_BoxTest(GXDLInfo * info,const GXBoxTestParam * box)1308 void G3C_BoxTest(GXDLInfo *info, const GXBoxTestParam *box)
1309 {
1310     G3CS_BoxTest(info, box);
1311     G3C_UpdateGXDLInfo(info, G3OP_BOX_TEST_NPARAMS);
1312 }
1313 
1314 
1315 /*---------------------------------------------------------------------------*
1316   Name:         G3C_PositionTest
1317 
1318   Description:  Makes a geometry command, which applies a position vector
1319                 to the current clip matrix.
1320                 Also, the pointers of GXDLInfo proceed.
1321 
1322   Arguments:    info       a pointer to GXDLInfo
1323                 x          X coordinate of a position
1324                 y          Y coordinate of a position
1325                 z          Z coordinate of a position
1326 
1327   Returns:      none
1328  *---------------------------------------------------------------------------*/
G3C_PositionTest(GXDLInfo * info,fx16 x,fx16 y,fx16 z)1329 void G3C_PositionTest(GXDLInfo *info, fx16 x, fx16 y, fx16 z)
1330 {
1331     G3CS_PositionTest(info, x, y, z);
1332     G3C_UpdateGXDLInfo(info, G3OP_POS_TEST_NPARAMS);
1333 }
1334 
1335 
1336 /*---------------------------------------------------------------------------*
1337   Name:         G3C_VectorTest
1338 
1339   Description:  Makes a geometry command, which applies a vector
1340                 to the current vector matrix.
1341                 Also, the pointers of GXDLInfo proceed.
1342 
1343   Arguments:    info       a pointer to GXDLInfo
1344                 x          X coordinate of a vector
1345                 y          Y coordinate of a vector
1346                 z          Z coordinate of a vector
1347 
1348   Returns:      none
1349  *---------------------------------------------------------------------------*/
G3C_VectorTest(GXDLInfo * info,fx16 x,fx16 y,fx16 z)1350 void G3C_VectorTest(GXDLInfo *info, fx16 x, fx16 y, fx16 z)
1351 {
1352     G3CS_VectorTest(info, x, y, z);
1353     G3C_UpdateGXDLInfo(info, G3OP_VEC_TEST_NPARAMS);
1354 }
1355