fxengine/src/render/zbuffer.c

44 lines
963 B
C

#include <fxengine/render/buffer.h>
/*
#include <fxengine/parameters.h>
#include <stdbool.h>
#include <stdint.h>
#include <gint/display.h>
#include <gint/std/stdio.h>
#include <gint/std/stdlib.h>
#include <gint/keyboard.h>
#include <gint/defs/attributes.h>
#include <gint/hardware.h>
*/
static const int size_uint32 = fe_width * fe_height;
static const int size_char = size_uint32 * sizeof(uint32_t);
// zbuffer et clear val sont 32B alignés pour ajouter éventuellement le DMA
static int32_t *zbuffer = (void *)0x88080000 - (((size_char >> 5) << 5) + 1);
void fe_clear_zbuffer()
{
uint32_t indice = 0;
for (indice = 0; indice < size_uint32; indice ++)
zbuffer[indice] = 20000000;
}
bool fe_zbuffer_set_px(const uint32_t x, const uint32_t y, const uint32_t dist)
{
const uint32_t indice = x * fe_height + y;
if (zbuffer[indice]>dist && dist)
{
zbuffer[indice] = dist;
return true;
}
return false;
}