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 --- src/scene33.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/scene33.c (limited to 'src/scene33.c') diff --git a/src/scene33.c b/src/scene33.c new file mode 100644 index 0000000..00bd177 --- /dev/null +++ b/src/scene33.c @@ -0,0 +1,45 @@ +#include "logger33.h" +#include "scene33.h" +#include "strings33.h" + + +Scene33 __scene = {0,}; + + +Error scene33_init( void ) +{ + Size i; + + Vec4 verts[ GFX33_QUAD_VERTEX_COUNT ] = GFX33_QUAD_VERTICES; + ModelEdge33 medge[ GFX33_QUAD_EDGE_COUNT ] = GFX33_QUAD_MEDGES; + Size sedge[ GFX33_QUAD_SEDGE_COUNT ] = GFX33_QUAD_SEDGES; + + __scene.cube.vertices = malloc( sizeof(Vec4) * GFX33_QUAD_VERTEX_COUNT ); + __scene.cube.medges = malloc( sizeof(ModelEdge33) * GFX33_QUAD_EDGE_COUNT ); + __scene.cube.sedges = malloc( sizeof(Size) * GFX33_QUAD_SEDGE_COUNT ); + + memcpy( __scene.cube.vertices, verts, sizeof(Vec4) * GFX33_QUAD_VERTEX_COUNT ); + memcpy( __scene.cube.medges, medge, sizeof(ModelEdge33) * GFX33_QUAD_EDGE_COUNT ); + memcpy( __scene.cube.sedges, sedge, sizeof(Size) * GFX33_QUAD_SEDGE_COUNT ); + + __scene.cube.vertexCount = GFX33_QUAD_VERTEX_COUNT; + __scene.cube.edgeCount = GFX33_QUAD_EDGE_COUNT; + __scene.cube.surfaceCount = GFX33_QUAD_SFACE_COUNT; + + __scene.cube.t[2] = 10.0; + __scene.cube.s[0] = 1.0; + __scene.cube.s[1] = 1.0; + __scene.cube.s[2] = 1.0; + + return E33_EXIT_SUCCESS; +} + + +Error scene33_term( void ) +{ + free( __scene.cube.vertices ); + free( __scene.cube.medges ); + free( __scene.cube.sedges ); + + return E33_EXIT_SUCCESS; +} -- cgit v1.2.3