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 | 34 | void RenderShadowMap::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, |
| 35 | 35 | const render::ShapeBounds& inShapes) { |
| 36 | 36 | assert(renderContext->args); |
| 37 | − assert(renderContext->args->_viewFrustum); | |
| 37 | + assert(renderContext->args->hasViewFrustum()); | |
| 38 | 38 | |
| 39 | 39 | const auto& lightStage = DependencyManager::get<DeferredLightingEffect>()->getLightStage(); |
| 40 | 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 | 148 | // Cache old render args |
| 149 | − const ViewFrustum* viewFrustum = args->_viewFrustum; | |
| 150 | 149 | RenderArgs::RenderMode mode = args->_renderMode; |
| 151 | 150 | |
| 152 | − auto nearClip = viewFrustum->getNearClip(); | |
| 151 | + auto nearClip = args->getViewFrustum().getNearClip(); | |
| 153 | 152 | float nearDepth = -args->_boomOffset.z; |
| 154 | 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 | 156 | // Set the keylight render args |
| 158 | − args->_viewFrustum = globalLight->shadow.getFrustum().get(); | |
| 157 | + args->pushViewFrustum(*(globalLight->shadow.getFrustum())); | |
| 159 | 158 | args->_renderMode = RenderArgs::SHADOW_RENDER_MODE; |
| 160 | 159 | |
| 161 | 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 | 166 | // Reset the render args |
| 168 | − args->_viewFrustum = viewFrustum; | |
| 167 | + args->popViewFrustum(); | |
| 169 | 168 | args->_renderMode = mode; |
| 170 | 169 | }; |