softgpu: Add something like rectangle support. Doesn't seem to work :/

This commit is contained in:
Tony Wasserka authored and neobrain committed 2013-08-16 23:48:56 +02:00
1 parent 2aff3a8575
commit 55d6646fc3
4 files changed
+35 -5

No files matched your search

+21 -4
View File
@@ -72,17 +72,26 @@ void TransformUnit::SubmitPrimitive(void* vertices, u32 prim_type, int vertex_co
vdecoder.SetVertexType(vertex_type);
const DecVtxFormat& vtxfmt = vdecoder.GetDecVtxFmt();
static u8 buf[102400]; // yolo
static u8 buf[1024000]; // yolo
vdecoder.DecodeVerts(buf, vertices, 0, vertex_count - 1);
VertexReader vreader(buf, vtxfmt, vertex_type);
int vtcs_per_prim = 0;
if (prim_type == GE_PRIM_POINTS) vtcs_per_prim = 1;
else if (prim_type == GE_PRIM_LINES) vtcs_per_prim = 2;
else if (prim_type == GE_PRIM_TRIANGLES) vtcs_per_prim = 3;
else if (prim_type == GE_PRIM_RECTANGLES) vtcs_per_prim = 2;
else {
// TODO: Unsupported
}
// We only support triangle lists, for now.
for (int vtx = 0; vtx < vertex_count; vtx+=3)
for (int vtx = 0; vtx < vertex_count; vtx += vtcs_per_prim)
{
VertexData data[3];
for (unsigned int i = 0; i < 3; ++i)
for (unsigned int i = 0; i < vtcs_per_prim; ++i)
{
float pos[3];
vreader.Goto(vtx+i);
@@ -102,6 +111,14 @@ void TransformUnit::SubmitPrimitive(void* vertices, u32 prim_type, int vertex_co
// TODO: Should do lighting here!
Clipper::ProcessTriangle(data);
switch (prim_type) {
case GE_PRIM_TRIANGLES:
Clipper::ProcessTriangle(data);
break;
case GE_PRIM_RECTANGLES:
Clipper::ProcessQuad(data);
break;
}
}
}