mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 20:49:08 +02:00
adding assert or checks whenever getting a scene stage
This commit is contained in:
parent
4edea433ce
commit
0c3755483b
9 changed files with 19 additions and 5 deletions
|
@ -555,10 +555,12 @@ void RenderableZoneEntityItemMeta::setProceduralUserData(QString userData) {
|
|||
void RenderableZoneEntityItemMeta::render(RenderArgs* args) {
|
||||
if (!_stage) {
|
||||
_stage = args->_scene->getStage<LightStage>();
|
||||
assert(_stage);
|
||||
}
|
||||
|
||||
if (!_backgroundStage) {
|
||||
_backgroundStage = args->_scene->getStage<BackgroundStage>();
|
||||
assert(_backgroundStage);
|
||||
}
|
||||
|
||||
{ // Sun
|
||||
|
|
|
@ -61,6 +61,8 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext,
|
|||
|
||||
// Background rendering decision
|
||||
auto backgroundStage = renderContext->_scene->getStage<BackgroundStage>();
|
||||
assert(backgroundStage);
|
||||
|
||||
model::SunSkyStagePointer background;
|
||||
model::SkyboxPointer skybox;
|
||||
if (backgroundStage->_currentFrame._backgrounds.size()) {
|
||||
|
|
|
@ -433,6 +433,7 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
|
|||
}
|
||||
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
assert(lightStage->getNumLights() > 0);
|
||||
auto lightAndShadow = lightStage->getLightAndShadow(0);
|
||||
const auto& globalShadow = lightAndShadow.second;
|
||||
|
|
|
@ -429,6 +429,7 @@ void PrepareDeferred::run(const RenderContextPointer& renderContext, const Input
|
|||
|
||||
// Prepare a fresh Light Frame
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
lightStage->_currentFrame.clear();
|
||||
}
|
||||
|
||||
|
@ -493,6 +494,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext,
|
|||
// Global directional light and ambient pass
|
||||
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
assert(lightStage->getNumLights() > 0);
|
||||
auto lightAndShadow = lightStage->getLightAndShadow(0);
|
||||
const auto& globalShadow = lightAndShadow.second;
|
||||
|
|
|
@ -575,6 +575,7 @@ void LightClusteringPass::run(const render::RenderContextPointer& renderContext,
|
|||
|
||||
// From the LightStage and the current frame, update the light cluster Grid
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
_lightClusters->updateLightStage(lightStage);
|
||||
_lightClusters->updateLightFrame(lightStage->_currentFrame, lightingModel->isPointLightEnabled(), lightingModel->isSpotLightEnabled());
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ LightPayload::~LightPayload() {
|
|||
void LightPayload::render(RenderArgs* args) {
|
||||
if (!_stage) {
|
||||
_stage = args->_scene->getStage<LightStage>();
|
||||
assert(_stage);
|
||||
}
|
||||
// Do we need to allocate the light in the stage ?
|
||||
if (LightStage::isIndexInvalid(_index)) {
|
||||
|
@ -124,6 +125,7 @@ KeyLightPayload::~KeyLightPayload() {
|
|||
void KeyLightPayload::render(RenderArgs* args) {
|
||||
if (!_stage) {
|
||||
_stage = args->_scene->getStage<LightStage>();
|
||||
assert(_stage);
|
||||
}
|
||||
// Do we need to allocate the light in the stage ?
|
||||
if (LightStage::isIndexInvalid(_index)) {
|
||||
|
|
|
@ -36,7 +36,7 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext,
|
|||
assert(renderContext->args->hasViewFrustum());
|
||||
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
|
||||
assert(lightStage);
|
||||
LightStage::Index globalLightIndex { 0 };
|
||||
|
||||
const auto globalLight = lightStage->getLight(globalLightIndex);
|
||||
|
@ -141,6 +141,7 @@ void RenderShadowTask::configure(const Config& configuration) {
|
|||
|
||||
void RenderShadowSetup::run(const render::RenderContextPointer& renderContext, Output& output) {
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
const auto globalShadow = lightStage->getShadow(0);
|
||||
|
||||
// Cache old render args
|
||||
|
|
|
@ -532,7 +532,8 @@ void DebugSubsurfaceScattering::run(const render::RenderContextPointer& renderCo
|
|||
|
||||
|
||||
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>("LIGHT_STAGE");
|
||||
auto lightStage = renderContext->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
// const auto light = DependencyManager::get<DeferredLightingEffect>()->getLightStage()->getLight(0);
|
||||
const auto light = lightStage->getLight(0);
|
||||
|
||||
|
|
|
@ -52,19 +52,21 @@ void ZoneRendererTask::build(JobModel& task, const Varying& input, Varying& oupu
|
|||
}
|
||||
|
||||
void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs) {
|
||||
auto backgroundStage = context->_scene->getStage<BackgroundStage>("BACKGROUND_STAGE");
|
||||
auto backgroundStage = context->_scene->getStage<BackgroundStage>();
|
||||
assert(backgroundStage);
|
||||
backgroundStage->_currentFrame.clear();
|
||||
|
||||
// call render in the correct order first...
|
||||
render::renderItems(context, inputs);
|
||||
|
||||
// Finally add the default lights and background:
|
||||
auto lightStage = context->_scene->getStage<LightStage>("LIGHT_STAGE");
|
||||
auto lightStage = context->_scene->getStage<LightStage>();
|
||||
assert(lightStage);
|
||||
|
||||
lightStage->_currentFrame.pushSunLight(0);
|
||||
lightStage->_currentFrame.pushAmbientLight(0);
|
||||
|
||||
backgroundStage->_currentFrame.pushBackground(0);
|
||||
|
||||
}
|
||||
|
||||
const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
||||
|
|
Loading…
Reference in a new issue