mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 01:02:48 +01:00
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;
|
||||
|
||||
case Regs::TriangleTopology::Strip:
|
||||
case Regs::TriangleTopology::Fan:
|
||||
if (buffer_index == 2) {
|
||||
buffer_index = 0;
|
||||
if (strip_ready) {
|
||||
// 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);
|
||||
|
||||
buffer[1] = vtx;
|
||||
} else {
|
||||
buffer[buffer_index++] = vtx;
|
||||
if (topology == Regs::TriangleTopology::Strip) {
|
||||
strip_ready |= (buffer_index == 1);
|
||||
buffer_index = !buffer_index;
|
||||
} else if (topology == Regs::TriangleTopology::Fan) {
|
||||
buffer_index = 1;
|
||||
strip_ready = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR(Render_Software, "Unknown triangle topology %x:", (int)topology);
|
||||
LOG_ERROR(HW_GPU, "Unknown triangle topology %x:", (int)topology);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ private:
|
|||
|
||||
int buffer_index;
|
||||
VertexType buffer[2];
|
||||
bool strip_ready = false;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue