32 lines
601 B
C++
32 lines
601 B
C++
#include "zbuffer.h"
|
|
|
|
int FE_ZBuffer::m_sign=1;
|
|
unsigned short* FE_ZBuffer::m_data=calloc(8192,sizeof(unsigned short));
|
|
|
|
void FE_ZBuffer::clear()
|
|
{
|
|
m_sign*=-1;
|
|
while (m_data==NULL)
|
|
{}
|
|
int* clearVal=(int*)m_data;
|
|
int indice=0;
|
|
|
|
// TODO ** ajouter le DMA pour les architectures sh4
|
|
for (indice=0; indice<4096; indice++)
|
|
clearVal[indice]=0;
|
|
}
|
|
|
|
bool FE_ZBuffer::setDist(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 (m_data[indice]=0 || m_data[indice]>ndist)
|
|
{
|
|
m_data[indice]=ndist;
|
|
return true;
|
|
}
|
|
else
|
|
return false;
|
|
} |