summaryrefslogtreecommitdiff
path: root/fb.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-08-10 17:57:02 +0000
committerrodri <rgl@antares-labs.eu>2024-08-10 17:57:02 +0000
commitd3b48593b0fee862ea60687336031fd9374ab667 (patch)
tree7810bcb85cbba3beee05e89b911c35f1d8e1b769 /fb.c
parent6eab9793d68feb3282714083b355d38c6c36400b (diff)
downloadlibgraphics-d3b48593b0fee862ea60687336031fd9374ab667.tar.gz
libgraphics-d3b48593b0fee862ea60687336031fd9374ab667.tar.bz2
libgraphics-d3b48593b0fee862ea60687336031fd9374ab667.zip
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.
Diffstat (limited to 'fb.c')
-rw-r--r--fb.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fb.c b/fb.c
index 88883fd..6bd22e9 100644
--- a/fb.c
+++ b/fb.c
@@ -212,12 +212,23 @@ framebufctl_swap(Framebufctl *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)
{
Framebuf *fb;
/* 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);