8 #define CHANGED_VIEWPORT 0x01
9 #define CHANGED_MATRIX 0x02
10 #define CHANGED_COLORBUFFER 0x04
11 #define CHANGED_GEOMETRYMODE 0x08
12 #define CHANGED_TEXTURE 0x10
13 #define CHANGED_FOGPOSITION 0x20
14 #define CHANGED_TEXTURESCALE 0x40
16 //#ifdef __TRIBUFFER_OPT
17 // #define gSPFlushTriangles() \
20 // (OGL.triangles.num > 1000) || \
22 // (RSP.nextCmd != G_NOOP) && \
23 // (RSP.nextCmd != G_RDPNOOP) && \
24 // (RSP.nextCmd != G_MOVEMEM) && \
25 // (RSP.nextCmd != G_ENDDL) && \
26 // (RSP.nextCmd != G_DL) && \
27 // (RSP.nextCmd != G_VTXCOLORBASE) && \
28 // (RSP.nextCmd != G_TRI1) && \
29 // (RSP.nextCmd != G_TRI2) && \
30 // (RSP.nextCmd != G_TRI4) && \
31 // (RSP.nextCmd != G_QUAD) && \
32 // (RSP.nextCmd != G_VTX) && \
33 // (RSP.nextCmd != G_MTX) \
37 // OGL_DrawTriangles(); \
40 // #define gSPFlushTriangles() \
43 // (RSP.nextCmd != G_TRI1) && \
44 // (RSP.nextCmd != G_TRI2) && \
45 // (RSP.nextCmd != G_TRI4) && \
46 // (RSP.nextCmd != G_QUAD) \
49 // OGL_DrawTriangles(); \
52 #define gSPFlushTriangles() \
56 (config.tribufferOpt) && \
57 (OGL.triangles.num > 1000) || \
59 (RSP.nextCmd != G_NOOP) && \
60 (RSP.nextCmd != G_RDPNOOP) && \
61 (RSP.nextCmd != G_MOVEMEM) && \
62 (RSP.nextCmd != G_ENDDL) && \
63 (RSP.nextCmd != G_DL) && \
64 (RSP.nextCmd != G_VTXCOLORBASE) && \
65 (RSP.nextCmd != G_TRI1) && \
66 (RSP.nextCmd != G_TRI2) && \
67 (RSP.nextCmd != G_TRI4) && \
68 (RSP.nextCmd != G_QUAD) && \
69 (RSP.nextCmd != G_VTX) && \
70 (RSP.nextCmd != G_MTX) \
74 (RSP.nextCmd != G_TRI1) && \
75 (RSP.nextCmd != G_TRI2) && \
76 (RSP.nextCmd != G_TRI4) && \
77 (RSP.nextCmd != G_QUAD) \
81 OGL_DrawTriangles(); \
86 #define CLIP_NEGX 0x01
87 #define CLIP_POSX 0x02
90 #define CLIP_NEGY 0x04
91 #define CLIP_POSY 0x08
94 #define CLIP_NEGZ 0x10
95 #define CLIP_POSZ 0x20
100 f32 nx, ny, nz, __pad0;
109 typedef SPVertex SPTriangle[3];
123 u32 modelViewi, stackSize, billboard;
124 f32 modelView[32][4][4];
125 f32 projection[4][4];
133 f32 baseScaleX, baseScaleY;
147 gDPTile *textureTile[2];
153 f32 x, y, width, height;
159 s16 multiplier, offset;
164 u32 address, width, height, format, size, palette;
182 void gSPLoadUcodeEx( u32 uc_start, u32 uc_dstart, u16 uc_dsize );
184 void gSPMatrix( u32 matrix, u8 param );
185 void gSPDMAMatrix( u32 matrix, u8 index, u8 multiply );
186 void gSPViewport( u32 v );
187 void gSPForceMatrix( u32 mptr );
188 void gSPLight( u32 l, s32 n );
189 void gSPLookAt( u32 l );
190 void gSPVertex( u32 v, u32 n, u32 v0 );
191 void gSPCIVertex( u32 v, u32 n, u32 v0 );
192 void gSPDMAVertex( u32 v, u32 n, u32 v0 );
193 void gSPDisplayList( u32 dl );
194 void gSPDMADisplayList( u32 dl, u32 n );
195 void gSPBranchList( u32 dl );
196 void gSPBranchLessZ( u32 branchdl, u32 vtx, f32 zval );
197 void gSPSprite2DBase( u32 base );
198 void gSPDMATriangles( u32 tris, u32 n );
199 void gSP1Quadrangle( s32 v0, s32 v1, s32 v2, s32 v3 );
200 void gSPCullDisplayList( u32 v0, u32 vn );
201 void gSPPopMatrix( u32 param );
202 void gSPPopMatrixN( u32 param, u32 num );
203 void gSPSegment( s32 seg, s32 base );
204 void gSPClipRatio( u32 r );
205 void gSPInsertMatrix( u32 where, u32 num );
206 void gSPModifyVertex( u32 vtx, u32 where, u32 val );
207 void gSPNumLights( s32 n );
208 void gSPLightColor( u32 lightNum, u32 packedColor );
209 void gSPFogFactor( s16 fm, s16 fo );
210 void gSPPerspNormalize( u16 scale );
211 void gSPTexture( f32 sc, f32 tc, s32 level, s32 tile, s32 on );
212 void gSPEndDisplayList();
213 void gSPGeometryMode( u32 clear, u32 set );
214 void gSPSetGeometryMode( u32 mode );
215 void gSPClearGeometryMode( u32 mode );
216 void gSPLine3D( s32 v0, s32 v1, s32 flag );
217 void gSPLineW3D( s32 v0, s32 v1, s32 wd, s32 flag );
218 void gSPObjRectangle( u32 sp );
219 void gSPObjSprite( u32 sp );
220 void gSPObjLoadTxtr( u32 tx );
221 void gSPObjLoadTxSprite( u32 txsp );
222 void gSPObjLoadTxRectR( u32 txsp );
223 void gSPBgRect1Cyc( u32 bg );
224 void gSPBgRectCopy( u32 bg );
225 void gSPObjMatrix( u32 mtx );
226 void gSPObjSubMatrix( u32 mtx );
227 void gSPSetDMAOffsets( u32 mtxoffset, u32 vtxoffset );
228 void gSPSetVertexColorBase( u32 base );
229 void gSPProcessVertex(u32 v);
231 void gSPTriangleUnknown();
233 void gSP1Triangle(s32 v0, s32 v1, s32 v2);
234 void gSP2Triangles(const s32 v00, const s32 v01, const s32 v02, const s32 flag0,
235 const s32 v10, const s32 v11, const s32 v12, const s32 flag1 );
236 void gSP4Triangles(const s32 v00, const s32 v01, const s32 v02,
237 const s32 v10, const s32 v11, const s32 v12,
238 const s32 v20, const s32 v21, const s32 v22,
239 const s32 v30, const s32 v31, const s32 v32 );
242 //#ifdef __TRIBUFFER_OPT
243 void __indexmap_init();
244 void __indexmap_clear();
245 u32 __indexmap_findunused(u32 num);
246 u32 __indexmap_getnew(u32 index, u32 num);
250 extern void (*gSPTransformVertex4)(u32 v, float mtx[4][4]);
251 extern void (*gSPTransformNormal4)(u32 v, float mtx[4][4]);
252 extern void (*gSPLightVertex4)(u32 v);
253 extern void (*gSPBillboardVertex4)(u32 v);
255 extern void (*gSPTransformVertex)(float vtx[4], float mtx[4][4]);
256 extern void (*gSPLightVertex)(u32 v);
257 extern void (*gSPBillboardVertex)(u32 v, u32 i);