summaryrefslogtreecommitdiff
path: root/src/core/clip.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/clip.h')
-rw-r--r--src/core/clip.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/core/clip.h b/src/core/clip.h
new file mode 100644
index 0000000..b6f2702
--- /dev/null
+++ b/src/core/clip.h
@@ -0,0 +1,34 @@
+#ifndef _SOFTSHADEROOM_CLIP_H_
+#define _SOFTSHADEROOM_CLIP_H_
+
+#include "../util/type.h"
+#include "vert.h"
+
+#define LERP(t,a,b) ((1-(t))*(a)+(t)*(b))
+
+typedef struct ClippedVert {
+ /*clipping coord*/
+ Vec4 clip_coord;
+ /*vertex data*/
+ Vert vertex;
+ /*register values*/
+ float num[4];
+ Vec2 v2[6];
+ Vec3 v3[8];
+ Vec4 v4[6];
+} ClippedVert;
+
+#define CLIP_BUFFER_SIZE 6
+
+typedef struct ClippedBuffer {
+ ClippedVert vertices[CLIP_BUFFER_SIZE];
+ uint count;
+} ClippedBuffer;
+
+bool clip_triangle(Vec4* c0, Vec4* c1, Vec4* c2, Vert* v0, Vert* v1, Vert* v2, uint varying_flag, ClippedBuffer* clipped);
+
+uint clip_line();
+
+uint clip_point();
+
+#endif \ No newline at end of file