diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-31 14:46:33 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-31 14:46:33 -0800 |
| commit | 1ae1b370da0ce0cf8501b9e6be8c6ac25e249e1a (patch) | |
| tree | a9312684a6c616ace9a8d0eb997b239131eb29d4 /include | |
| parent | 57c6cf991b498aa19cc1cb3d736fec08d3643490 (diff) | |
Initial texturing changes
Diffstat (limited to 'include')
| -rw-r--r-- | include/swgfx.h | 16 |
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; | |||
| 38 | typedef struct sgVertIdx { sgIdx pos, uv, normal; } sgVertIdx; | 38 | typedef struct sgVertIdx { sgIdx pos, uv, normal; } sgVertIdx; |
| 39 | typedef struct sgTriIdx { sgVertIdx v0, v1, v2; } sgTriIdx; | 39 | typedef struct sgTriIdx { sgVertIdx v0, v1, v2; } sgTriIdx; |
| 40 | 40 | ||
| 41 | typedef struct sgBgra { uint8_t b, g, r, a; } sgBgra; | ||
| 42 | typedef 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? |
| 42 | typedef struct sgPixel { uint8_t r, g, b, a; } sgPixel; | 44 | typedef sgRgba sgPixel; |
| 45 | // TODO: Expose a macro to control the desired surface format. | ||
| 46 | typedef sgBgra sgScreenPixel; | ||
| 47 | |||
| 48 | typedef struct sgTexture_t { | ||
| 49 | int width; | ||
| 50 | int height; | ||
| 51 | sgPixel* pixels; | ||
| 52 | } sgTexture_t; | ||
| 43 | 53 | ||
| 44 | typedef struct swgfx swgfx; | 54 | typedef 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 | ||
| 52 | void sgPresent(swgfx*, sgVec2i dimensions, sgPixel* screen); | 62 | void sgPresent(swgfx*, sgVec2i dimensions, sgScreenPixel* screen); |
| 53 | 63 | ||
| 54 | void sgModelId (swgfx*); | 64 | void sgModelId (swgfx*); |
| 55 | void sgModel (swgfx*, sgVec3 position, sgVec3 right, sgVec3 up, sgVec3 forward); | 65 | void 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); | |||
| 58 | void sgPerspective(swgfx*, R fovy, R aspect, R near, R far); | 68 | void sgPerspective(swgfx*, R fovy, R aspect, R near, R far); |
| 59 | void sgViewport (swgfx*, int x0, int y0, int width, int height); | 69 | void sgViewport (swgfx*, int x0, int y0, int width, int height); |
| 60 | 70 | ||
| 71 | void sgTexture(swgfx*, const sgTexture_t*); | ||
| 72 | |||
| 61 | void sgClear(swgfx*); | 73 | void sgClear(swgfx*); |
| 62 | void sgPixels(swgfx*, size_t count, const sgVec2i* positions, sgPixel colour); | 74 | void sgPixels(swgfx*, size_t count, const sgVec2i* positions, sgPixel colour); |
| 63 | void sgQuads (swgfx*, size_t count, const sgQuad*); | 75 | void sgQuads (swgfx*, size_t count, const sgQuad*); |
