ajout de la fonction bool FE_ZBuffer::setDist(int x, int y, int dist)

This commit is contained in:
util1 2019-07-18 20:29:34 +02:00
parent 8e9bda2b82
commit dfd33a0a00
2 changed files with 25 additions and 2 deletions

View File

@ -1,9 +1,32 @@
#include "zbuffer.h"
int FE_ZBuffer::m_sign=1;
int* FE_ZBuffer::m_data=0;
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;
}

View File

@ -11,7 +11,7 @@ public:
static void clear(); // does not really clear the zbuffer, but changes encoding sign for the next frame ** on 1st frame, allocates data
static bool setDist(int x, int y, int dist); // if you are allowed to draw the pixel on vram
private:
static int* m_data;
static unsigned short* m_data;
static int m_sign;
}