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

Method FindSqrtLevel

engine/Poseidon/Graphics/Rendering/Shape/ShapeLOD.cpp:1592–1619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1590}
1591
1592int LODShape::FindSqrtLevel(float resolution2, bool noDecal) const
1593{
1594 // find first suitable LOD level
1595 PoseidonAssert(_nLods >= 1);
1596 // only normal LOD searched
1597 int i = 1;
1598 for (; i < _nLods; i++)
1599 {
1600 float aRes = _resolutions[i];
1601 if (aRes * aRes > resolution2)
1602 {
1603 break; // this one is too rough
1604 }
1605 if (aRes >= 900)
1606 {
1607 break; // memory LOD
1608 }
1609 }
1610 i--;
1611 if (noDecal)
1612 {
1613 while (i > 0 && _lods[i - 1] && (_lods[i]->GetAndHints() & ClipDecalMask) != ClipDecalNone)
1614 {
1615 i--;
1616 }
1617 }
1618 return i;
1619}
1620
1621int LODShape::FindNearestWithoutProperty(int i, const char* property) const
1622{

Callers 2

LevelFromDistance2Method · 0.80

Calls 1

GetAndHintsMethod · 0.45

Tested by

no test coverage detected