mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 02:07:17 +02:00
First draft
This commit is contained in:
parent
cf0dd6f8c3
commit
bcec3680b6
3 changed files with 88 additions and 0 deletions
36
libraries/render-utils/src/BloomEffect.cpp
Normal file
36
libraries/render-utils/src/BloomEffect.cpp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
//
|
||||||
|
// BloomEffect.cpp
|
||||||
|
// render-utils/src/
|
||||||
|
//
|
||||||
|
// Created by Olivier Prat on 09/25/17.
|
||||||
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#include "BloomEffect.h"
|
||||||
|
|
||||||
|
#include <render/BlurTask.h>
|
||||||
|
|
||||||
|
void BloomConfig::setMix(float value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void BloomConfig::setSize(float value) {
|
||||||
|
auto blurConfig = getConfig<render::BlurGaussian>("Blur");
|
||||||
|
assert(blurConfig);
|
||||||
|
blurConfig->setProperty("filterScale", value*10.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bloom::Bloom() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bloom::configure(const Config& config) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bloom::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs) {
|
||||||
|
const auto& blurInput = inputs;
|
||||||
|
task.addJob<render::BlurGaussian>("Blur", blurInput);
|
||||||
|
}
|
47
libraries/render-utils/src/BloomEffect.h
Normal file
47
libraries/render-utils/src/BloomEffect.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
//
|
||||||
|
// BloomEffect.h
|
||||||
|
// render-utils/src/
|
||||||
|
//
|
||||||
|
// Created by Olivier Prat on 09/25/17.
|
||||||
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_render_utils_BloomEffect_h
|
||||||
|
#define hifi_render_utils_BloomEffect_h
|
||||||
|
|
||||||
|
#include <render/Engine.h>
|
||||||
|
|
||||||
|
class BloomConfig : public render::Task::Config {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(float mix MEMBER mix WRITE setMix NOTIFY dirty)
|
||||||
|
Q_PROPERTY(float size MEMBER size WRITE setSize NOTIFY dirty)
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
float mix{ 0.2f };
|
||||||
|
float size{ 0.1f };
|
||||||
|
|
||||||
|
void setMix(float value);
|
||||||
|
void setSize(float value);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dirty();
|
||||||
|
};
|
||||||
|
|
||||||
|
class Bloom {
|
||||||
|
public:
|
||||||
|
using Inputs = gpu::FramebufferPointer;
|
||||||
|
using Config = BloomConfig;
|
||||||
|
using JobModel = render::Task::ModelI<Bloom, Inputs, Config>;
|
||||||
|
|
||||||
|
Bloom();
|
||||||
|
|
||||||
|
void configure(const Config& config);
|
||||||
|
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_render_utils_BloomEffect_h
|
|
@ -41,6 +41,7 @@
|
||||||
#include "ToneMappingEffect.h"
|
#include "ToneMappingEffect.h"
|
||||||
#include "SubsurfaceScattering.h"
|
#include "SubsurfaceScattering.h"
|
||||||
#include "OutlineEffect.h"
|
#include "OutlineEffect.h"
|
||||||
|
#include "BloomEffect.h"
|
||||||
|
|
||||||
#include <gpu/StandardShaderLib.h>
|
#include <gpu/StandardShaderLib.h>
|
||||||
|
|
||||||
|
@ -168,6 +169,10 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
|
|
||||||
const auto toneAndPostRangeTimer = task.addJob<BeginGPURangeTimer>("BeginToneAndPostRangeTimer", "PostToneOverlaysAntialiasing");
|
const auto toneAndPostRangeTimer = task.addJob<BeginGPURangeTimer>("BeginToneAndPostRangeTimer", "PostToneOverlaysAntialiasing");
|
||||||
|
|
||||||
|
// Add bloom
|
||||||
|
const auto bloomInputs = lightingFramebuffer;
|
||||||
|
task.addJob<Bloom>("Bloom", bloomInputs);
|
||||||
|
|
||||||
// Lighting Buffer ready for tone mapping
|
// Lighting Buffer ready for tone mapping
|
||||||
const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying();
|
const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying();
|
||||||
task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);
|
task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);
|
||||||
|
|
Loading…
Reference in a new issue