summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-12-31 14:46:33 -0800
committer3gg <3gg@shellblade.net>2025-12-31 14:46:33 -0800
commit1ae1b370da0ce0cf8501b9e6be8c6ac25e249e1a (patch)
treea9312684a6c616ace9a8d0eb997b239131eb29d4 /include
parent57c6cf991b498aa19cc1cb3d736fec08d3643490 (diff)
Initial texturing changes
Diffstat (limited to 'include')
-rw-r--r--include/swgfx.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/swgfx.h b/include/swgfx.h
index 970e3fa..4a98116 100644
--- a/include/swgfx.h
+++ b/include/swgfx.h
@@ -38,8 +38,18 @@ typedef uint16_t sgIdx;
38typedef struct sgVertIdx { sgIdx pos, uv, normal; } sgVertIdx; 38typedef struct sgVertIdx { sgIdx pos, uv, normal; } sgVertIdx;
39typedef struct sgTriIdx { sgVertIdx v0, v1, v2; } sgTriIdx; 39typedef struct sgTriIdx { sgVertIdx v0, v1, v2; } sgTriIdx;
40 40
41typedef struct sgBgra { uint8_t b, g, r, a; } sgBgra;
42typedef struct sgRgba { uint8_t r, g, b, a; } sgRgba;
41// TODO: Should we use real-valued colours? 43// TODO: Should we use real-valued colours?
42typedef struct sgPixel { uint8_t r, g, b, a; } sgPixel; 44typedef sgRgba sgPixel;
45// TODO: Expose a macro to control the desired surface format.
46typedef sgBgra sgScreenPixel;
47
48typedef struct sgTexture_t {
49 int width;
50 int height;
51 sgPixel* pixels;
52} sgTexture_t;
43 53
44typedef struct swgfx swgfx; 54typedef struct swgfx swgfx;
45 55
@@ -49,7 +59,7 @@ void sgDel(swgfx**);
49 59
50// TODO: Write client app first, then implement the functions below in the C file. 60// TODO: Write client app first, then implement the functions below in the C file.
51 61
52void sgPresent(swgfx*, sgVec2i dimensions, sgPixel* screen); 62void sgPresent(swgfx*, sgVec2i dimensions, sgScreenPixel* screen);
53 63
54void sgModelId (swgfx*); 64void sgModelId (swgfx*);
55void sgModel (swgfx*, sgVec3 position, sgVec3 right, sgVec3 up, sgVec3 forward); 65void sgModel (swgfx*, sgVec3 position, sgVec3 right, sgVec3 up, sgVec3 forward);
@@ -58,6 +68,8 @@ void sgOrtho (swgfx*, R left, R right, R top, R bottom, R near, R far);
58void sgPerspective(swgfx*, R fovy, R aspect, R near, R far); 68void sgPerspective(swgfx*, R fovy, R aspect, R near, R far);
59void sgViewport (swgfx*, int x0, int y0, int width, int height); 69void sgViewport (swgfx*, int x0, int y0, int width, int height);
60 70
71void sgTexture(swgfx*, const sgTexture_t*);
72
61void sgClear(swgfx*); 73void sgClear(swgfx*);
62void sgPixels(swgfx*, size_t count, const sgVec2i* positions, sgPixel colour); 74void sgPixels(swgfx*, size_t count, const sgVec2i* positions, sgPixel colour);
63void sgQuads (swgfx*, size_t count, const sgQuad*); 75void sgQuads (swgfx*, size_t count, const sgQuad*);