diff options
author | rodri <rgl@antares-labs.eu> | 2024-08-04 12:43:55 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-08-04 12:43:55 +0000 |
commit | c06379ee3aa51d3adf456c8d126feebd1da9de70 (patch) | |
tree | 29ac7900ec359038710a0c031b45dcf373a1920a | |
parent | 50f15bac90638da401d27229969dc502c75d1320 (diff) | |
download | libgraphics-c06379ee3aa51d3adf456c8d126feebd1da9de70.tar.gz libgraphics-c06379ee3aa51d3adf456c8d126feebd1da9de70.tar.bz2 libgraphics-c06379ee3aa51d3adf456c8d126feebd1da9de70.zip |
make the depth buffer 32-bit.
-rw-r--r-- | clip.c | 2 | ||||
-rw-r--r-- | fb.c | 4 | ||||
-rw-r--r-- | graphics.h | 2 | ||||
-rw-r--r-- | internal.h | 2 | ||||
-rw-r--r-- | render.c | 3 | ||||
-rw-r--r-- | util.c | 4 |
6 files changed, 9 insertions, 8 deletions
@@ -194,7 +194,7 @@ outcode(Point p, Rectangle r) } /* lerp vertex attributes to match the new positions */ -void +static void adjustverts(Point *p0, Point *p1, Vertex *v0, Vertex *v1) { Vertex v[2]; @@ -219,7 +219,7 @@ framebufctl_reset(Framebufctl *ctl) /* address the back buffer—resetting the front buffer is VERBOTEN */ fb = ctl->getbb(ctl); memset(fb->nb, 0, Dx(fb->r)*Dy(fb->r)*4); - memsetd(fb->zb, Inf(-1), Dx(fb->r)*Dy(fb->r)); + memsetf(fb->zb, Inf(-1), Dx(fb->r)*Dy(fb->r)); memset(fb->cb, 0, Dx(fb->r)*Dy(fb->r)*4); } @@ -244,7 +244,7 @@ mkfb(Rectangle r) memset(fb, 0, sizeof *fb); fb->cb = emalloc(Dx(r)*Dy(r)*4); fb->zb = emalloc(Dx(r)*Dy(r)*sizeof(*fb->zb)); - memsetd(fb->zb, Inf(-1), Dx(r)*Dy(r)); + memsetf(fb->zb, Inf(-1), Dx(r)*Dy(r)); fb->nb = emalloc(Dx(r)*Dy(r)*4); fb->r = r; return fb; @@ -249,7 +249,7 @@ struct Renderjob struct Framebuf { ulong *cb; /* color buffer */ - double *zb; /* z/depth buffer */ + float *zb; /* z/depth buffer */ ulong *nb; /* normals buffer (DBG only) */ Rectangle r; }; @@ -60,7 +60,7 @@ int min(int, int); int max(int, int); void swapi(int*, int*); void swappt(Point*, Point*); -void memsetd(void*, double, usize); +void memsetf(void*, float, usize); void memsetl(void*, ulong, usize); /* nanosec */ @@ -101,7 +101,8 @@ rasterize(Rastertask *task) Point p, dp, Δp, p0, p1; Point3 bc; Color c; - double z, dplen, perc; + double dplen, perc; + float z; int steep = 0, Δe, e, Δy; params = task->params; @@ -65,9 +65,9 @@ modulapt3(Point3 a, Point3 b) } void -memsetd(void *dp, double v, usize len) +memsetf(void *dp, float v, usize len) { - double *p, *ep; + float *p, *ep; for(p = dp, ep = p+len; p < ep; p++) *p = v; |