diff options
Diffstat (limited to 'src/core/clip.h')
-rw-r--r-- | src/core/clip.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/core/clip.h b/src/core/clip.h index b6f2702..c22bb8d 100644 --- a/src/core/clip.h +++ b/src/core/clip.h @@ -6,25 +6,37 @@ #define LERP(t,a,b) ((1-(t))*(a)+(t)*(b)) -typedef struct ClippedVert { +typedef struct { /*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 { +typedef struct { ClippedVert vertices[CLIP_BUFFER_SIZE]; uint count; + /*temp register*/ + float temp_reg_num[4][CLIP_BUFFER_SIZE]; + Vec2 temp_reg_v2[6][CLIP_BUFFER_SIZE]; + Vec3 temp_reg_v3[8][CLIP_BUFFER_SIZE]; + Vec4 temp_reg_v4[6][CLIP_BUFFER_SIZE]; } ClippedBuffer; +ClippedBuffer clip_buffer; + +typedef void* (*BcpInterpolator)(Vec3* bc, void* a, void* b, void* c, void* out); +typedef void* (*LinearInterpolator)(float t, void* a, void* b, void* c, void* out); + bool clip_triangle(Vec4* c0, Vec4* c1, Vec4* c2, Vert* v0, Vert* v1, Vert* v2, uint varying_flag, ClippedBuffer* clipped); uint clip_line(); |