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. --- graphics.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'graphics.h') diff --git a/graphics.h b/graphics.h index 4aa18f1..c9a7f67 100644 --- a/graphics.h +++ b/graphics.h @@ -54,6 +54,9 @@ typedef struct Shadertab Shadertab; typedef struct Renderer Renderer; typedef struct Rendertime Rendertime; typedef struct Renderjob Renderjob; +typedef struct Fragment Fragment; +typedef struct Astk Astk; +typedef struct Abuf Abuf; typedef struct Framebuf Framebuf; typedef struct Framebufctl Framebufctl; typedef struct Viewport Viewport; @@ -246,11 +249,34 @@ struct Renderjob Renderjob *next; }; +struct Fragment +{ + Color c; + float z; +}; + +struct Astk +{ + Point p; + Fragment *items; + ulong size; + int active; +}; + +struct Abuf +{ + QLock; + Astk *stk; /* framebuffer fragment stacks */ + Astk **act; /* active fragment stacks */ + ulong nact; +}; + struct Framebuf { ulong *cb; /* color buffer */ float *zb; /* z/depth buffer */ ulong *nb; /* normals buffer (DBG only) */ + Abuf abuf; /* A-buffer */ Rectangle r; }; @@ -300,6 +326,9 @@ struct Camera Matrix3 proj; /* VCS to clip space xform */ Projection projtype; int cullmode; + int enableblend; + int enabledepth; + int enableAbuff; struct { uvlong min, avg, max, acc, n, v; -- cgit v1.2.3