summaryrefslogtreecommitdiff
path: root/include/swgfx.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/swgfx.h')
-rw-r--r--include/swgfx.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/swgfx.h b/include/swgfx.h
index b6dc769..94eb359 100644
--- a/include/swgfx.h
+++ b/include/swgfx.h
@@ -1,7 +1,7 @@
1/* 1/*
2Software rendering library. 2Software rendering library.
3 3
4Cooridnate systems: 4Coordinate systems:
5- Pixel coordinates (i,j) refer to the center of the pixel. 5- Pixel coordinates (i,j) refer to the center of the pixel.
6 Thus, real-valued coordinates (x,y) with no fractional part point at the pixel center. 6 Thus, real-valued coordinates (x,y) with no fractional part point at the pixel center.
7- Viewport origin is the top-left corner of the screen. 7- Viewport origin is the top-left corner of the screen.
@@ -30,6 +30,10 @@ typedef struct sgQuad { sgVec2 p0, p1; } sgQuad;
30typedef struct sgTri2 { sgVec2 p0, p1, p2; } sgTri2; 30typedef struct sgTri2 { sgVec2 p0, p1, p2; } sgTri2;
31typedef struct sgTri3 { sgVec3 p0, p1, p2; } sgTri3; 31typedef struct sgTri3 { sgVec3 p0, p1, p2; } sgTri3;
32 32
33typedef uint16_t sgIdx;
34typedef struct sgVert { sgIdx position, normal, texcoord; } sgVert;
35typedef struct sgTriIdx { sgVert v0, v1, v2; } sgTriIdx;
36
33// TODO: Should we use real-valued colours? 37// TODO: Should we use real-valued colours?
34typedef struct sgPixel { uint8_t r, g, b, a; } sgPixel; 38typedef struct sgPixel { uint8_t r, g, b, a; } sgPixel;
35 39
@@ -43,7 +47,9 @@ void sgDel(swgfx**);
43void sgColourBuffer(swgfx*, sgVec2i dimensions, sgPixel* buffer); 47void sgColourBuffer(swgfx*, sgVec2i dimensions, sgPixel* buffer);
44void sgPresent (swgfx*, sgVec2i dimensions, sgPixel* screen); 48void sgPresent (swgfx*, sgVec2i dimensions, sgPixel* screen);
45 49
46void sgCam (swgfx*, sgVec3 position, sgVec3 forward); 50void sgModelId (swgfx*);
51void sgModel (swgfx*, sgVec3 position, sgVec3 right, sgVec3 up, sgVec3 forward);
52void sgView (swgfx*, sgVec3 position, sgVec3 forward);
47void sgOrtho (swgfx*, R left, R right, R top, R bottom, R near, R far); 53void sgOrtho (swgfx*, R left, R right, R top, R bottom, R near, R far);
48void sgPerspective(swgfx*, R fovy, R aspect, R near, R far); 54void sgPerspective(swgfx*, R fovy, R aspect, R near, R far);
49void sgViewport (swgfx*, int x0, int y0, int width, int height); 55void sgViewport (swgfx*, int x0, int y0, int width, int height);
@@ -56,6 +62,8 @@ void sgTriangles2 (swgfx*, size_t count, const sgTri2*);
56void sgTriangleStrip2(swgfx*, size_t count, const sgVec2*); 62void sgTriangleStrip2(swgfx*, size_t count, const sgVec2*);
57void sgTriangles (swgfx*, size_t count, const sgTri3*, const sgNormal*); 63void sgTriangles (swgfx*, size_t count, const sgTri3*, const sgNormal*);
58void sgTriangleStrip (swgfx*, size_t count, const sgVec3*, const sgNormal*); 64void sgTriangleStrip (swgfx*, size_t count, const sgVec3*, const sgNormal*);
65void sgTrianglesIndexed(swgfx*, size_t numIndices, const sgIdx* indices, const sgVec3* positions);
66void sgTrianglesIndexedNonUniform(swgfx*, size_t numTris, const sgTriIdx* tris, const sgVec3* positions);
59 67
60void sgCheck(swgfx*); 68void sgCheck(swgfx*);
61 69