summaryrefslogtreecommitdiff
path: root/render.h
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-07-15 21:08:33 +1000
committerquou <quou@disroot.org>2024-07-15 21:08:33 +1000
commit24097f5aacbf46ec1500ab84a60bade28b53a301 (patch)
tree44fabe537357779f06a03e91fc20a5d996ba5296 /render.h
parent680cab5cf1778958e7257f19957ac2b5d46d45dc (diff)
Screen space clipping and backface culling.
Diffstat (limited to 'render.h')
-rw-r--r--render.h24
1 files changed, 22 insertions, 2 deletions
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,