also unravelling some spaghetti: (1) split Octree stuff out of ViewFrustum (2) moved ViewFrustum from octree to shared lib (3) removed some cruft
Showing the changes to libraries/render-utils/src/RenderShadowTask.cpp (1 of 46 files). Show all
Unified · Split
| @@ -34,7 +34,7 @@ using namespace render; · 33 unmodified lines | |||
| 34 | void RenderShadowMap::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, | 34 | void RenderShadowMap::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, |
| 35 | const render::ShapeBounds& inShapes) { | 35 | const render::ShapeBounds& inShapes) { |
| 36 | assert(renderContext->args); | 36 | assert(renderContext->args); |
| 37 | assert(renderContext->args->_viewFrustum); | 37 | assert(renderContext->args->hasViewFrustum()); |
| 38 | 38 | ||
| 39 | const auto& lightStage = DependencyManager::get<DeferredLightingEffect>()->getLightStage(); | 39 | const auto& lightStage = DependencyManager::get<DeferredLightingEffect>()->getLightStage(); |
| 40 | const auto globalLight = lightStage.lights[0]; | 40 | const auto globalLight = lightStage.lights[0]; |
| @@ -146,16 +146,15 @@ void RenderShadowTask::run(const SceneContextPointer& sceneContext, const render · 105 unmodified lines | |||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | // Cache old render args | 148 | // Cache old render args |
| 149 | const ViewFrustum* viewFrustum = args->_viewFrustum; | ||
| 150 | RenderArgs::RenderMode mode = args->_renderMode; | 149 | RenderArgs::RenderMode mode = args->_renderMode; |
| 151 | 150 | ||
| 152 | auto nearClip = viewFrustum->getNearClip(); | 151 | auto nearClip = args->getViewFrustum().getNearClip(); |
| 153 | float nearDepth = -args->_boomOffset.z; | 152 | float nearDepth = -args->_boomOffset.z; |
| 154 | const int SHADOW_FAR_DEPTH = 20; | 153 | const int SHADOW_FAR_DEPTH = 20; |
| 155 | globalLight->shadow.setKeylightFrustum(viewFrustum, nearDepth, nearClip + SHADOW_FAR_DEPTH); | 154 | globalLight->shadow.setKeylightFrustum(args->getViewFrustum(), nearDepth, nearClip + SHADOW_FAR_DEPTH); |
| 156 | 155 | ||
| 157 | // Set the keylight render args | 156 | // Set the keylight render args |
| 158 | args->_viewFrustum = globalLight->shadow.getFrustum().get(); | 157 | args->pushViewFrustum(*(globalLight->shadow.getFrustum())); |
| 159 | args->_renderMode = RenderArgs::SHADOW_RENDER_MODE; | 158 | args->_renderMode = RenderArgs::SHADOW_RENDER_MODE; |
| 160 | 159 | ||
| 161 | // TODO: Allow runtime manipulation of culling ShouldRenderFunctor | 160 | // TODO: Allow runtime manipulation of culling ShouldRenderFunctor |
| @@ -165,6 +164,6 @@ void RenderShadowTask::run(const SceneContextPointer& sceneContext, const render · 3 unmodified lines | |||
| 165 | } | 164 | } |
| 166 | 165 | ||
| 167 | // Reset the render args | 166 | // Reset the render args |
| 168 | args->_viewFrustum = viewFrustum; | 167 | args->popViewFrustum(); |
| 169 | args->_renderMode = mode; | 168 | args->_renderMode = mode; |
| 170 | }; | 169 | }; |