evolve the Transform stack away from the legacy GL to the brand new shader way
Showing the changes to interface/src/Application.cpp (1 of 64 files). Show all
Unified · Split
| @@ -2547,7 +2547,9 @@ void Application::updateShadowMap() { · 2546 unmodified lines | |||
| 2547 | glm::ortho(minima.x, maxima.x, minima.y, maxima.y, -maxima.z, -minima.z) * glm::mat4_cast(inverseRotation)); | 2547 | glm::ortho(minima.x, maxima.x, minima.y, maxima.y, -maxima.z, -minima.z) * glm::mat4_cast(inverseRotation)); |
| 2548 | 2548 | ||
| 2549 | // update the shadow view frustum | 2549 | // update the shadow view frustum |
| 2550 | _shadowViewFrustum.setPosition(rotation * ((minima + maxima) * 0.5f)); | 2550 | // glm::vec3 shadowFrustumCenter = glm::vec3((minima.x + maxima.x) * 0.5f, (minima.y + maxima.y) * 0.5f, (minima.z + maxima.z) * 0.5f); |
| 2551 | glm::vec3 shadowFrustumCenter = rotation * ((minima + maxima) * 0.5f); | ||
| 2552 | _shadowViewFrustum.setPosition(shadowFrustumCenter); | ||
| 2551 | _shadowViewFrustum.setOrientation(rotation); | 2553 | _shadowViewFrustum.setOrientation(rotation); |
| 2552 | _shadowViewFrustum.setOrthographic(true); | 2554 | _shadowViewFrustum.setOrthographic(true); |
| 2553 | _shadowViewFrustum.setWidth(maxima.x - minima.x); | 2555 | _shadowViewFrustum.setWidth(maxima.x - minima.x); |
| @@ -2577,8 +2579,10 @@ void Application::updateShadowMap() { · 23 unmodified lines | |||
| 2577 | // this is what is used for rendering the Entities and avatars | 2579 | // this is what is used for rendering the Entities and avatars |
| 2578 | Transform viewTransform; | 2580 | Transform viewTransform; |
| 2579 | viewTransform.setRotation(rotation); | 2581 | viewTransform.setRotation(rotation); |
| 2582 | // viewTransform.postTranslate(shadowFrustumCenter); | ||
| 2580 | setViewTransform(viewTransform); | 2583 | setViewTransform(viewTransform); |
| 2581 | 2584 | ||
| 2585 | |||
| 2582 | glEnable(GL_POLYGON_OFFSET_FILL); | 2586 | glEnable(GL_POLYGON_OFFSET_FILL); |
| 2583 | glPolygonOffset(1.1f, 4.0f); // magic numbers courtesy http://www.eecs.berkeley.edu/~ravir/6160/papers/shadowmaps.ppt | 2587 | glPolygonOffset(1.1f, 4.0f); // magic numbers courtesy http://www.eecs.berkeley.edu/~ravir/6160/papers/shadowmaps.ppt |
| 2584 | 2588 | ||