This commit is contained in:
Sam Gateau 2019-08-18 22:15:20 -07:00
parent 3ace52629c
commit aeb407698d
3 changed files with 20 additions and 7 deletions

View file

@ -187,12 +187,17 @@ void BloomDraw::run(const render::RenderContextPointer& renderContext, const Inp
}
}
void DebugBloomConfig::setMode(int mode) {
_mode = std::min((int)DebugBloomConfig::MODE_COUNT, std::max(0, mode));
emit dirty();
}
DebugBloom::DebugBloom() {
_params = std::make_shared<gpu::Buffer>(sizeof(glm::vec4), nullptr);
}
void DebugBloom::configure(const Config& config) {
_mode = static_cast<DebugBloomConfig::Mode>(config.mode);
_mode = (DebugBloomConfig::Mode) config.getMode();
assert(_mode < DebugBloomConfig::MODE_COUNT);
}
@ -201,6 +206,10 @@ void DebugBloom::run(const render::RenderContextPointer& renderContext, const In
assert(renderContext->args->hasViewFrustum());
RenderArgs* args = renderContext->args;
if (_mode == DebugBloomConfig::OFF) {
return;
}
const auto frameBuffer = inputs.get0();
const auto combinedBlurBuffer = inputs.get4();
const auto framebufferSize = frameBuffer->getSize();

View file

@ -87,12 +87,13 @@ private:
class DebugBloomConfig : public render::Job::Config {
Q_OBJECT
Q_PROPERTY(int mode MEMBER mode NOTIFY dirty)
Q_PROPERTY(int mode READ getMode WRITE setMode NOTIFY dirty)
public:
enum Mode {
MODE_LEVEL0 = 0,
OFF = 0,
MODE_LEVEL0,
MODE_LEVEL1,
MODE_LEVEL2,
MODE_ALL_LEVELS,
@ -102,7 +103,10 @@ public:
DebugBloomConfig() : render::Job::Config(false) {}
int mode{ MODE_ALL_LEVELS };
void setMode(int mode);
int getMode() const { return _mode; }
int _mode{ MODE_ALL_LEVELS };
signals:
void dirty();

View file

@ -19,15 +19,15 @@ Column {
property var config: Render.getConfig("RenderMainView.DebugBloom")
function setDebugMode(mode) {
console.log("Bloom mode is " + mode)
bloom.config.enabled = (mode != 0);
bloom.config.mode = mode;
}
Prop.PropEnum {
label: "Debug Bloom Buffer"
object: config
property: "mode"
// valueVar: 0
// object: config
// property: "mode"
enums: [
"Off",
"Lvl 0",