Try triangles
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c
index 8be1179..b590388 100644
--- a/src/render/ps2/SDL_render_ps2.c
+++ b/src/render/ps2/SDL_render_ps2.c
@@ -343,6 +343,65 @@ PS2_RenderClear(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
}
static int
+PS2_RenderGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
+{
+ PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
+
+ const size_t count = cmd->data.draw.count;
+ if (cmd->data.draw.texture == NULL) {
+ const color_vertex *verts = (color_vertex *) (cmd->data.draw.first);
+
+ for (int i = 0; i < count; i += 3) {
+ float x1 = verts[i+0].x;
+ float y1 = verts[i+0].y;
+
+ float x2 = verts[i+1].x;
+ float y2 = verts[i+1].y;
+
+ float x3 = verts[i+2].x;
+ float y3 = verts[i+2].y;
+
+ Uint32 c1 = verts[i+0].color;
+ Uint32 c2 = verts[i+1].color;
+ Uint32 c3 = verts[i+2].color;
+
+ //It still need some works to make texture render on-screen
+ gsKit_prim_triangle_gouraud(data->gsGlobal, x1, y1, x2, y2, x3, y3, 1, c1, c2, c3);
+
+ verts++;
+ verts++;
+ verts++;
+ }
+ } else {
+ const texture_vertex *verts = (texture_vertex *) (cmd->data.draw.first);
+
+ for (int i = 0; i < count; i += 3) {
+ float x1 = verts[i+0].x;
+ float y1 = verts[i+0].y;
+
+ float x2 = verts[i+1].x;
+ float y2 = verts[i+1].y;
+
+ float x3 = verts[i+2].x;
+ float y3 = verts[i+2].y;
+
+ Uint32 c1 = verts[i+0].color;
+ Uint32 c2 = verts[i+1].color;
+ Uint32 c3 = verts[i+2].color;
+
+ //It still need some works to make texture render on-screen
+ gsKit_prim_triangle_gouraud(data->gsGlobal, x1, y1, x2, y2, x3, y3, 1, c1, c2, c3);
+
+ verts++;
+ verts++;
+ verts++;
+ }
+ }
+
+ return 0;
+}
+
+static int
PS2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
{
while (cmd) {
@@ -363,6 +422,10 @@ PS2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
case SDL_RENDERCMD_COPY_EX: /* unused */
break;
+ case SDL_RENDERCMD_GEOMETRY: {
+ PS2_RenderGeometry(renderer, cmd);
+ break;
+ }
default:
break;