From 57c6cf991b498aa19cc1cb3d736fec08d3643490 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Tue, 30 Dec 2025 17:24:42 -0800 Subject: Depth buffering and texture coords --- include/swgfx.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'include/swgfx.h') diff --git a/include/swgfx.h b/include/swgfx.h index 005359b..970e3fa 100644 --- a/include/swgfx.h +++ b/include/swgfx.h @@ -25,14 +25,18 @@ typedef struct sgVec4 { R x, y, z, w; } sgVec4; typedef sgVec3 sgNormal; -typedef struct sgQuadi { sgVec2i p0, p1; } sgQuadi; -typedef struct sgQuad { sgVec2 p0, p1; } sgQuad; -typedef struct sgTri2 { sgVec2 p0, p1, p2; } sgTri2; -typedef struct sgTri3 { sgVec3 p0, p1, p2; } sgTri3; +typedef struct sgVert2i { sgVec2i pos; sgVec2 uv; } sgVert2i; +typedef struct sgVert2 { sgVec2 pos; sgVec2 uv; } sgVert2; +typedef struct sgVert3 { sgVec3 pos; sgVec2 uv; } sgVert3; + +typedef struct sgQuadi { sgVert2i p0, p1; } sgQuadi; +typedef struct sgQuad { sgVert2 p0, p1; } sgQuad; +typedef struct sgTri2 { sgVert2 p0, p1, p2; } sgTri2; +typedef struct sgTri3 { sgVert3 p0, p1, p2; } sgTri3; typedef uint16_t sgIdx; -typedef struct sgVert { sgIdx position, normal, texcoord; } sgVert; -typedef struct sgTriIdx { sgVert v0, v1, v2; } sgTriIdx; +typedef struct sgVertIdx { sgIdx pos, uv, normal; } sgVertIdx; +typedef struct sgTriIdx { sgVertIdx v0, v1, v2; } sgTriIdx; // TODO: Should we use real-valued colours? typedef struct sgPixel { uint8_t r, g, b, a; } sgPixel; @@ -62,7 +66,7 @@ void sgTriangles2 (swgfx*, size_t count, const sgTri2*); void sgTriangleStrip2(swgfx*, size_t count, const sgVec2*); void sgTriangles (swgfx*, size_t count, const sgTri3*, const sgNormal*); void sgTriangleStrip (swgfx*, size_t count, const sgVec3*, const sgNormal*); -void sgTrianglesIndexed(swgfx*, size_t numIndices, const sgIdx* indices, const sgVec3* positions); -void sgTrianglesIndexedNonUniform(swgfx*, size_t numTris, const sgTriIdx* tris, const sgVec3* positions); +void sgTrianglesIndexed(swgfx*, size_t numIndices, const sgIdx* indices, const sgVec3* positions, const sgVec2* texcoords); +void sgTrianglesIndexedNonUniform(swgfx*, size_t numTris, const sgTriIdx* tris, const sgVec3* positions, const sgVec2* texcoords); void sgCheck(swgfx*); -- cgit v1.2.3