MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / applyShadowViewpoint

Method applyShadowViewpoint

Source/Graphics/camera.cpp:195–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195void Camera::applyShadowViewpoint(vec3 direction, vec3 center, float scale, mat4* proj_matrix, mat4* view_matrix, float far_back) {
196 if (!proj_matrix) {
197 proj_matrix = &lightProjectionMatrix;
198 }
199 if (!view_matrix) {
200 view_matrix = &lightViewMatrix;
201 }
202 proj_matrix->SetOrtho(-scale * 0.5f,
203 scale * 0.5f,
204 -scale * 0.5f,
205 scale * 0.5f,
206 10.0f,
207 2000.0f);
208
209 facing = normalize(direction) * -1.0f;
210
211 view_matrix->SetLookAt(center + direction * far_back, center - direction, vec3(0.0f, 1.0f, 0.0f));
212
213 calcFrustumPlanes(*proj_matrix, *view_matrix);
214
215 interp_pos = mix(old_pos, pos, GetInterpWeight());
216}
217
218// Apply the camera viewpoint to the view matrix
219void Camera::applyViewpoint() {

Callers 3

UpdateShadowCacheFunction · 0.80
GetShadowableTrisFunction · 0.80
UpdateShadowCascadesFunction · 0.80

Calls 5

SetOrthoMethod · 0.80
SetLookAtMethod · 0.80
normalizeFunction · 0.70
mixFunction · 0.70
vec3Class · 0.50

Tested by

no test coverage detected