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

Function FindLevelWithComplexity

engine/Poseidon/World/Scene/SceneDraw.cpp:988–1007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

986 return -1;
987 return CmpShapeObj(p1, p0);
988}
989
990static inline int Complexity(LODShape* lShape, int level)
991{
992 return lShape->Level(level)->NFaces();
993}
994
995static int FindLevelWithComplexity(LODShape* lShape, float complexity, float maxDif)
996{
997 PoseidonAssert(complexity >= 0);
998 int bestI = -1;
999 float bestDif = maxDif;
1000 for (int i = 0; i < lShape->NLevels(); i++)
1001 {
1002 float resol = lShape->Resolution(i);
1003 if (resol > 900)
1004 break;
1005 int lComplex = Complexity(lShape, i);
1006 float dif = fabs(complexity - lComplex);
1007 if (bestDif > dif)
1008 {
1009 bestDif = dif;
1010 bestI = i;

Callers 2

AdjustComplexityMethod · 0.85

Calls 4

ComplexityFunction · 0.85
fabsFunction · 0.85
NLevelsMethod · 0.80
ResolutionMethod · 0.80

Tested by

no test coverage detected