summaryrefslogtreecommitdiff
path: root/dat.h
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-12-23 00:12:34 +0000
committerrodri <rgl@antares-labs.eu>2023-12-23 00:12:34 +0000
commitb34446e7025a15bd5b74fd5f88bb952028cc8a4a (patch)
treebb6e51e0c63bcf4f167936fd8e7991da2bbb1ac1 /dat.h
parentf69cd8f04bbe059ce21f0c7be93fd081495c6371 (diff)
downloadtinyrend-b34446e7025a15bd5b74fd5f88bb952028cc8a4a.tar.gz
tinyrend-b34446e7025a15bd5b74fd5f88bb952028cc8a4a.tar.bz2
tinyrend-b34446e7025a15bd5b74fd5f88bb952028cc8a4a.zip
organize the code better.
Diffstat (limited to 'dat.h')
-rw-r--r--dat.h75
1 files changed, 75 insertions, 0 deletions
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;
+};