From 24097f5aacbf46ec1500ab84a60bade28b53a301 Mon Sep 17 00:00:00 2001 From: quou Date: Mon, 15 Jul 2024 21:08:33 +1000 Subject: Screen space clipping and backface culling. --- render.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'render.h') diff --git a/render.h b/render.h index 3c8938f..e51478f 100644 --- a/render.h +++ b/render.h @@ -37,10 +37,23 @@ typedef struct Mesh { typedef struct { Colour* t; int* d; - int w, h, asp; + int asp, n; + int vp[4]; Rect clip; } Renderer; +int tri_os( + const Renderer* r, + const int* v0, + const int* v1, + const int* v2 +); +int point_os( + const Renderer* r, + int x, + int y +); + void ren_begin(Renderer* r, Colour* t, int* d, int w, int h); void ren_end(Renderer* r); void ren_clear(Renderer* r); @@ -86,7 +99,14 @@ void ren_tri( const int* v1, const int* v2, const Bitmap* tex -); +); /* Unsafe for 3D. Clips against the r->clip */ +void ren_tri3( + Renderer* r, + const int* v0, + const int* v1, + const int* v2, + const Bitmap* tex +); /* Does perspective calculation and clips against the near. */ void ren_mesh( Renderer* r, const Mesh* mesh, -- cgit v1.2.3-54-g00ecf