1 #ifndef GS_H
2 #define GS_H
3 
4 #include <3ds.h>
5 #include "math.h"
6 
7 #define GS_MATRIXSTACK_SIZE (8)
8 
9 typedef enum
10 {
11 	GS_PROJECTION = 0,
12 	GS_MODELVIEW = 1,
13 	GS_MATRIXTYPES
14 }GS_MATRIX;
15 
16 typedef struct
17 {
18 	u8* data;
19 	u32 currentSize; // in bytes
20 	u32 maxSize; // in bytes
21 	u32 numVertices;
22 	u32* commands;
23 	u32 commandsSize;
24 }gsVbo_s;
25 
26 
27 void gsInit(shaderProgram_s* shader);
28 void gsExit(void);
29 
30 void gsStartFrame(void);
31 void gsAdjustBufferMatrices(mtx44 transformation);
32 
33 void* gsLinearAlloc(size_t size);
34 void gsLinearFree(void* mem);
35 
36 float* gsGetMatrix(GS_MATRIX m);
37 int gsLoadMatrix(GS_MATRIX m, float* data);
38 int gsPushMatrix();
39 int gsPopMatrix();
40 int gsMatrixMode(GS_MATRIX m);
41 
42 void gsLoadIdentity();
43 void gsProjectionMatrix(float fovy, float aspect, float near, float far);
44 void gsRotateX(float x);
45 void gsRotateY(float y);
46 void gsRotateZ(float z);
47 void gsScale(float x, float y, float z);
48 void gsTranslate(float x, float y, float z);
49 int gsMultMatrix(float* data);
50 
51 int gsVboInit(gsVbo_s* vbo);
52 int gsVboCreate(gsVbo_s* vbo, u32 size);
53 int gsVboFlushData(gsVbo_s* vbo);
54 int gsVboDestroy(gsVbo_s* vbo);
55 int gsVboDraw(gsVbo_s* vbo);
56 void* gsVboGetOffset(gsVbo_s* vbo);
57 int gsVboAddData(gsVbo_s* vbo, void* data, u32 size, u32 units);
58 
59 #endif
60