mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:06:02 +02:00
Clean out job enable logic from Job
This commit is contained in:
parent
bed325d675
commit
14d907206e
4 changed files with 10 additions and 66 deletions
|
@ -113,8 +113,6 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) {
|
||||||
|
|
||||||
// AO job
|
// AO job
|
||||||
addJob<AmbientOcclusionEffect>("AmbientOcclusion");
|
addJob<AmbientOcclusionEffect>("AmbientOcclusion");
|
||||||
_jobs.back().setEnabled(false);
|
|
||||||
_occlusionJobIndex = (int)_jobs.size() - 1;
|
|
||||||
|
|
||||||
// Draw Lights just add the lights to the current list of lights to deal with. NOt really gpu job for now.
|
// Draw Lights just add the lights to the current list of lights to deal with. NOt really gpu job for now.
|
||||||
addJob<DrawLight>("DrawLight", cullFunctor);
|
addJob<DrawLight>("DrawLight", cullFunctor);
|
||||||
|
@ -124,20 +122,15 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) {
|
||||||
|
|
||||||
// AA job to be revisited
|
// AA job to be revisited
|
||||||
addJob<Antialiasing>("Antialiasing");
|
addJob<Antialiasing>("Antialiasing");
|
||||||
_antialiasingJobIndex = (int)_jobs.size() - 1;
|
|
||||||
enableJob(_antialiasingJobIndex, false);
|
|
||||||
|
|
||||||
// Render transparent objects forward in LightingBuffer
|
// Render transparent objects forward in LightingBuffer
|
||||||
addJob<DrawDeferred>("DrawTransparentDeferred", transparents, shapePlumber);
|
addJob<DrawDeferred>("DrawTransparentDeferred", transparents, shapePlumber);
|
||||||
|
|
||||||
// Lighting Buffer ready for tone mapping
|
// Lighting Buffer ready for tone mapping
|
||||||
addJob<ToneMappingDeferred>("ToneMapping");
|
addJob<ToneMappingDeferred>("ToneMapping");
|
||||||
_toneMappingJobIndex = (int)_jobs.size() - 1;
|
|
||||||
|
|
||||||
// Debugging Deferred buffer job
|
// Debugging Deferred buffer job
|
||||||
addJob<DebugDeferredBuffer>("DebugDeferredBuffer");
|
addJob<DebugDeferredBuffer>("DebugDeferredBuffer");
|
||||||
_drawDebugDeferredBufferIndex = (int)_jobs.size() - 1;
|
|
||||||
enableJob(_drawDebugDeferredBufferIndex, false);
|
|
||||||
|
|
||||||
// Status icon rendering job
|
// Status icon rendering job
|
||||||
{
|
{
|
||||||
|
@ -145,15 +138,11 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) {
|
||||||
auto iconMapPath = PathUtils::resourcesPath() + "icons/statusIconAtlas.svg";
|
auto iconMapPath = PathUtils::resourcesPath() + "icons/statusIconAtlas.svg";
|
||||||
auto statusIconMap = DependencyManager::get<TextureCache>()->getImageTexture(iconMapPath);
|
auto statusIconMap = DependencyManager::get<TextureCache>()->getImageTexture(iconMapPath);
|
||||||
addJob<DrawStatus>("DrawStatus", opaques, DrawStatus(statusIconMap));
|
addJob<DrawStatus>("DrawStatus", opaques, DrawStatus(statusIconMap));
|
||||||
_drawStatusJobIndex = (int)_jobs.size() - 1;
|
|
||||||
enableJob(_drawStatusJobIndex, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addJob<DrawOverlay3D>("DrawOverlay3D", shapePlumber);
|
addJob<DrawOverlay3D>("DrawOverlay3D", shapePlumber);
|
||||||
|
|
||||||
addJob<HitEffect>("HitEffect");
|
addJob<HitEffect>("HitEffect");
|
||||||
_drawHitEffectJobIndex = (int)_jobs.size() -1;
|
|
||||||
enableJob(_drawHitEffectJobIndex, false);
|
|
||||||
|
|
||||||
addJob<Blit>("Blit");
|
addJob<Blit>("Blit");
|
||||||
}
|
}
|
||||||
|
@ -437,18 +426,6 @@ void Blit::run(const SceneContextPointer& sceneContext, const RenderContextPoint
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderDeferredTask::setToneMappingExposure(float exposure) {
|
|
||||||
if (_toneMappingJobIndex >= 0) {
|
|
||||||
_jobs[_toneMappingJobIndex].edit<ToneMappingDeferred>()._toneMappingEffect.setExposure(exposure);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderDeferredTask::setToneMappingToneCurve(int toneCurve) {
|
|
||||||
if (_toneMappingJobIndex >= 0) {
|
|
||||||
_jobs[_toneMappingJobIndex].edit<ToneMappingDeferred>()._toneMappingEffect.setToneCurve((ToneMappingEffect::ToneCurve)toneCurve);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void pipelineBatchSetter(const ShapePipeline& pipeline, gpu::Batch& batch) {
|
void pipelineBatchSetter(const ShapePipeline& pipeline, gpu::Batch& batch) {
|
||||||
if (pipeline.locations->normalFittingMapUnit > -1) {
|
if (pipeline.locations->normalFittingMapUnit > -1) {
|
||||||
batch.setResourceTexture(pipeline.locations->normalFittingMapUnit,
|
batch.setResourceTexture(pipeline.locations->normalFittingMapUnit,
|
||||||
|
|
|
@ -159,34 +159,6 @@ public:
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
|
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
|
||||||
|
|
||||||
using JobModel = Model<RenderDeferredTask>;
|
using JobModel = Model<RenderDeferredTask>;
|
||||||
|
|
||||||
void setDrawDebugDeferredBuffer(int draw) { enableJob(_drawDebugDeferredBufferIndex, draw >= 0); }
|
|
||||||
bool doDrawDebugDeferredBuffer() const { return getEnableJob(_drawDebugDeferredBufferIndex); }
|
|
||||||
|
|
||||||
void setDrawItemStatus(int draw) { enableJob(_drawStatusJobIndex, draw > 0); }
|
|
||||||
bool doDrawItemStatus() const { return getEnableJob(_drawStatusJobIndex); }
|
|
||||||
|
|
||||||
void setDrawHitEffect(bool draw) { enableJob(_drawHitEffectJobIndex, draw); }
|
|
||||||
bool doDrawHitEffect() const { return getEnableJob(_drawHitEffectJobIndex); }
|
|
||||||
|
|
||||||
void setOcclusionStatus(bool draw) { enableJob(_occlusionJobIndex, draw); }
|
|
||||||
bool doOcclusionStatus() const { return getEnableJob(_occlusionJobIndex); }
|
|
||||||
|
|
||||||
void setAntialiasingStatus(bool draw) { enableJob(_antialiasingJobIndex, draw); }
|
|
||||||
bool doAntialiasingStatus() const { return getEnableJob(_antialiasingJobIndex); }
|
|
||||||
|
|
||||||
void setToneMappingExposure(float exposure);
|
|
||||||
|
|
||||||
void setToneMappingToneCurve(int toneCurve);
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
int _drawDebugDeferredBufferIndex;
|
|
||||||
int _drawStatusJobIndex;
|
|
||||||
int _drawHitEffectJobIndex;
|
|
||||||
int _occlusionJobIndex;
|
|
||||||
int _antialiasingJobIndex;
|
|
||||||
int _toneMappingJobIndex;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_RenderDeferredTask_h
|
#endif // hifi_RenderDeferredTask_h
|
||||||
|
|
|
@ -19,6 +19,8 @@ namespace render {
|
||||||
class DrawStatusConfig : public Job::Config {
|
class DrawStatusConfig : public Job::Config {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
DrawStatusConfig() : Job::Config(false) {}
|
||||||
|
|
||||||
Q_PROPERTY(bool showDisplay MEMBER showDisplay NOTIFY dirty)
|
Q_PROPERTY(bool showDisplay MEMBER showDisplay NOTIFY dirty)
|
||||||
Q_PROPERTY(bool showNetwork MEMBER showDisplay NOTIFY dirty)
|
Q_PROPERTY(bool showNetwork MEMBER showDisplay NOTIFY dirty)
|
||||||
bool showDisplay{ false };
|
bool showDisplay{ false };
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> void setJobEnabled(bool enable = true, std::string job = "") const {
|
template <class T> void setJobEnabled(bool enable = true, std::string job = "") const {
|
||||||
getConfig<T>(name)->enabled = enable;
|
getConfig<T>(job)->enabled = enable;
|
||||||
refresh(); // trigger a Job->configure
|
refresh(); // trigger a Job->configure
|
||||||
}
|
}
|
||||||
template <class T> bool isJobEnabled(bool enable = true, std::string job = "") const {
|
template <class T> bool isJobEnabled(bool enable = true, std::string job = "") const {
|
||||||
|
@ -129,9 +129,6 @@ public:
|
||||||
Concept(QConfigPointer config) : _config(config) {}
|
Concept(QConfigPointer config) : _config(config) {}
|
||||||
virtual ~Concept() = default;
|
virtual ~Concept() = default;
|
||||||
|
|
||||||
bool isEnabled() const { return _isEnabled; }
|
|
||||||
void setEnabled(bool isEnabled) { _isEnabled = isEnabled; }
|
|
||||||
|
|
||||||
virtual const Varying getInput() const { return Varying(); }
|
virtual const Varying getInput() const { return Varying(); }
|
||||||
virtual const Varying getOutput() const { return Varying(); }
|
virtual const Varying getOutput() const { return Varying(); }
|
||||||
|
|
||||||
|
@ -142,7 +139,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QConfigPointer _config;
|
QConfigPointer _config;
|
||||||
bool _isEnabled = true;
|
|
||||||
};
|
};
|
||||||
using ConceptPointer = std::shared_ptr<Concept>;
|
using ConceptPointer = std::shared_ptr<Concept>;
|
||||||
|
|
||||||
|
@ -161,7 +157,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||||
renderContext->jobConfig = std::static_pointer_cast<Job::Config>(_config);
|
renderContext->jobConfig = std::static_pointer_cast<Config>(_config);
|
||||||
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
|
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
|
||||||
jobRun(_data, sceneContext, renderContext);
|
jobRun(_data, sceneContext, renderContext);
|
||||||
}
|
}
|
||||||
|
@ -188,7 +184,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||||
renderContext->jobConfig = std::static_pointer_cast<Job::Config>(_config);
|
renderContext->jobConfig = std::static_pointer_cast<Config>(_config);
|
||||||
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
|
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
|
||||||
jobRunI(_data, sceneContext, renderContext, _input.get<I>());
|
jobRunI(_data, sceneContext, renderContext, _input.get<I>());
|
||||||
}
|
}
|
||||||
|
@ -215,7 +211,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||||
renderContext->jobConfig = std::static_pointer_cast<Job::Config>(_config);
|
renderContext->jobConfig = std::static_pointer_cast<Config>(_config);
|
||||||
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
|
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
|
||||||
jobRunO(_data, sceneContext, renderContext, _output.edit<O>());
|
jobRunO(_data, sceneContext, renderContext, _output.edit<O>());
|
||||||
}
|
}
|
||||||
|
@ -245,7 +241,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||||
renderContext->jobConfig = std::static_pointer_cast<Job::Config>(_config);
|
renderContext->jobConfig = std::static_pointer_cast<Config>(_config);
|
||||||
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
|
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
|
||||||
jobRunIO(_data, sceneContext, renderContext, _input.get<I>(), _output.edit<O>());
|
jobRunIO(_data, sceneContext, renderContext, _input.get<I>(), _output.edit<O>());
|
||||||
}
|
}
|
||||||
|
@ -255,9 +251,6 @@ public:
|
||||||
|
|
||||||
Job(std::string name, ConceptPointer concept) : _concept(concept), _name(name) {}
|
Job(std::string name, ConceptPointer concept) : _concept(concept), _name(name) {}
|
||||||
|
|
||||||
bool isEnabled() const { return _concept->isEnabled(); }
|
|
||||||
void setEnabled(bool isEnabled) { _concept->setEnabled(isEnabled); }
|
|
||||||
|
|
||||||
const Varying getInput() const { return _concept->getInput(); }
|
const Varying getInput() const { return _concept->getInput(); }
|
||||||
const Varying getOutput() const { return _concept->getOutput(); }
|
const Varying getOutput() const { return _concept->getOutput(); }
|
||||||
QConfigPointer& getConfiguration() const { return _concept->getConfiguration(); }
|
QConfigPointer& getConfiguration() const { return _concept->getConfiguration(); }
|
||||||
|
@ -310,9 +303,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||||
if (isEnabled()) {
|
renderContext->jobConfig = std::static_pointer_cast<Config>(_config);
|
||||||
|
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->enabled) {
|
||||||
jobRun(_data, sceneContext, renderContext);
|
jobRun(_data, sceneContext, renderContext);
|
||||||
}
|
}
|
||||||
|
renderContext->jobConfig.reset();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -344,8 +339,6 @@ public:
|
||||||
job.applyConfiguration();
|
job.applyConfiguration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void enableJob(size_t jobIndex, bool enable = true) { _jobs.at(jobIndex).setEnabled(enable); }
|
|
||||||
bool getEnableJob(size_t jobIndex) const { return _jobs.at(jobIndex).isEnabled(); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <class T, class C> friend class Model;
|
template <class T, class C> friend class Model;
|
||||||
|
|
Loading…
Reference in a new issue