mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 01:03:57 +02:00
Fix for shadow map rendering.
This commit is contained in:
parent
c3f6cab199
commit
698ecbf9c5
1 changed files with 2 additions and 2 deletions
|
@ -2266,14 +2266,14 @@ void Application::updateShadowMap() {
|
|||
|
||||
int halfSize = fbo->width() / 2;
|
||||
float frustumScale = 1.0f / (_viewFrustum.getFarClip() - _viewFrustum.getNearClip());
|
||||
loadViewFrustum(_myCamera, _viewFrustum);
|
||||
|
||||
for (int i = 0; i < SHADOW_MATRIX_COUNT; i++) {
|
||||
const glm::vec2& coord = MAP_COORDS[i];
|
||||
glViewport(coord.s * halfSize, coord.t * halfSize, halfSize, halfSize);
|
||||
glViewport(coord.s * fbo->width(), coord.t * fbo->height(), halfSize, halfSize);
|
||||
|
||||
float nearScale = MAP_DISTANCES[i] * frustumScale;
|
||||
float farScale = MAP_DISTANCES[i + 1] * frustumScale;
|
||||
loadViewFrustum(_myCamera, _viewFrustum);
|
||||
glm::vec3 points[] = {
|
||||
glm::mix(_viewFrustum.getNearTopLeft(), _viewFrustum.getFarTopLeft(), nearScale),
|
||||
glm::mix(_viewFrustum.getNearTopRight(), _viewFrustum.getFarTopRight(), nearScale),
|
||||
|
|
Loading…
Reference in a new issue