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

Function CascadeSplits

engine/Poseidon/Graphics/Shadow/ShadowMath.cpp:198–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198std::vector<float> CascadeSplits(float nearD, float farD, int n, float lambda)
199{
200 if (n < 1)
201 {
202 n = 1;
203 }
204 std::vector<float> r(static_cast<size_t>(n) + 1);
205 r[0] = nearD;
206 r[n] = farD;
207 for (int i = 1; i < n; i++)
208 {
209 float p = static_cast<float>(i) / static_cast<float>(n);
210 float logS = nearD * std::pow(farD / nearD, p);
211 float uniS = nearD + (farD - nearD) * p;
212 r[i] = lambda * logS + (1.0f - lambda) * uniS;
213 }
214 return r;
215}
216
217std::array<Vec3, 8> FrustumCornersWS(const Mat4& invViewProj)
218{

Callers 3

BuildShadowCascadesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected