mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:37:17 +02:00
Merge pull request #6971 from samcake/hdr
Fixing the default value for the TOneMapping curve
This commit is contained in:
commit
02d530ccc8
4 changed files with 49 additions and 44 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include "render/DrawStatus.h"
|
#include "render/DrawStatus.h"
|
||||||
#include "AmbientOcclusionEffect.h"
|
#include "AmbientOcclusionEffect.h"
|
||||||
#include "AntialiasingEffect.h"
|
#include "AntialiasingEffect.h"
|
||||||
|
#include "ToneMappingEffect.h"
|
||||||
|
|
||||||
#include "RenderDeferredTask.h"
|
#include "RenderDeferredTask.h"
|
||||||
|
|
||||||
|
@ -67,20 +68,6 @@ void RenderDeferred::run(const SceneContextPointer& sceneContext, const RenderCo
|
||||||
DependencyManager::get<DeferredLightingEffect>()->render(renderContext);
|
DependencyManager::get<DeferredLightingEffect>()->render(renderContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToneMappingDeferred::configure(const Config& config) {
|
|
||||||
if (config.exposure >= 0.0f) {
|
|
||||||
_toneMappingEffect.setExposure(config.exposure);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.curve >= 0) {
|
|
||||||
_toneMappingEffect.setToneCurve((ToneMappingEffect::ToneCurve)config.curve);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ToneMappingDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
|
||||||
_toneMappingEffect.render(renderContext->args);
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) {
|
RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) {
|
||||||
cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&){ return true; };
|
cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&){ return true; };
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
#include "render/DrawTask.h"
|
#include "render/DrawTask.h"
|
||||||
|
|
||||||
#include "ToneMappingEffect.h"
|
|
||||||
|
|
||||||
class SetupDeferred {
|
class SetupDeferred {
|
||||||
public:
|
public:
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
|
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
|
||||||
|
@ -40,32 +38,6 @@ public:
|
||||||
using JobModel = render::Job::Model<RenderDeferred>;
|
using JobModel = render::Job::Model<RenderDeferred>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ToneMappingConfig : public render::Job::Config {
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY(bool enabled MEMBER enabled)
|
|
||||||
Q_PROPERTY(float exposure MEMBER exposure NOTIFY dirty);
|
|
||||||
Q_PROPERTY(int curve MEMBER curve NOTIFY dirty);
|
|
||||||
public:
|
|
||||||
ToneMappingConfig() : render::Job::Config(true) {}
|
|
||||||
|
|
||||||
float exposure{ 0.0f };
|
|
||||||
int curve{ 3 };
|
|
||||||
signals:
|
|
||||||
void dirty();
|
|
||||||
};
|
|
||||||
|
|
||||||
class ToneMappingDeferred {
|
|
||||||
public:
|
|
||||||
using Config = ToneMappingConfig;
|
|
||||||
using JobModel = render::Job::Model<ToneMappingDeferred, Config>;
|
|
||||||
|
|
||||||
void configure(const Config& config);
|
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
|
|
||||||
|
|
||||||
ToneMappingEffect _toneMappingEffect;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DrawConfig : public render::Job::Config {
|
class DrawConfig : public render::Job::Config {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int numDrawn READ getNumDrawn)
|
Q_PROPERTY(int numDrawn READ getNumDrawn)
|
||||||
|
|
|
@ -145,4 +145,19 @@ void ToneMappingEffect::render(RenderArgs* args) {
|
||||||
batch.setResourceTexture(ToneMappingEffect_LightingMapSlot, lightingBuffer);
|
batch.setResourceTexture(ToneMappingEffect_LightingMapSlot, lightingBuffer);
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ToneMappingDeferred::configure(const Config& config) {
|
||||||
|
if (config.exposure >= 0.0f) {
|
||||||
|
_toneMappingEffect.setExposure(config.exposure);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.curve >= 0) {
|
||||||
|
_toneMappingEffect.setToneCurve((ToneMappingEffect::ToneCurve)config.curve);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToneMappingDeferred::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext) {
|
||||||
|
_toneMappingEffect.render(renderContext->args);
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#include <gpu/Resource.h>
|
#include <gpu/Resource.h>
|
||||||
#include <gpu/Pipeline.h>
|
#include <gpu/Pipeline.h>
|
||||||
|
#include <render/DrawTask.h>
|
||||||
|
|
||||||
|
|
||||||
class RenderArgs;
|
class RenderArgs;
|
||||||
|
|
||||||
|
@ -50,7 +52,7 @@ private:
|
||||||
float _exposure = 0.0f;
|
float _exposure = 0.0f;
|
||||||
float _twoPowExposure = 1.0f;
|
float _twoPowExposure = 1.0f;
|
||||||
glm::vec2 spareA;
|
glm::vec2 spareA;
|
||||||
int _toneCurve = Filmic;
|
int _toneCurve = Gamma22;
|
||||||
glm::vec3 spareB;
|
glm::vec3 spareB;
|
||||||
|
|
||||||
Parameters() {}
|
Parameters() {}
|
||||||
|
@ -61,4 +63,33 @@ private:
|
||||||
void init();
|
void init();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ToneMappingConfig : public render::Job::Config {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(bool enabled MEMBER enabled)
|
||||||
|
Q_PROPERTY(float exposure MEMBER exposure WRITE setExposure);
|
||||||
|
Q_PROPERTY(int curve MEMBER curve WRITE setCurve);
|
||||||
|
public:
|
||||||
|
ToneMappingConfig() : render::Job::Config(true) {}
|
||||||
|
|
||||||
|
void setExposure(float newExposure) { exposure = std::max(0.0f, newExposure); emit dirty(); }
|
||||||
|
void setCurve(int newCurve) { curve = std::max((int)ToneMappingEffect::None, std::min((int)ToneMappingEffect::Filmic, newCurve)); emit dirty(); }
|
||||||
|
|
||||||
|
|
||||||
|
float exposure{ 0.0f };
|
||||||
|
int curve{ ToneMappingEffect::Gamma22 };
|
||||||
|
signals:
|
||||||
|
void dirty();
|
||||||
|
};
|
||||||
|
|
||||||
|
class ToneMappingDeferred {
|
||||||
|
public:
|
||||||
|
using Config = ToneMappingConfig;
|
||||||
|
using JobModel = render::Job::Model<ToneMappingDeferred, Config>;
|
||||||
|
|
||||||
|
void configure(const Config& config);
|
||||||
|
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
|
||||||
|
|
||||||
|
ToneMappingEffect _toneMappingEffect;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // hifi_ToneMappingEffect_h
|
#endif // hifi_ToneMappingEffect_h
|
||||||
|
|
Loading…
Reference in a new issue