| 183 | } |
| 184 | |
| 185 | Mat4 Perspective(float fovYRadians, float aspect, float n, float f) |
| 186 | { |
| 187 | float ty = std::tan(fovYRadians * 0.5f); |
| 188 | Mat4 m; |
| 189 | m.at(0, 0) = 1.0f / (aspect * ty); |
| 190 | m.at(1, 1) = 1.0f / ty; |
| 191 | m.at(2, 2) = -f / (f - n); // zero-to-one depth (matches glClipControl ZERO_TO_ONE) |
| 192 | m.at(2, 3) = -(f * n) / (f - n); |
| 193 | m.at(3, 2) = -1.0f; |
| 194 | m.at(3, 3) = 0.0f; |
| 195 | return m; |
| 196 | } |
| 197 | |
| 198 | std::vector<float> CascadeSplits(float nearD, float farD, int n, float lambda) |
| 199 | { |