| 215 | } |
| 216 | |
| 217 | std::array<Vec3, 8> FrustumCornersWS(const Mat4& invViewProj) |
| 218 | { |
| 219 | static const float nx[4] = {-1.0f, 1.0f, 1.0f, -1.0f}; |
| 220 | static const float ny[4] = {-1.0f, -1.0f, 1.0f, 1.0f}; |
| 221 | std::array<Vec3, 8> out; |
| 222 | for (int i = 0; i < 4; i++) |
| 223 | { |
| 224 | out[i] = TransformPoint(invViewProj, {nx[i], ny[i], 0.0f}); // near plane: zero-to-one NDC z = 0 |
| 225 | } |
| 226 | for (int i = 0; i < 4; i++) |
| 227 | { |
| 228 | out[i + 4] = TransformPoint(invViewProj, {nx[i], ny[i], 1.0f}); |
| 229 | } |
| 230 | return out; |
| 231 | } |
| 232 | |
| 233 | std::array<Vec3, 8> SliceFrustum(const std::array<Vec3, 8>& corners, float t0, float t1) |
| 234 | { |
no test coverage detected