blob: 2ac733d5a09a33376aa184d8133dd5895cabf18d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#ifndef _SOFTSHADEROOM_CLIP_H_
#define _SOFTSHADEROOM_CLIP_H_
#include "../util/type.h"
#include "vert.h"
#include "shader.h"
#define LERP(t,a,b) ((1-(t))*(a)+(t)*(b))
typedef struct {
/*clipping coord*/
Vec4 clip_coord;
/*vertex data*/
Vert vertex;
} ClippedVert;
#define CLIP_BUFFER_SIZE 6
typedef struct {
ClippedVert vertices[CLIP_BUFFER_SIZE];
uint count;
/*temp register*/
float temp_reg_num[REG_NUM_COUNT][CLIP_BUFFER_SIZE];
Vec2 temp_reg_v2[REG_V2_COUNT][CLIP_BUFFER_SIZE];
Vec3 temp_reg_v3[REG_V3_COUNT][CLIP_BUFFER_SIZE];
Vec4 temp_reg_v4[REG_V4_COUNT][CLIP_BUFFER_SIZE];
} ClippedBuffer;
ClippedBuffer clip_buffer;
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
|