| 196 | } |
| 197 | |
| 198 | std::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 | |
| 217 | std::array<Vec3, 8> FrustumCornersWS(const Mat4& invViewProj) |
| 218 | { |
no outgoing calls
no test coverage detected