Pica/PrimitiveAssembly: Implement triangle strips.
This commit is contained in:
parent
346012f29e
commit
cd322e328e
2 changed files with 16 additions and 8 deletions
|
@ -30,20 +30,27 @@ void PrimitiveAssembler<VertexType>::SubmitVertex(VertexType& vtx, TriangleHandl
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Regs::TriangleTopology::Strip:
|
||||||
case Regs::TriangleTopology::Fan:
|
case Regs::TriangleTopology::Fan:
|
||||||
if (buffer_index == 2) {
|
if (strip_ready) {
|
||||||
buffer_index = 0;
|
// TODO: Should be "buffer[0], buffer[1], vtx" instead!
|
||||||
|
// Not quite sure why we need this order for things to show up properly.
|
||||||
|
// Maybe a bug in the rasterizer?
|
||||||
|
triangle_handler(buffer[1], buffer[0], vtx);
|
||||||
|
}
|
||||||
|
buffer[buffer_index] = vtx;
|
||||||
|
|
||||||
triangle_handler(buffer[0], buffer[1], vtx);
|
if (topology == Regs::TriangleTopology::Strip) {
|
||||||
|
strip_ready |= (buffer_index == 1);
|
||||||
buffer[1] = vtx;
|
buffer_index = !buffer_index;
|
||||||
} else {
|
} else if (topology == Regs::TriangleTopology::Fan) {
|
||||||
buffer[buffer_index++] = vtx;
|
buffer_index = 1;
|
||||||
|
strip_ready = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Render_Software, "Unknown triangle topology %x:", (int)topology);
|
LOG_ERROR(HW_GPU, "Unknown triangle topology %x:", (int)topology);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ private:
|
||||||
|
|
||||||
int buffer_index;
|
int buffer_index;
|
||||||
VertexType buffer[2];
|
VertexType buffer[2];
|
||||||
|
bool strip_ready = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue