aboutsummaryrefslogtreecommitdiff
path: root/include/graphics33.h
diff options
context:
space:
mode:
authorpk33 <pk33@pk33.space>2024-11-14 15:06:07 +0100
committerpk33 <pk33@pk33.space>2024-11-14 15:06:07 +0100
commited2a4bc4400c38ecd11baccac5db328b797b5d68 (patch)
treeb703749d0639f933edca4c3a78209159aa735c25 /include/graphics33.h
parent5a54774474f43ae29716751d6415563a59b92c7d (diff)
downloadengine33-master.tar.gz
begin 3D rendering, basic camera controlsHEADmaster
Diffstat (limited to 'include/graphics33.h')
-rw-r--r--include/graphics33.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/include/graphics33.h b/include/graphics33.h
new file mode 100644
index 0000000..af7de8e
--- /dev/null
+++ b/include/graphics33.h
@@ -0,0 +1,67 @@
+#ifndef __GRAPHICS33_H__
+#define __GRAPHICS33_H__
+
+
+#include "math33.h"
+
+
+typedef struct Surface33 {
+ u32 *data;
+ Size w, h;
+} Surface33;
+
+typedef struct ModelEdge33 {
+ Size vertices[2];
+ Size cacheOffset;
+} ModelEdge33;
+
+typedef struct Model33 {
+ Vec4 *vertices;
+ ModelEdge33 *medges;
+ Size *sedges;
+
+ Vec3 t;
+ Vec3 r;
+ Vec3 s;
+
+ Size vertexCount;
+ Size edgeCount;
+ Size surfaceCount;
+} Model33;
+
+
+Error graphics33_init( void );
+Error graphics33_term( void );
+void graphics33_update( void );
+
+
+
+#define GFX33_QUAD_VERTEX_COUNT 4
+
+#define GFX33_QUAD_VERTICES {\
+ { -1.0, -1.0, 0.0, 1.0 },\
+ { -1.0, 1.0, 0.0, 1.0 },\
+ { 1.0, 1.0, 0.0, 1.0 },\
+ { 1.0, -1.0, 0.0, 1.0 }\
+}
+
+
+#define GFX33_QUAD_EDGE_COUNT 5
+
+#define GFX33_QUAD_MEDGES {\
+ { {0,1}, 0 },\
+ { {1,2}, 0 },\
+ { {2,3}, 0 },\
+ { {0,3}, 0 },\
+ { {1,3}, 0 }\
+}
+
+#define GFX33_QUAD_SFACE_COUNT 2
+#define GFX33_QUAD_SEDGE_COUNT (GFX33_QUAD_SFACE_COUNT * 3)
+
+#define GFX33_QUAD_SEDGES {\
+ 0, 4, 3, 1, 2, 4\
+}
+
+
+#endif /** GFX33_H **/