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

Function DrawRectangle

engine/Poseidon/Game/Editor.cpp:1663–1747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1661}
1662
1663static void DrawRectangle(float xs, float zs, float xe, float ze)
1664{
1665 PackedColor color(Color(0, 1, 0, 0.3));
1666
1667 Vector3 ss(xs, GLandscape->SurfaceYAboveWater(xs, zs) + 0.5, zs);
1668 Vector3 es(xe, GLandscape->SurfaceYAboveWater(xe, zs) + 0.5, zs);
1669 Vector3 se(xs, GLandscape->SurfaceYAboveWater(xs, ze) + 0.5, ze);
1670 Vector3 ee(xe, GLandscape->SurfaceYAboveWater(xe, ze) + 0.5, ze);
1671
1672 static Ref<ObjectColored> obj;
1673 if (!obj)
1674 {
1675 Ref<LODShapeWithShadow> lShape = new LODShapeWithShadow();
1676 Shape* shape = new Shape;
1677 lShape->AddShape(shape, 0);
1678
1679 // initalize lod level
1680 shape->ReallocTable(6);
1681 for (int i = 0; i < 6; i++)
1682 {
1683 shape->SetPos(i) = VZero;
1684 shape->SetClip(i, ClipAll);
1685 shape->SetNorm(i) = VUp;
1686 }
1687 shape->SetUV(0, 0, 0);
1688 shape->SetUV(1, 1, 0);
1689 shape->SetUV(2, 0, 1);
1690 shape->SetUV(3, 1, 0);
1691 shape->SetUV(4, 1, 1);
1692 shape->SetUV(5, 0, 1);
1693
1694 // precalculate hints for possible optimizations
1695 shape->CalculateHints();
1696 lShape->CalculateHints();
1697
1698 // change faces parameters
1699 Poly face;
1700 face.Init();
1701 face.SetN(3);
1702 face.SetSpecial(ClampU | ClampV);
1703 face.SetTexture(nullptr);
1704 face.Set(0, 0);
1705 face.Set(1, 1);
1706 face.Set(2, 2);
1707 shape->AddFace(face);
1708 face.Set(0, 3);
1709 face.Set(1, 4);
1710 face.Set(2, 5);
1711 shape->AddFace(face);
1712
1713 shape->OrSpecial(IsAlpha | IsAlphaFog | BestMipmap);
1714 lShape->OrSpecial(IsColored | IsOnSurface);
1715
1716 obj = new ObjectColored(lShape, -1);
1717 obj->SetOrientation(M3Identity);
1718 obj->SetConstantColor(color);
1719 }
1720

Callers 3

DrawSensorsMethod · 0.85
DrawExtMethod · 0.85
DrawMethod · 0.85

Calls 15

ColorClass · 0.85
SurfaceYAboveWaterMethod · 0.80
AddShapeMethod · 0.80
ReallocTableMethod · 0.80
SetNMethod · 0.80
LevelMethod · 0.80
SetAutoCenterMethod · 0.80
FindSectionsMethod · 0.80
SetPosMethod · 0.45
SetClipMethod · 0.45
SetUVMethod · 0.45
CalculateHintsMethod · 0.45

Tested by

no test coverage detected