This repository has been archived by the owner on Dec 14, 2020. It is now read-only.
forked from danbolt/LunarAssault64
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphic.c
53 lines (44 loc) · 1.84 KB
/
graphic.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <nusys.h>
#include "graphic.h"
Gfx gfx_glist[3][GFX_GLIST_LEN];
DisplayData gfx_dynamic[3];
Gfx* glistp;
u32 gfx_gtask_no = 0;
/*----------------------------------------------------------------------------
gfxRCPIinit
The initialization of RSP/RDP
----------------------------------------------------------------------------*/
void gfxRCPInit(void)
{
/* Setting the RSP segment register */
gSPSegment(glistp++, 0, 0x0); /* For the CPU virtual address */
/* Setting RSP */
gSPDisplayList(glistp++, OS_K0_TO_PHYSICAL(setup_rspstate));
/* Setting RDP */
gSPDisplayList(glistp++, OS_K0_TO_PHYSICAL(setup_rdpstate));
}
/*----------------------------------------------------------------------------
gfxClearCfb
Address setting and clearing the frame buffer/Z-buffer
Using nuGfxZBuffer (the address of the Z-buffer) and nuGfxCfb_ptr (the
address of the frame buffer) which are global variables of NuSYSTEM.
----------------------------------------------------------------------------*/
void gfxClearCfb(void)
{
/* Clear the Z-buffer */
gDPSetDepthImage(glistp++, OS_K0_TO_PHYSICAL(nuGfxZBuffer));
gDPSetCycleType(glistp++, G_CYC_FILL);
gDPSetColorImage(glistp++, G_IM_FMT_RGBA, G_IM_SIZ_16b,SCREEN_WD,
OS_K0_TO_PHYSICAL(nuGfxZBuffer));
gDPSetFillColor(glistp++,(GPACK_ZDZ(G_MAXFBZ,0) << 16 |
GPACK_ZDZ(G_MAXFBZ,0)));
gDPFillRectangle(glistp++, 0, 0, SCREEN_WD-1, SCREEN_HT-1);
gDPPipeSync(glistp++);
/* Clear the frame buffer */
gDPSetColorImage(glistp++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WD,
osVirtualToPhysical(nuGfxCfb_ptr));
gDPSetFillColor(glistp++, (GPACK_RGBA5551(0, 0, 0, 1) << 16 |
GPACK_RGBA5551(0, 0, 0, 1)));
gDPFillRectangle(glistp++, 0, 0, SCREEN_WD-1, SCREEN_HT-1);
gDPPipeSync(glistp++);
}