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

Method Init

engine/Poseidon/World/Detection/Detector.cpp:1552–1580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1550}
1551
1552void Flag::Init(Matrix4Par pos)
1553{
1554 Shape* shape = _shape->Level(0);
1555 int selIndex = _fabric.GetSelection(0);
1556 if (selIndex >= 0)
1557 {
1558 const NamedSelection& sel = shape->NamedSel(selIndex);
1559
1560 shape->SaveOriginalPos();
1561 float minX = +1e10, minY = +1e10;
1562 float maxX = -1e10, maxY = -1e10;
1563 for (int i = 0; i < sel.Size(); i++)
1564 {
1565 int index = sel[i];
1566 Vector3Val val = shape->OrigPos(index);
1567 saturateMin(minX, val.X());
1568 saturateMin(minY, val.Y());
1569 saturateMax(maxX, val.X());
1570 saturateMax(maxY, val.Y());
1571 }
1572
1573 float xSize = maxX - minX;
1574 float ySize = maxY - minY;
1575
1576 _cloth = new ClothObject();
1577 const ParamEntry& entry = Pars >> "CfgCloth" >> "flag";
1578 _cloth->Init(entry, pos, minX, minY, xSize, ySize);
1579 }
1580}
1581
1582Flag::~Flag()
1583{

Callers 2

DetectorMethod · 0.45
FlagMethod · 0.45

Calls 9

saturateMinFunction · 0.85
saturateMaxFunction · 0.85
LevelMethod · 0.80
SaveOriginalPosMethod · 0.80
OrigPosMethod · 0.80
GetSelectionMethod · 0.45
SizeMethod · 0.45
XMethod · 0.45
YMethod · 0.45

Tested by

no test coverage detected