1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Fix triangle index calculation for flat shading.

This commit is contained in:
Sergey Lipskiy 2017-07-28 10:50:02 +07:00
parent 24b041b86e
commit 6bfe0adf0a

View File

@ -66,7 +66,7 @@ void GraphicsDrawer::addTriangle(int _v0, int _v1, int _v2)
}
else if ((gSP.geometryMode & G_SHADING_SMOOTH) == 0) {
// Flat shading
SPVertex & vtx0 = triangles.vertices[triangles.elements[firstIndex + ((RSP.w1 >> 24) & 3)]];
SPVertex & vtx0 = triangles.vertices[triangles.elements[firstIndex + (((RSP.w1 >> 24) & 3) % 3)]];
for (u32 i = firstIndex; i < triangles.num; ++i) {
SPVertex & vtx = triangles.vertices[triangles.elements[i]];
vtx.r = vtx.flat_r = vtx0.r;