MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / DrawGroupDir

Method DrawGroupDir

engine/Poseidon/UI/InGame/InGameUIDraw.cpp:1609–1676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1607}
1608
1609void InGameUI::DrawGroupDir(const Camera& camera, AIGroup* grp)
1610{
1611 if (!grp)
1612 {
1613 return;
1614 }
1615
1616 float age = Glob.uiTime - _lastGroupDirTime;
1617 if (age >= groupDirDimEndTime)
1618 {
1619 return;
1620 }
1621
1622 float alpha = 1.0;
1623 if (age > groupDirDimStartTime)
1624 {
1625 alpha = (groupDirDimEndTime - age) / (groupDirDimEndTime - groupDirDimStartTime);
1626 }
1627
1628 PackedColor bgColorA = PackedColorRGB(bgColor, toIntFloor(bgColor.A8() * alpha));
1629 PackedColor ftColorA = PackedColorRGB(ftColor, toIntFloor(ftColor.A8() * alpha));
1630
1631 const int w = GLOB_ENGINE->Width2D();
1632 const int h = GLOB_ENGINE->Height2D();
1633
1634 Texture* corner = GLOB_SCENE->Preloaded(Corner);
1635 DrawFrame(corner, bgColorA, Rect2DPixel(gdX * w, gdY * h, gdW * w, gdH * h));
1636
1637 Matrix4Val camInvTransform = camera.GetInvTransform();
1638 Vector3 dir(VRotate, camInvTransform, grp->MainSubgroup()->GetFormationDirection());
1639 dir[0] = -dir[0];
1640
1641 Matrix4 mrot(MZero);
1642 Matrix4 mtrans1 = Matrix4(MTranslation, Vector3(-0.5, 0, -0.5));
1643 Matrix4 mtrans2 = Matrix4(MTranslation, Vector3(0.5, 0, 0.5));
1644
1645 Draw2DPars pars;
1646 pars.spec = NoZBuf | IsAlpha | IsAlphaFog | ClampU | ClampV;
1647
1648 const float size = 1.1;
1649
1650 Rect2DPixel rect(w * (gdX + gdW * 0.5 - gdW * size * 0.5), h * (gdY + gdH * 0.5 - gdH * size * 0.5), gdW * w * size,
1651 gdH * h * size);
1652
1653#define v000 VZero
1654#define v001 VForward
1655#define v100 VAside
1656#define v101 Vector3(1, 0, 1)
1657
1658 mrot.SetUpAndDirection(-VUp, -dir);
1659 Matrix4 m = mtrans2 * mrot * mtrans1;
1660 Vector3 uv = m.FastTransform(v000);
1661 pars.uTR = uv[2];
1662 pars.vTR = uv[0];
1663 uv = m.FastTransform(v001);
1664 pars.uTL = uv[2];
1665 pars.vTL = uv[0];
1666 uv = m.FastTransform(v100);

Callers

nothing calls this directly

Calls 15

DrawFrameFunction · 0.85
GetFormationDirectionMethod · 0.80
MainSubgroupMethod · 0.80
PackedColorRGBFunction · 0.50
Rect2DPixelClass · 0.50
Vector3Class · 0.50
A8Method · 0.45
Width2DMethod · 0.45
Height2DMethod · 0.45
PreloadedMethod · 0.45
GetInvTransformMethod · 0.45
SetUpAndDirectionMethod · 0.45

Tested by

no test coverage detected