35 lines
705 B
C
35 lines
705 B
C
#include "zbuffer.h"
|
|
#include <stdbool.h>
|
|
|
|
static const int size_short_native = 8192;
|
|
static const int size_uint32 = size_short_native/2;
|
|
static const int size_char = 8192*4;
|
|
|
|
static unsigned short* address=0;
|
|
|
|
void FE_zbuffer_clear()
|
|
{
|
|
while (address==0)
|
|
{address=calloc(size_char);}
|
|
|
|
int* clearVal=(int*)address;
|
|
int indice=0;
|
|
// TODO ** ajouter le DMA pour les architectures sh4
|
|
for (indice=0; indice<4096; indice++)
|
|
clearVal[indice]=0;
|
|
}
|
|
|
|
bool FE_zbuffer_set_dist(int x, int y, int dist)
|
|
{
|
|
short ndist=(short)dist;
|
|
x%=FE_ZB_SIZE_X;
|
|
y%=FE_ZB_SIZE_Y;
|
|
const int indice=x*y;
|
|
if (address[indice]=0 || address[indice]>ndist)
|
|
{
|
|
address[indice]=ndist;
|
|
return true;
|
|
}
|
|
else
|
|
return false;
|
|
} |