1 #ifndef _GSP_STATE_H
2 #define _GSP_STATE_H
3 
4 #include <stdint.h>
5 
6 #include <boolean.h>
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 struct SPVertex
13 {
14 	float x, y, z, w;
15 	float nx, ny, nz, __pad0;
16 	float r, g, b, a;
17 	float flat_r, flat_g, flat_b, flat_a;
18 	float s, t;
19 	uint8_t HWLight;
20 	int16_t flag;
21 	uint32_t clip;
22 };
23 
24 struct SPLight
25 {
26 	float r, g, b;
27 	float x, y, z;
28 	float posx, posy, posz, posw;
29 	float ca, la, qa;
30 };
31 
32 struct gSPInfo
33 {
34 	uint32_t segment[16];
35 
36 	struct
37 	{
38 		uint32_t modelViewi, stackSize, billboard;
39 		float modelView[32][4][4];
40 		float projection[4][4];
41 		float combined[4][4];
42 	} matrix;
43 
44 	struct
45 	{
46 		float A, B, C, D;
47 		float X, Y;
48 		float baseScaleX, baseScaleY;
49 	} objMatrix;
50 
51 	uint32_t objRendermode;
52 
53 	uint32_t vertexColorBase;
54 	uint32_t vertexi;
55 
56 	struct SPLight lights[12];
57 	struct SPLight lookat[2];
58 	bool lookatEnable;
59 
60 	struct
61 	{
62 		float scales, scalet;
63       uint16_t org_scales, org_scalet;
64 		int32_t level, on, tile;
65 	} texture;
66 
67 	struct gDPTile *textureTile[2];
68 
69 	struct
70 	{
71 		float vscale[4];
72 		float vtrans[4];
73 		float x, y, width, height;
74 		float nearz, farz;
75 	} viewport;
76 
77 	struct
78 	{
79 		int16_t multiplier, offset;
80 	} fog;
81 
82 	struct
83 	{
84 		uint32_t address, width, height, format, size, palette;
85 		float imageX, imageY, scaleW, scaleH;
86 	} bgImage;
87 
88 	uint32_t geometryMode;
89 	int32_t numLights;
90 
91 	uint32_t changed;
92 
93 	uint32_t status[4];
94 
95 	struct
96 	{
97 		uint32_t vtx, mtx, tex_offset, tex_shift, tex_count;
98 	} DMAOffsets;
99 
100 	/* CBFD */
101 	uint32_t vertexNormalBase;
102 	float vertexCoordMod[16];
103 };
104 
105 extern struct gSPInfo gSP;
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif
112