summaryrefslogtreecommitdiff
path: root/dat.h
blob: 3b1151276cfe56d4172c91d21b3cac8e8ee50899 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
typedef Point Triangle[3];
typedef struct VSparams VSparams;
typedef struct FSparams FSparams;
typedef struct SUparams SUparams;
typedef struct Shader Shader;
typedef struct Framebuf Framebuf;
typedef struct Framebufctl Framebufctl;

/* shader params */
struct VSparams
{
	SUparams *su;
	Point3 *p;
	Point3 *n;
	uint idx;
};

struct FSparams
{
	SUparams *su;
	Memimage *frag;
	Point p;
	Point3 bc;
	uchar *cbuf;
};

/* shader unit params */
struct SUparams
{
	Framebuf *fb;
	OBJElem **b, **e;
	int id;
	Channel *donec;

	double var_intensity[3];

	uvlong uni_time;

	Point3 (*vshader)(VSparams*);
	Memimage *(*fshader)(FSparams*);
};

struct Shader
{
	char *name;
	Point3 (*vshader)(VSparams*);
	Memimage *(*fshader)(FSparams*);
};

struct Framebuf
{
	Memimage *cb;
	Memimage *zb;
	double *zbuf;
	Lock zbuflk;
	Memimage *nb;	/* XXX DBG */
	Rectangle r;
};

struct Framebufctl
{
	Framebuf *fb[2];
	uint idx;
	Lock swplk;

	void (*draw)(Framebufctl*, Memimage*, int);
	void (*swap)(Framebufctl*);
	void (*reset)(Framebufctl*);
};

typedef struct Stats Stats;
struct Stats
{
	uvlong min, avg, max, acc, n, v;
};