diff options
author | quou <quou@disroot.org> | 2024-07-15 21:37:53 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-07-15 21:37:53 +1000 |
commit | 7564b36e12e51b0298234c6856b757ff15402b24 (patch) | |
tree | cd393ca7a134473f88bde4e621028aa1b3e14e4b | |
parent | 24097f5aacbf46ec1500ab84a60bade28b53a301 (diff) |
Dumb near plane clipping.
-rw-r--r-- | 3de.c | 1 | ||||
-rw-r--r-- | render.c | 11 |
2 files changed, 10 insertions, 2 deletions
@@ -86,6 +86,7 @@ int entrypoint(int argc, const char** argv, Arena* a) { sprintf(buf, "MOUSE: %d, %d", app->mx, app->my); ren_texts(&r, blue, 3, 13, buf); draw_monkey(&r); + draw_tri(&r, app->mx, app->my); ren_end(&r); app_end(app); fps_update(&f); @@ -161,7 +161,7 @@ void ren_begin(Renderer* r, Colour* t, int* d, int w, int h) { r->vp[2] = w; r->vp[3] = h; r->asp = (w << fbits) / h; - r->n = 8; + r->n = 256; } void ren_end(Renderer* r) { @@ -512,12 +512,19 @@ void ren_tri3( const Bitmap* tex ) { #define ec 8 -#define ec2 (ec * 2) +#define ec2 (ec) int tri[ec2 * 3]; int tc = 1, i; vec_cpy(&tri[0], iv0, ec); vec_cpy(&tri[8], iv1, ec); vec_cpy(&tri[16], iv2, ec); + if (tri[2] < r->n) tri[2] = r->n; + if (tri[10] < r->n) tri[10] = r->n; + if (tri[18] < r->n) tri[18] = r->n; + if ( + tri[2] == tri[10] && + tri[2] == tri[18] + ) return; for (i = 0; i < tc; i++) { int ti = i * ec, j; for (j = 0; j < 3; j++) { |