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

Method LevelFromDistance2

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

Source from the content-addressed store, hash-verified

387
388 // clear working list
389 _drawMergers.Resize(0);
390 // keep drawObjects for next frame
391
392 DrawFlares();
393 _aLights.Resize(0);
394}
395
396int Scene::LevelFromDistance2(LODShape* shape, float distance2, float oScale, Vector3Par direction,
397 Vector3Par viewDirection)
398{
399 // if pixel size is lower than 2, object can be considered invisible
400 // size in pixels is
401 float scale = GetCamera()->Left();
402 float diameter = shape->BoundingSphere() * 2 * oScale;
403
404 if (distance2 > Square(ENGINE_CONFIG.objectsZ))
405 {
406 return LOD_INVISIBLE;
407 }
408
409 float pixelLimit = 0.125;
410 float detail2 = distance2 * Square(_lodInvWidth);
411
412 if (Square(diameter) < Square(pixelLimit * scale) * detail2)
413 {
414 return LOD_INVISIBLE;
415 }
416
417 if (shape->NLevels() < 2)
418 {
419 return 0;
420 }
421
422 float resol2 = detail2 * Square(scale);
423 // disable decal LODs

Callers 10

DrawProxiesMethod · 0.80
GetProxyComplexityMethod · 0.80
DrawProxiesMethod · 0.80
DrawCrewMemberMethod · 0.80
DrawProxiesMethod · 0.80
GetProxyComplexityMethod · 0.80
DrawProxiesMethod · 0.80
DrawProxiesMethod · 0.80
DrawProxiesMethod · 0.80

Calls 5

LeftMethod · 0.80
NLevelsMethod · 0.80
FindSqrtLevelMethod · 0.80
SquareFunction · 0.50
BoundingSphereMethod · 0.45

Tested by

no test coverage detected