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

Function Perspective

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

Source from the content-addressed store, hash-verified

183}
184
185Mat4 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
198std::vector<float> CascadeSplits(float nearD, float farD, int n, float lambda)
199{

Callers 2

CameraInvVPFunction · 0.85

Calls 1

atMethod · 0.80

Tested by 1

CameraInvVPFunction · 0.68