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

Function FrustumCornersWS

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

Source from the content-addressed store, hash-verified

215}
216
217std::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
233std::array<Vec3, 8> SliceFrustum(const std::array<Vec3, 8>& corners, float t0, float t1)
234{

Callers 2

ComputeCascadeLightVPFunction · 0.85

Calls 1

TransformPointFunction · 0.85

Tested by

no test coverage detected