mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 22:36:39 +02:00
For testing.
This commit is contained in:
parent
93a2776cb5
commit
1cf7f5a732
7 changed files with 38 additions and 28 deletions
|
@ -149,14 +149,16 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_needHazeUpdate) {
|
{
|
||||||
if (HazeStage::isIndexInvalid(_hazeIndex)) {
|
if (_needHazeUpdate) {
|
||||||
_hazeIndex = _hazeStage->addHaze(_haze);
|
if (HazeStage::isIndexInvalid(_hazeIndex)) {
|
||||||
}
|
_hazeIndex = _hazeStage->addHaze(_haze);
|
||||||
else {
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
}
|
||||||
|
_needHazeUpdate = false;
|
||||||
}
|
}
|
||||||
_needHazeUpdate = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_visible) {
|
if (_visible) {
|
||||||
|
@ -171,12 +173,12 @@ void ZoneEntityRenderer::doRender(RenderArgs* args) {
|
||||||
|
|
||||||
// The background only if the mode is not inherit
|
// The background only if the mode is not inherit
|
||||||
if (_backgroundMode != BACKGROUND_MODE_INHERIT) {
|
if (_backgroundMode != BACKGROUND_MODE_INHERIT) {
|
||||||
_backgroundStage->_currentFrame.pushBackground(_backgroundIndex);
|
_backgroundStage->_currentBackgroundFrame.pushBackground(_backgroundIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The haze only if the mode is not inherit
|
// The haze only if the mode is not inherit
|
||||||
if (_hazeMode != HAZE_MODE_INHERIT) {
|
if (_hazeMode != HAZE_MODE_INHERIT) {
|
||||||
_hazeStage->_currentFrame.pushHaze(_hazeIndex);
|
_hazeStage->_currentHazeFrame.pushHaze(_hazeIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -466,6 +468,7 @@ void ZoneEntityRenderer::updateSkyboxMap() {
|
||||||
void ZoneEntityRenderer::setBackgroundMode(BackgroundMode mode) {
|
void ZoneEntityRenderer::setBackgroundMode(BackgroundMode mode) {
|
||||||
_backgroundMode = mode;
|
_backgroundMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneEntityRenderer::setHazeMode(HazeMode mode) {
|
void ZoneEntityRenderer::setHazeMode(HazeMode mode) {
|
||||||
_hazeMode = mode;
|
_hazeMode = mode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,8 +65,8 @@ void DrawBackgroundStage::run(const render::RenderContextPointer& renderContext,
|
||||||
|
|
||||||
model::SunSkyStagePointer background;
|
model::SunSkyStagePointer background;
|
||||||
model::SkyboxPointer skybox;
|
model::SkyboxPointer skybox;
|
||||||
if (backgroundStage->_currentFrame._backgrounds.size()) {
|
if (backgroundStage->_currentBackgroundFrame._backgrounds.size()) {
|
||||||
auto backgroundId = backgroundStage->_currentFrame._backgrounds.front();
|
auto backgroundId = backgroundStage->_currentBackgroundFrame._backgrounds.front();
|
||||||
auto background = backgroundStage->getBackground(backgroundId);
|
auto background = backgroundStage->getBackground(backgroundId);
|
||||||
if (background) {
|
if (background) {
|
||||||
skybox = background->getSkybox();
|
skybox = background->getSkybox();
|
||||||
|
|
|
@ -55,9 +55,9 @@ public:
|
||||||
Backgrounds _backgrounds;
|
Backgrounds _backgrounds;
|
||||||
BackgroundMap _backgroundMap;
|
BackgroundMap _backgroundMap;
|
||||||
|
|
||||||
class Frame {
|
class BackgroundFrame {
|
||||||
public:
|
public:
|
||||||
Frame() {}
|
BackgroundFrame() {}
|
||||||
|
|
||||||
void clear() { _backgrounds.clear(); }
|
void clear() { _backgrounds.clear(); }
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public:
|
||||||
BackgroundStage::BackgroundIndices _backgrounds;
|
BackgroundStage::BackgroundIndices _backgrounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
Frame _currentFrame;
|
BackgroundFrame _currentBackgroundFrame;
|
||||||
};
|
};
|
||||||
using BackgroundStagePointer = std::shared_ptr<BackgroundStage>;
|
using BackgroundStagePointer = std::shared_ptr<BackgroundStage>;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "StencilMaskPass.h"
|
#include "StencilMaskPass.h"
|
||||||
#include "FramebufferCache.h"
|
#include "FramebufferCache.h"
|
||||||
|
#include "HazeStage.h"
|
||||||
|
|
||||||
#include "Haze_frag.h"
|
#include "Haze_frag.h"
|
||||||
|
|
||||||
|
@ -140,6 +141,8 @@ void DrawHaze::run(const render::RenderContextPointer& renderContext, const Inpu
|
||||||
|
|
||||||
auto depthBuffer = framebuffer->getLinearDepthTexture();
|
auto depthBuffer = framebuffer->getLinearDepthTexture();
|
||||||
|
|
||||||
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
if (_hazePipeline == nullptr) {
|
if (_hazePipeline == nullptr) {
|
||||||
gpu::ShaderPointer ps = gpu::Shader::createPixel(std::string(Haze_frag));
|
gpu::ShaderPointer ps = gpu::Shader::createPixel(std::string(Haze_frag));
|
||||||
gpu::ShaderPointer vs = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS();
|
gpu::ShaderPointer vs = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS();
|
||||||
|
@ -162,19 +165,23 @@ void DrawHaze::run(const render::RenderContextPointer& renderContext, const Inpu
|
||||||
|
|
||||||
auto sourceFramebufferSize = glm::ivec2(inputBuffer->getDimensions());
|
auto sourceFramebufferSize = glm::ivec2(inputBuffer->getDimensions());
|
||||||
|
|
||||||
gpu::doInBatch(renderContext->args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||||
batch.enableStereo(false);
|
batch.enableStereo(false);
|
||||||
batch.setFramebuffer(outputBuffer);
|
batch.setFramebuffer(outputBuffer);
|
||||||
|
|
||||||
batch.setViewportTransform(renderContext->args->_viewport);
|
batch.setViewportTransform(args->_viewport);
|
||||||
batch.setProjectionTransform(glm::mat4());
|
batch.setProjectionTransform(glm::mat4());
|
||||||
batch.resetViewTransform();
|
batch.resetViewTransform();
|
||||||
batch.setModelTransform(
|
batch.setModelTransform(gpu::Framebuffer::evalSubregionTexcoordTransform(sourceFramebufferSize, args->_viewport));
|
||||||
gpu::Framebuffer::evalSubregionTexcoordTransform(sourceFramebufferSize, renderContext->args->_viewport));
|
|
||||||
|
|
||||||
batch.setPipeline(_hazePipeline);
|
batch.setPipeline(_hazePipeline);
|
||||||
|
|
||||||
batch.setUniformBuffer(HazeEffect_ParamsSlot, haze->getHazeParametersBuffer());
|
auto hazeStage = args->_scene->getStage<HazeStage>();
|
||||||
|
if (hazeStage && hazeStage->_currentHazeFrame._hazes.size() > 0) {
|
||||||
|
model::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentHazeFrame._hazes.front());
|
||||||
|
batch.setUniformBuffer(HazeEffect_ParamsSlot, hazePointer->getHazeParametersBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
batch.setUniformBuffer(HazeEffect_TransformBufferSlot, transformBuffer->getFrameTransformBuffer());
|
batch.setUniformBuffer(HazeEffect_TransformBufferSlot, transformBuffer->getFrameTransformBuffer());
|
||||||
|
|
||||||
batch.setResourceTexture(HazeEffect_LightingMapSlot, inputBuffer);
|
batch.setResourceTexture(HazeEffect_LightingMapSlot, inputBuffer);
|
||||||
|
|
|
@ -90,8 +90,8 @@ void FetchHazeStage::run(const render::RenderContextPointer& renderContext, mode
|
||||||
assert(hazeStage);
|
assert(hazeStage);
|
||||||
|
|
||||||
haze = nullptr;
|
haze = nullptr;
|
||||||
if (hazeStage->_currentFrame._hazes.size() != 0) {
|
if (hazeStage->_currentHazeFrame._hazes.size() != 0) {
|
||||||
auto hazeId = hazeStage->_currentFrame._hazes.front();
|
auto hazeId = hazeStage->_currentHazeFrame._hazes.front();
|
||||||
haze = hazeStage->getHaze(hazeId);
|
haze = hazeStage->getHaze(hazeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,9 @@ public:
|
||||||
Hazes _hazes;
|
Hazes _hazes;
|
||||||
HazeMap _hazeMap;
|
HazeMap _hazeMap;
|
||||||
|
|
||||||
class Frame {
|
class HazeFrame {
|
||||||
public:
|
public:
|
||||||
Frame() {}
|
HazeFrame() {}
|
||||||
|
|
||||||
void clear() { _hazes.clear(); }
|
void clear() { _hazes.clear(); }
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public:
|
||||||
HazeStage::HazeIndices _hazes;
|
HazeStage::HazeIndices _hazes;
|
||||||
};
|
};
|
||||||
|
|
||||||
Frame _currentFrame;
|
HazeFrame _currentHazeFrame;
|
||||||
};
|
};
|
||||||
using HazeStagePointer = std::shared_ptr<HazeStage>;
|
using HazeStagePointer = std::shared_ptr<HazeStage>;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ void ZoneRendererTask::build(JobModel& task, const Varying& input, Varying& oupu
|
||||||
void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs) {
|
void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs) {
|
||||||
auto backgroundStage = context->_scene->getStage<BackgroundStage>();
|
auto backgroundStage = context->_scene->getStage<BackgroundStage>();
|
||||||
assert(backgroundStage);
|
assert(backgroundStage);
|
||||||
backgroundStage->_currentFrame.clear();
|
backgroundStage->_currentBackgroundFrame.clear();
|
||||||
|
|
||||||
// call render in the correct order first...
|
// call render in the correct order first...
|
||||||
render::renderItems(context, inputs);
|
render::renderItems(context, inputs);
|
||||||
|
@ -66,12 +66,12 @@ void SetupZones::run(const RenderContextPointer& context, const Inputs& inputs)
|
||||||
lightStage->_currentFrame.pushSunLight(0);
|
lightStage->_currentFrame.pushSunLight(0);
|
||||||
lightStage->_currentFrame.pushAmbientLight(0);
|
lightStage->_currentFrame.pushAmbientLight(0);
|
||||||
|
|
||||||
backgroundStage->_currentFrame.pushBackground(0);
|
backgroundStage->_currentBackgroundFrame.pushBackground(0);
|
||||||
|
|
||||||
// Haze
|
// Haze
|
||||||
auto hazeStage = context->_scene->getStage<HazeStage>();
|
auto hazeStage = context->_scene->getStage<HazeStage>();
|
||||||
assert(hazeStage);
|
assert(hazeStage);
|
||||||
hazeStage->_currentFrame.clear();
|
hazeStage->_currentHazeFrame.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
|
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());
|
auto backgroundStage = context->_scene->getStage<BackgroundStage>(BackgroundStage::getName());
|
||||||
std::vector<model::SkyboxPointer> skyboxStack;
|
std::vector<model::SkyboxPointer> skyboxStack;
|
||||||
if (backgroundStage && backgroundStage->_currentFrame._backgrounds.size()) {
|
if (backgroundStage && backgroundStage->_currentBackgroundFrame._backgrounds.size()) {
|
||||||
for (auto index : backgroundStage->_currentFrame._backgrounds) {
|
for (auto index : backgroundStage->_currentBackgroundFrame._backgrounds) {
|
||||||
auto background = backgroundStage->getBackground(index);
|
auto background = backgroundStage->getBackground(index);
|
||||||
if (background) {
|
if (background) {
|
||||||
skyboxStack.push_back(background->getSkybox());
|
skyboxStack.push_back(background->getSkybox());
|
||||||
|
|
Loading…
Reference in a new issue