From ed2a4bc4400c38ecd11baccac5db328b797b5d68 Mon Sep 17 00:00:00 2001 From: pk33 Date: Thu, 14 Nov 2024 15:06:07 +0100 Subject: begin 3D rendering, basic camera controls --- include/graphics33.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 include/graphics33.h (limited to 'include/graphics33.h') 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 **/ -- cgit v1.2.3