| 1372 | } |
| 1373 | |
| 1374 | void GFX3D::RasterTriangle(int x1, int y1, float u1, float v1, float w1, olc::Pixel c1, |
| 1375 | int x2, int y2, float u2, float v2, float w2, olc::Pixel c2, |
| 1376 | int x3, int y3, float u3, float v3, float w3, olc::Pixel c3, |
| 1377 | olc::Sprite* spr, |
| 1378 | uint32_t nFlags) |
| 1379 | |
| 1380 | { |
| 1381 | if (y2 < y1) |
| 1382 | { |
| 1383 | std::swap(y1, y2); std::swap(x1, x2); std::swap(u1, u2); std::swap(v1, v2); std::swap(w1, w2); std::swap(c1, c2); |
| 1384 | } |
| 1385 | |
| 1386 | if (y3 < y1) |
| 1387 | { |
| 1388 | std::swap(y1, y3); std::swap(x1, x3); std::swap(u1, u3); std::swap(v1, v3); std::swap(w1, w3); std::swap(c1, c3); |
| 1389 | } |
| 1390 | |
| 1391 | if (y3 < y2) |
| 1392 | { |
| 1393 | std::swap(y2, y3); std::swap(x2, x3); std::swap(u2, u3); std::swap(v2, v3); std::swap(w2, w3); std::swap(c2, c3); |
| 1394 | } |
| 1395 | |
| 1396 | int dy1 = y2 - y1; |
| 1397 | int dx1 = x2 - x1; |
| 1398 | float dv1 = v2 - v1; |
| 1399 | float du1 = u2 - u1; |
| 1400 | float dw1 = w2 - w1; |
| 1401 | int dcr1 = c2.r - c1.r; |
| 1402 | int dcg1 = c2.g - c1.g; |
| 1403 | int dcb1 = c2.b - c1.b; |
| 1404 | int dca1 = c2.a - c1.a; |
| 1405 | |
| 1406 | int dy2 = y3 - y1; |
| 1407 | int dx2 = x3 - x1; |
| 1408 | float dv2 = v3 - v1; |
| 1409 | float du2 = u3 - u1; |
| 1410 | float dw2 = w3 - w1; |
| 1411 | int dcr2 = c3.r - c1.r; |
| 1412 | int dcg2 = c3.g - c1.g; |
| 1413 | int dcb2 = c3.b - c1.b; |
| 1414 | int dca2 = c3.a - c1.a; |
| 1415 | |
| 1416 | float tex_u, tex_v, tex_w; |
| 1417 | float col_r, col_g, col_b, col_a; |
| 1418 | |
| 1419 | float dax_step = 0, dbx_step = 0, |
| 1420 | du1_step = 0, dv1_step = 0, |
| 1421 | du2_step = 0, dv2_step = 0, |
| 1422 | dw1_step = 0, dw2_step = 0, |
| 1423 | dcr1_step = 0, dcr2_step = 0, |
| 1424 | dcg1_step = 0, dcg2_step = 0, |
| 1425 | dcb1_step = 0, dcb2_step = 0, |
| 1426 | dca1_step = 0, dca2_step = 0; |
| 1427 | |
| 1428 | if (dy1) dax_step = dx1 / (float)abs(dy1); |
| 1429 | if (dy2) dbx_step = dx2 / (float)abs(dy2); |
| 1430 | |
| 1431 | if (dy1) du1_step = du1 / (float)abs(dy1); |
nothing calls this directly
no test coverage detected