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

Method LevelShadowFromDistance2

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

Source from the content-addressed store, hash-verified

420 }
421
422 float resol2 = detail2 * Square(scale);
423 // disable decal LODs
424 int level = shape->FindSqrtLevel(resol2, true);
425
426 return level;
427}
428
429int Scene::LevelShadowFromDistance2(LODShape* shape, float distance2, float oScale, Vector3Par direction,
430 Vector3Par viewDirection)
431{
432 distance2 *= 8;
433
434 float scale = GetCamera()->Left();
435 float diameter = shape->BoundingSphere() * 2 * oScale;
436
437 float pixelLimit = 0.25;
438 float detail2 = distance2 * Square(_lodInvWidth);
439
440 if (Square(diameter) < Square(pixelLimit * scale) * detail2)
441 {
442 return LOD_INVISIBLE;
443 }
444
445 if (shape->NLevels() < 2)
446 {
447 return 0;
448 }
449 float limit = ENGINE_CONFIG.shadowLODLimit;
450 saturateMax(detail2, Square(diameter * limit));
451 float resol2 = detail2 * Square(scale);
452 // disable decal LODs

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected