| 626 | } |
| 627 | |
| 628 | void InGameUI::DrawTankDirection(const Camera& camera) |
| 629 | { |
| 630 | if (_tankPos >= 1) |
| 631 | { |
| 632 | return; |
| 633 | } |
| 634 | AIUnit* unit = GWorld->FocusOn(); |
| 635 | PoseidonAssert(unit); |
| 636 | EntityAI* veh = unit->GetVehicle(); |
| 637 | |
| 638 | float tankLeft = tankX; |
| 639 | |
| 640 | const int w = GLOB_ENGINE->Width2D(); |
| 641 | const int h = GLOB_ENGINE->Height2D(); |
| 642 | |
| 643 | Matrix4Val camInvTransform = camera.GetInvTransform(); |
| 644 | Vector3 dirHull(VRotate, camInvTransform, veh->Direction()); |
| 645 | Vector3 dirTurret(VRotate, camInvTransform, veh->GetWeaponDirection(0)); |
| 646 | Vector3 dirObsTurret(VRotate, camInvTransform, veh->GetEyeDirection()); |
| 647 | |
| 648 | Matrix4 mrot(MZero); |
| 649 | Matrix4 mtrans1 = Matrix4(MTranslation, Vector3(-0.5, 0, -0.5)); |
| 650 | Matrix4 mtrans2 = Matrix4(MTranslation, Vector3(0.5, 0, 0.5)); |
| 651 | |
| 652 | Draw2DPars pars; |
| 653 | pars.spec = NoZBuf | IsAlpha | IsAlphaFog | ClampU | ClampV; |
| 654 | |
| 655 | // Rect2D rect(tankLeft * w, tankY * h, tankW * w, tankH * h); |
| 656 | |
| 657 | const float size = 0.67; |
| 658 | |
| 659 | Rect2DPixel rect(w * (tankLeft + tankW * 0.5 - tankW * size * 0.5), h * (tankY + tankH * 0.5 - tankH * size * 0.5), |
| 660 | tankW * w * size, tankH * h * size); |
| 661 | |
| 662 | #define v000 VZero |
| 663 | #define v001 VForward |
| 664 | #define v100 VAside |
| 665 | #define v101 Vector3(1, 0, 1) |
| 666 | |
| 667 | mrot.SetUpAndDirection(VUp, dirHull); |
| 668 | Matrix4 m = mtrans2 * mrot * mtrans1; |
| 669 | Vector3 uv = m.FastTransform(v000); |
| 670 | pars.uTR = uv[2]; |
| 671 | pars.vTR = uv[0]; |
| 672 | uv = m.FastTransform(v001); |
| 673 | pars.uTL = uv[2]; |
| 674 | pars.vTL = uv[0]; |
| 675 | uv = m.FastTransform(v100); |
| 676 | pars.uBR = uv[2]; |
| 677 | pars.vBR = uv[0]; |
| 678 | uv = m.FastTransform(v101); |
| 679 | pars.uBL = uv[2]; |
| 680 | pars.vBL = uv[0]; |
| 681 | |
| 682 | // draw all hull components |
| 683 | pars.SetColor(ColorFromHit(veh->GetHitForDisplay(0))); |
| 684 | pars.mip = GEngine->TextBank()->UseMipmap(_imageHull, 0, 0); |
| 685 | GEngine->Draw2D(pars, rect, rect); |
nothing calls this directly
no test coverage detected