ajout de la fonction bool FE_ZBuffer::setDist(int x, int y, int dist)
This commit is contained in:
parent
8e9bda2b82
commit
dfd33a0a00
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue