diff options
author | chai <chaifix@163.com> | 2019-12-08 00:24:22 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-12-08 00:24:22 +0800 |
commit | 0c4b1e68d64996a4aa5b136ddb6ee5643e159ef2 (patch) | |
tree | 0a263567be678f8b945b1472392f09b77b31b9eb /src/core/clip.h | |
parent | 3df29dc54c509c983dc8a0e23eab4160d48144f2 (diff) |
+test
Diffstat (limited to 'src/core/clip.h')
-rw-r--r-- | src/core/clip.h | 34 |
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 |