mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
Attempt to add qml configuration
This commit is contained in:
parent
bdd469cec4
commit
97756146b1
3 changed files with 113 additions and 3 deletions
|
@ -15,6 +15,31 @@
|
|||
|
||||
std::string HazeStage::_stageName { "HAZE_STAGE"};
|
||||
|
||||
FetchHazeStage::FetchHazeStage() {
|
||||
_haze = std::make_shared<model::Haze>();
|
||||
}
|
||||
|
||||
void FetchHazeStage::configure(const Config& config) {
|
||||
_haze->setHazeColor(glm::vec3(config.hazeColorR, config.hazeColorG, config.hazeColorB));
|
||||
_haze->setDirectionalLightBlend(model::convertDirectionalLightAngleToPower(config.hazeDirectionalLightAngle_degs));
|
||||
|
||||
_haze->setDirectionalLightColor(glm::vec3(config.hazeDirectionalLightColorR, config.hazeDirectionalLightColorG, config.hazeDirectionalLightColorB));
|
||||
_haze->setHazeBaseReference(config.hazeBaseReference);
|
||||
|
||||
_haze->setIsHazeActive(config.isHazeActive);
|
||||
_haze->setIsAltitudeBased(config.isAltitudeBased);
|
||||
_haze->setIsDirectionaLightAttenuationActive(config.isDirectionaLightAttenuationActive);
|
||||
_haze->setIsModulateColorActive(config.isModulateColorActive);
|
||||
|
||||
_haze->setHazeRangeFactor(model::convertHazeRangeToHazeRangeFactor(config.hazeRange_m));
|
||||
_haze->setHazeAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeAltitude_m));
|
||||
|
||||
_haze->setHazeKeyLightRangeFactor(model::convertHazeRangeToHazeRangeFactor(config.hazeKeyLightRange_m));
|
||||
_haze->setHazeKeyLightAltitudeFactor(model::convertHazeAltitudeToHazeAltitudeFactor(config.hazeKeyLightAltitude_m));
|
||||
|
||||
_haze->setHazeBackgroundBlendValue(config.hazeBackgroundBlendValue);
|
||||
}
|
||||
|
||||
HazeStage::Index HazeStage::findHaze(const HazePointer& haze) const {
|
||||
auto found = _hazeMap.find(haze);
|
||||
if (found != _hazeMap.end()) {
|
||||
|
|
|
@ -80,13 +80,98 @@ public:
|
|||
protected:
|
||||
};
|
||||
|
||||
class FetchHazeConfig : public render::Job::Config {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(float hazeColorR MEMBER hazeColorR WRITE setHazeColorR NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeColorG MEMBER hazeColorG WRITE setHazeColorG NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeColorB MEMBER hazeColorB WRITE setHazeColorB NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeDirectionalLightAngle_degs MEMBER hazeDirectionalLightAngle_degs WRITE setDirectionalLightAngle_degs NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeDirectionalLightColorR MEMBER hazeDirectionalLightColorR WRITE setDirectionalLightColorR NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeDirectionalLightColorG MEMBER hazeDirectionalLightColorG WRITE setDirectionalLightColorG NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeDirectionalLightColorB MEMBER hazeDirectionalLightColorB WRITE setDirectionalLightColorB NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeBaseReference MEMBER hazeBaseReference WRITE setHazeBaseReference NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(bool isHazeActive MEMBER isHazeActive WRITE setIsHazeActive NOTIFY dirty);
|
||||
Q_PROPERTY(bool isAltitudeBased MEMBER isAltitudeBased WRITE setIsAltitudeBased NOTIFY dirty);
|
||||
Q_PROPERTY(bool isDirectionaLightAttenuationActive MEMBER isDirectionaLightAttenuationActive WRITE setIsDirectionaLightAttenuationActive NOTIFY dirty);
|
||||
Q_PROPERTY(bool isModulateColorActive MEMBER isModulateColorActive WRITE setIsModulateColorActive NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeRange_m MEMBER hazeRange_m WRITE setHazeRange_m NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeAltitude_m MEMBER hazeAltitude_m WRITE setHazeAltitude_m NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeKeyLightRange_m MEMBER hazeKeyLightRange_m WRITE setHazeKeyLightRange_m NOTIFY dirty);
|
||||
Q_PROPERTY(float hazeKeyLightAltitude_m MEMBER hazeKeyLightAltitude_m WRITE setHazeKeyLightAltitude_m NOTIFY dirty);
|
||||
|
||||
Q_PROPERTY(float hazeBackgroundBlendValue MEMBER hazeBackgroundBlendValue WRITE setHazeBackgroundBlendValue NOTIFY dirty);
|
||||
|
||||
public:
|
||||
FetchHazeConfig() : render::Job::Config() {}
|
||||
|
||||
float hazeColorR{ model::initialHazeColor.r };
|
||||
float hazeColorG{ model::initialHazeColor.g };
|
||||
float hazeColorB{ model::initialHazeColor.b };
|
||||
float hazeDirectionalLightAngle_degs{ model::initialDirectionalLightAngle_degs };
|
||||
|
||||
float hazeDirectionalLightColorR{ model::initialDirectionalLightColor.r };
|
||||
float hazeDirectionalLightColorG{ model::initialDirectionalLightColor.g };
|
||||
float hazeDirectionalLightColorB{ model::initialDirectionalLightColor.b };
|
||||
float hazeBaseReference{ model::initialHazeBaseReference };
|
||||
|
||||
bool isHazeActive{ false };
|
||||
bool isAltitudeBased{ false };
|
||||
bool isDirectionaLightAttenuationActive{ false };
|
||||
bool isModulateColorActive{ false };
|
||||
|
||||
float hazeRange_m{ model::initialHazeRange_m };
|
||||
float hazeAltitude_m{ model::initialHazeAltitude_m };
|
||||
|
||||
float hazeKeyLightRange_m{ model::initialHazeKeyLightRange_m };
|
||||
float hazeKeyLightAltitude_m{ model::initialHazeKeyLightAltitude_m };
|
||||
|
||||
float hazeBackgroundBlendValue{ model::initialHazeBackgroundBlendValue };
|
||||
|
||||
public slots:
|
||||
void setHazeColorR(const float value) { hazeColorR = value; emit dirty(); }
|
||||
void setHazeColorG(const float value) { hazeColorG = value; emit dirty(); }
|
||||
void setHazeColorB(const float value) { hazeColorB = value; emit dirty(); }
|
||||
void setDirectionalLightAngle_degs(const float value) { hazeDirectionalLightAngle_degs = value; emit dirty(); }
|
||||
|
||||
void setDirectionalLightColorR(const float value) { hazeDirectionalLightColorR = value; emit dirty(); }
|
||||
void setDirectionalLightColorG(const float value) { hazeDirectionalLightColorG = value; emit dirty(); }
|
||||
void setDirectionalLightColorB(const float value) { hazeDirectionalLightColorB = value; emit dirty(); }
|
||||
void setHazeBaseReference(const float value) { hazeBaseReference = value; ; emit dirty(); }
|
||||
|
||||
void setIsHazeActive(const bool active) { isHazeActive = active; emit dirty(); }
|
||||
void setIsAltitudeBased(const bool active) { isAltitudeBased = active; emit dirty(); }
|
||||
void setIsDirectionaLightAttenuationActive(const bool active) { isDirectionaLightAttenuationActive = active; emit dirty(); }
|
||||
void setIsModulateColorActive(const bool active) { isModulateColorActive = active; emit dirty(); }
|
||||
|
||||
void setHazeRange_m(const float value) { hazeRange_m = value; emit dirty(); }
|
||||
void setHazeAltitude_m(const float value) { hazeAltitude_m = value; emit dirty(); }
|
||||
|
||||
void setHazeKeyLightRange_m(const float value) { hazeKeyLightRange_m = value; emit dirty(); }
|
||||
void setHazeKeyLightAltitude_m(const float value) { hazeKeyLightAltitude_m = value; emit dirty(); }
|
||||
|
||||
void setHazeBackgroundBlendValue(const float value) { hazeBackgroundBlendValue = value; ; emit dirty(); }
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
};
|
||||
|
||||
class FetchHazeStage {
|
||||
public:
|
||||
using JobModel = render::Job::ModelO<FetchHazeStage, model::HazePointer>;
|
||||
using Config = FetchHazeConfig;
|
||||
using JobModel = render::Job::ModelO<FetchHazeStage, model::HazePointer, Config>;
|
||||
|
||||
FetchHazeStage();
|
||||
|
||||
void configure(const Config& config);
|
||||
void run(const render::RenderContextPointer& renderContext, model::HazePointer& haze);
|
||||
|
||||
private:
|
||||
model::HazePointer _haze;
|
||||
gpu::PipelinePointer _hazePipeline;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -148,8 +148,8 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
|||
const auto lightClusters = task.addJob<LightClusteringPass>("LightClustering", lightClusteringPassInputs);
|
||||
|
||||
// Add haze model
|
||||
const auto hazeModel = task.addJob<MakeHaze>("HazeModel");
|
||||
////const auto hazeModel = task.addJob<FetchHazeStage>("FetchHazeStage");
|
||||
////const auto hazeModel = task.addJob<MakeHaze>("HazeModel");
|
||||
const auto hazeModel = task.addJob<FetchHazeStage>("FetchHazeStage");
|
||||
|
||||
// DeferredBuffer is complete, now let's shade it into the LightingBuffer
|
||||
const auto deferredLightingInputs = RenderDeferred::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel,
|
||||
|
|
Loading…
Reference in a new issue