mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-13 01:37:56 -05:00
SwRasterizer: implement custom clip plane
This commit is contained in:
@ -127,8 +127,7 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu
|
||||
|
||||
// Simple implementation of the Sutherland-Hodgman clipping algorithm.
|
||||
// TODO: Make this less inefficient (currently lots of useless buffering overhead happens here)
|
||||
for (auto edge : clipping_edges) {
|
||||
|
||||
auto Clip = [&](const ClippingEdge& edge) {
|
||||
std::swap(input_list, output_list);
|
||||
output_list->clear();
|
||||
|
||||
@ -147,12 +146,24 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu
|
||||
}
|
||||
reference_vertex = &vertex;
|
||||
}
|
||||
};
|
||||
|
||||
for (auto edge : clipping_edges) {
|
||||
Clip(edge);
|
||||
|
||||
// Need to have at least a full triangle to continue...
|
||||
if (output_list->size() < 3)
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_state.regs.rasterizer.clip_enable) {
|
||||
ClippingEdge custom_edge{-g_state.regs.rasterizer.GetClipCoef()};
|
||||
Clip(custom_edge);
|
||||
|
||||
if (output_list->size() < 3)
|
||||
return;
|
||||
}
|
||||
|
||||
InitScreenCoordinates((*output_list)[0]);
|
||||
InitScreenCoordinates((*output_list)[1]);
|
||||
|
||||
|
Reference in New Issue
Block a user