| 193 | } |
| 194 | |
| 195 | void 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 |
| 219 | void Camera::applyViewpoint() { |
no test coverage detected