From d3b48593b0fee862ea60687336031fd9374ab667 Mon Sep 17 00:00:00 2001 From: rodri Date: Sat, 10 Aug 2024 17:57:02 +0000 Subject: experimental A-buffer implementation. very simple, without anti-aliasing, made for getting OIT (order independent transparency) rendering of arbitrary objects. also added switches for blending, depth testing and the A-buffer to the camera. --- fb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'fb.c') diff --git a/fb.c b/fb.c index 88883fd..6bd22e9 100644 --- a/fb.c +++ b/fb.c @@ -211,6 +211,16 @@ framebufctl_swap(Framebufctl *ctl) qunlock(ctl); } +static void +resetAbuf(Abuf *buf) +{ + while(buf->nact--) + free(buf->act[buf->nact]->items); + free(buf->act); + free(buf->stk); + memset(buf, 0, sizeof *buf); +} + static void framebufctl_reset(Framebufctl *ctl) { @@ -218,6 +228,7 @@ framebufctl_reset(Framebufctl *ctl) /* address the back buffer—resetting the front buffer is VERBOTEN */ fb = ctl->getbb(ctl); + resetAbuf(&fb->abuf); memset(fb->nb, 0, Dx(fb->r)*Dy(fb->r)*4); memsetf(fb->zb, Inf(-1), Dx(fb->r)*Dy(fb->r)); memset(fb->cb, 0, Dx(fb->r)*Dy(fb->r)*4); -- cgit v1.2.3