|
|
@ -8,13 +8,7 @@ static DISPENV disp[2]; |
|
|
static DRAWENV draw[2]; |
|
|
static DRAWENV draw[2]; |
|
|
static int db; |
|
|
static int db; |
|
|
|
|
|
|
|
|
#define PRIMBUFLEN 131072 |
|
|
|
|
|
|
|
|
|
|
|
static u_long ot[2][OTLEN]; // Ordering tables, two arrays for double buffering. These are basically the buckets for bucket sorting of polygons. |
|
|
static u_long ot[2][OTLEN]; // Ordering tables, two arrays for double buffering. These are basically the buckets for bucket sorting of polygons. |
|
|
// You can also see them as "layers" in the modern 3D graphics sense, but they serve a more immediate role for polygon ordering. |
|
|
|
|
|
// Layer 0 is free for overlays, as polygons at depth 0 will be clipped. |
|
|
|
|
|
static char primbuff[2][PRIMBUFLEN]; // Primitive buffer, just a raw buffer of bytes to use as a pool for primitives |
|
|
|
|
|
static char *nextpri; |
|
|
|
|
|
|
|
|
|
|
|
const MATRIX identity = { |
|
|
const MATRIX identity = { |
|
|
ONE, 0, 0, |
|
|
ONE, 0, 0, |
|
|
@ -151,7 +145,7 @@ void display_start() |
|
|
curOT = ot[db]; |
|
|
curOT = ot[db]; |
|
|
ClearOTagR(curOT, OTLEN); |
|
|
ClearOTagR(curOT, OTLEN); |
|
|
|
|
|
|
|
|
nextpri = primbuff[db]; |
|
|
|
|
|
|
|
|
mem_prim_reset(db); |
|
|
|
|
|
|
|
|
gte_SetBackColor(48, 48, 48); // Ambient light color |
|
|
gte_SetBackColor(48, 48, 48); // Ambient light color |
|
|
gte_SetColorMatrix(&light_cols); // Light color (up to three different lights) |
|
|
gte_SetColorMatrix(&light_cols); // Light color (up to three different lights) |
|
|
@ -192,13 +186,3 @@ void display_finish() |
|
|
|
|
|
|
|
|
DrawOTag(curOT + OTLEN - 1); // This performs a DMA transfer to quickly send all the primitives off to the GPU |
|
|
DrawOTag(curOT + OTLEN - 1); // This performs a DMA transfer to quickly send all the primitives off to the GPU |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void *display_allocPrim(size_t size) |
|
|
|
|
|
{ |
|
|
|
|
|
if (nextpri + size > primbuff[db] + PRIMBUFLEN) |
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
|
void *prim = nextpri; |
|
|
|
|
|
nextpri += size; |
|
|
|
|
|
return prim; |
|
|
|
|
|
} |
|
|
|