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

Method ShadowPos

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

Source from the content-addressed store, hash-verified

2037 // be from cache itself plus any holdouts on the entity side).
2038 Shapes.ForEach([](LODShapeWithShadow& shape)
2039 { Log("Shape %s not released (%d refs).", shape.Name(), shape.RefCounter()); });
2040 Shapes.Clear();
2041
2042 MagazineTypes.Clear();
2043 WeaponTypes.Clear();
2044}
2045
2046bool Scene::ShadowPos(Vector3Par pos, Vector3& aprox, LightSun* light)
2047{ //
2048 Vector3Val dir = light->ShadowDirection();
2049 if (dir.Y() > 0)
2050 {
2051 return false; // shadow casted up - no real shadow
2052 }
2053 const float maxShadow = 300;
2054 float t = GetLandscape()->IntersectWithGround(&aprox, pos, dir, 0, maxShadow * 1.1);
2055 if (t > maxShadow)
2056 {
2057 // no intersection
2058 return false;
2059 }
2060 if (t <= 0.01f)
2061 {
2062 // up -> on surface required

Callers 1

RecalcShadowMethod · 0.80

Calls 4

ShadowDirectionMethod · 0.80
IntersectWithGroundMethod · 0.80
SurfaceYMethod · 0.80
YMethod · 0.45

Tested by

no test coverage detected