| 668 | } |
| 669 | |
| 670 | void GFX3D::TexturedTriangle(int x1, int y1, float u1, float v1, float w1, |
| 671 | int x2, int y2, float u2, float v2, float w2, |
| 672 | int x3, int y3, float u3, float v3, float w3, olc::Sprite* spr) |
| 673 | |
| 674 | { |
| 675 | if (y2 < y1) |
| 676 | { |
| 677 | std::swap(y1, y2); |
| 678 | std::swap(x1, x2); |
| 679 | std::swap(u1, u2); |
| 680 | std::swap(v1, v2); |
| 681 | std::swap(w1, w2); |
| 682 | } |
| 683 | |
| 684 | if (y3 < y1) |
| 685 | { |
| 686 | std::swap(y1, y3); |
| 687 | std::swap(x1, x3); |
| 688 | std::swap(u1, u3); |
| 689 | std::swap(v1, v3); |
| 690 | std::swap(w1, w3); |
| 691 | } |
| 692 | |
| 693 | if (y3 < y2) |
| 694 | { |
| 695 | std::swap(y2, y3); |
| 696 | std::swap(x2, x3); |
| 697 | std::swap(u2, u3); |
| 698 | std::swap(v2, v3); |
| 699 | std::swap(w2, w3); |
| 700 | } |
| 701 | |
| 702 | int dy1 = y2 - y1; |
| 703 | int dx1 = x2 - x1; |
| 704 | float dv1 = v2 - v1; |
| 705 | float du1 = u2 - u1; |
| 706 | float dw1 = w2 - w1; |
| 707 | |
| 708 | int dy2 = y3 - y1; |
| 709 | int dx2 = x3 - x1; |
| 710 | float dv2 = v3 - v1; |
| 711 | float du2 = u3 - u1; |
| 712 | float dw2 = w3 - w1; |
| 713 | |
| 714 | float tex_u, tex_v, tex_w; |
| 715 | |
| 716 | float dax_step = 0, dbx_step = 0, |
| 717 | du1_step = 0, dv1_step = 0, |
| 718 | du2_step = 0, dv2_step = 0, |
| 719 | dw1_step = 0, dw2_step = 0; |
| 720 | |
| 721 | if (dy1) dax_step = dx1 / (float)abs(dy1); |
| 722 | if (dy2) dbx_step = dx2 / (float)abs(dy2); |
| 723 | |
| 724 | if (dy1) du1_step = du1 / (float)abs(dy1); |
| 725 | if (dy1) dv1_step = dv1 / (float)abs(dy1); |
| 726 | if (dy1) dw1_step = dw1 / (float)abs(dy1); |
| 727 |
nothing calls this directly
no test coverage detected