mirror of
https://github.com/overte-org/overte.git
synced 2025-05-28 02:50:25 +02:00
Haze enable/disable from UI works.
This commit is contained in:
parent
86c497a12f
commit
48e5b9d1bc
7 changed files with 23 additions and 29 deletions
|
@ -141,9 +141,6 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
|||
if (_needBackgroundUpdate) {
|
||||
if (BackgroundStage::isIndexInvalid(_backgroundIndex)) {
|
||||
_backgroundIndex = _backgroundStage->addBackground(_background);
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
_needBackgroundUpdate = false;
|
||||
}
|
||||
|
@ -153,9 +150,6 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
|||
if (_needHazeUpdate) {
|
||||
if (HazeStage::isIndexInvalid(_hazeIndex)) {
|
||||
_hazeIndex = _hazeStage->addHaze(_haze);
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
_needHazeUpdate = false;
|
||||
}
|
||||
|
@ -173,12 +167,12 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
|||
|
||||
// The background only if the mode is not inherit
|
||||
if (_backgroundMode != BACKGROUND_MODE_INHERIT) {
|
||||
_backgroundStage->_currentBackgroundFrame.pushBackground(_backgroundIndex);
|
||||
_backgroundStage->_currentFrame.pushBackground(_backgroundIndex);
|
||||
}
|
||||
|
||||
// The haze only if the mode is not inherit
|
||||
if (_hazeMode != HAZE_MODE_INHERIT) {
|
||||
_hazeStage->_currentHazeFrame.pushHaze(_hazeIndex);
|
||||
_hazeStage->_currentFrame.pushHaze(_hazeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,8 +65,8 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext,
|
|||
|
||||
model::SunSkyStagePointer background;
|
||||
model::SkyboxPointer skybox;
|
||||
if (backgroundStage->_currentBackgroundFrame._backgrounds.size()) {
|
||||
auto backgroundId = backgroundStage->_currentBackgroundFrame._backgrounds.front();
|
||||
if (backgroundStage->_currentFrame._backgrounds.size()) {
|
||||
auto backgroundId = backgroundStage->_currentFrame._backgrounds.front();
|
||||
auto background = backgroundStage->getBackground(backgroundId);
|
||||
if (background) {
|
||||
skybox = background->getSkybox();
|
||||
|
|
|
@ -55,9 +55,9 @@ public:
|
|||
Backgrounds _backgrounds;
|
||||
BackgroundMap _backgroundMap;
|
||||
|
||||
class BackgroundFrame {
|
||||
class Frame {
|
||||
public:
|
||||
BackgroundFrame() {}
|
||||
Frame() {}
|
||||
|
||||
void clear() { _backgrounds.clear(); }
|
||||
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
BackgroundStage::BackgroundIndices _backgrounds;
|
||||
};
|
||||
|
||||
BackgroundFrame _currentBackgroundFrame;
|
||||
Frame _currentFrame;
|
||||
};
|
||||
using BackgroundStagePointer = std::shared_ptr<BackgroundStage>;
|
||||
|
||||
|
|
|
@ -177,8 +177,8 @@ void DrawHaze::run(const render::RenderContextPointer& renderContext, const Inpu
|
|||
batch.setPipeline(_hazePipeline);
|
||||
|
||||
auto hazeStage = args->_scene->getStage<HazeStage>();
|
||||
if (hazeStage && hazeStage->_currentHazeFrame._hazes.size() > 0) {
|
||||
model::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentHazeFrame._hazes.front());
|
||||
if (hazeStage && hazeStage->_currentFrame._hazes.size() > 0) {
|
||||
model::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front());
|
||||
batch.setUniformBuffer(HazeEffect_ParamsSlot, hazePointer->getHazeParametersBuffer());
|
||||
}
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ void FetchHazeStage::run(const render::RenderContextPointer& renderContext, mode
|
|||
assert(hazeStage);
|
||||
|
||||
haze = nullptr;
|
||||
if (hazeStage->_currentHazeFrame._hazes.size() != 0) {
|
||||
auto hazeId = hazeStage->_currentHazeFrame._hazes.front();
|
||||
if (hazeStage->_currentFrame._hazes.size() != 0) {
|
||||
auto hazeId = hazeStage->_currentFrame._hazes.front();
|
||||
haze = hazeStage->getHaze(hazeId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,9 +55,9 @@ public:
|
|||
Hazes _hazes;
|
||||
HazeMap _hazeMap;
|
||||
|
||||
class HazeFrame {
|
||||
class Frame {
|
||||
public:
|
||||
HazeFrame() {}
|
||||
Frame() {}
|
||||
|
||||
void clear() { _hazes.clear(); }
|
||||
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
HazeStage::HazeIndices _hazes;
|
||||
};
|
||||
|
||||
HazeFrame _currentHazeFrame;
|
||||
Frame _currentFrame;
|
||||
};
|
||||
using HazeStagePointer = std::shared_ptr<HazeStage>;
|
||||
|
||||
|
|
|
@ -54,7 +54,12 @@ 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>();
|
||||
assert(backgroundStage);
|
||||
backgroundStage->_currentBackgroundFrame.clear();
|
||||
backgroundStage->_currentFrame.clear();
|
||||
|
||||
// Haze
|
||||
auto hazeStage = context->_scene->getStage<HazeStage>();
|
||||
assert(hazeStage);
|
||||
hazeStage->_currentFrame.clear();
|
||||
|
||||
// call render in the correct order first...
|
||||
render::renderItems(context, inputs);
|
||||
|
@ -66,12 +71,7 @@ void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs)
|
|||
lightStage->_currentFrame.pushSunLight(0);
|
||||
lightStage->_currentFrame.pushAmbientLight(0);
|
||||
|
||||
backgroundStage->_currentBackgroundFrame.pushBackground(0);
|
||||
|
||||
// Haze
|
||||
auto hazeStage = context->_scene->getStage<HazeStage>();
|
||||
assert(hazeStage);
|
||||
hazeStage->_currentHazeFrame.clear();
|
||||
backgroundStage->_currentFrame.pushBackground(0);
|
||||
}
|
||||
|
||||
const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
||||
|
@ -160,8 +160,8 @@ void DebugZoneLighting::run(const render::RenderContextPointer& context, const I
|
|||
|
||||
auto backgroundStage = context->_scene->getStage<BackgroundStage>(BackgroundStage::getName());
|
||||
std::vector<model::SkyboxPointer> skyboxStack;
|
||||
if (backgroundStage && backgroundStage->_currentBackgroundFrame._backgrounds.size()) {
|
||||
for (auto index : backgroundStage->_currentBackgroundFrame._backgrounds) {
|
||||
if (backgroundStage && backgroundStage->_currentFrame._backgrounds.size()) {
|
||||
for (auto index : backgroundStage->_currentFrame._backgrounds) {
|
||||
auto background = backgroundStage->getBackground(index);
|
||||
if (background) {
|
||||
skyboxStack.push_back(background->getSkybox());
|
||||
|
|
Loading…
Reference in a new issue