From b34446e7025a15bd5b74fd5f88bb952028cc8a4a Mon Sep 17 00:00:00 2001 From: rodri Date: Sat, 23 Dec 2023 00:12:34 +0000 Subject: organize the code better. --- dat.h | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 dat.h (limited to 'dat.h') diff --git a/dat.h b/dat.h new file mode 100644 index 0000000..3b11512 --- /dev/null +++ b/dat.h @@ -0,0 +1,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; +}; -- cgit v1.2.3