mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 07:43:57 +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
|
||||
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.
|
||||
addJob<DrawLight>("DrawLight", cullFunctor);
|
||||
|
@ -124,20 +122,15 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) {
|
|||
|
||||
// AA job to be revisited
|
||||
addJob<Antialiasing>("Antialiasing");
|
||||
_antialiasingJobIndex = (int)_jobs.size() - 1;
|
||||
enableJob(_antialiasingJobIndex, false);
|
||||
|
||||
// Render transparent objects forward in LightingBuffer
|
||||
addJob<DrawDeferred>("DrawTransparentDeferred", transparents, shapePlumber);
|
||||
|
||||
// Lighting Buffer ready for tone mapping
|
||||
addJob<ToneMappingDeferred>("ToneMapping");
|
||||
_toneMappingJobIndex = (int)_jobs.size() - 1;
|
||||
|
||||
// Debugging Deferred buffer job
|
||||
addJob<DebugDeferredBuffer>("DebugDeferredBuffer");
|
||||
_drawDebugDeferredBufferIndex = (int)_jobs.size() - 1;
|
||||
enableJob(_drawDebugDeferredBufferIndex, false);
|
||||
|
||||
// Status icon rendering job
|
||||
{
|
||||
|
@ -145,15 +138,11 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) {
|
|||
auto iconMapPath = PathUtils::resourcesPath() + "icons/statusIconAtlas.svg";
|
||||
auto statusIconMap = DependencyManager::get<TextureCache>()->getImageTexture(iconMapPath);
|
||||
addJob<DrawStatus>("DrawStatus", opaques, DrawStatus(statusIconMap));
|
||||
_drawStatusJobIndex = (int)_jobs.size() - 1;
|
||||
enableJob(_drawStatusJobIndex, false);
|
||||
}
|
||||
|
||||
addJob<DrawOverlay3D>("DrawOverlay3D", shapePlumber);
|
||||
|
||||
addJob<HitEffect>("HitEffect");
|
||||
_drawHitEffectJobIndex = (int)_jobs.size() -1;
|
||||
enableJob(_drawHitEffectJobIndex, false);
|
||||
|
||||
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) {
|
||||
if (pipeline.locations->normalFittingMapUnit > -1) {
|
||||
batch.setResourceTexture(pipeline.locations->normalFittingMapUnit,
|
||||
|
|
|
@ -159,34 +159,6 @@ public:
|
|||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
|
||||
|
||||
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
|
||||
|
|
|
@ -19,6 +19,8 @@ namespace render {
|
|||
class DrawStatusConfig : public Job::Config {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DrawStatusConfig() : Job::Config(false) {}
|
||||
|
||||
Q_PROPERTY(bool showDisplay MEMBER showDisplay NOTIFY dirty)
|
||||
Q_PROPERTY(bool showNetwork MEMBER showDisplay NOTIFY dirty)
|
||||
bool showDisplay{ false };
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
template <class T> bool isJobEnabled(bool enable = true, std::string job = "") const {
|
||||
|
@ -129,9 +129,6 @@ public:
|
|||
Concept(QConfigPointer config) : _config(config) {}
|
||||
virtual ~Concept() = default;
|
||||
|
||||
bool isEnabled() const { return _isEnabled; }
|
||||
void setEnabled(bool isEnabled) { _isEnabled = isEnabled; }
|
||||
|
||||
virtual const Varying getInput() const { return Varying(); }
|
||||
virtual const Varying getOutput() const { return Varying(); }
|
||||
|
||||
|
@ -142,7 +139,6 @@ public:
|
|||
|
||||
protected:
|
||||
QConfigPointer _config;
|
||||
bool _isEnabled = true;
|
||||
};
|
||||
using ConceptPointer = std::shared_ptr<Concept>;
|
||||
|
||||
|
@ -161,7 +157,7 @@ public:
|
|||
}
|
||||
|
||||
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) {
|
||||
jobRun(_data, sceneContext, renderContext);
|
||||
}
|
||||
|
@ -188,7 +184,7 @@ public:
|
|||
}
|
||||
|
||||
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) {
|
||||
jobRunI(_data, sceneContext, renderContext, _input.get<I>());
|
||||
}
|
||||
|
@ -215,7 +211,7 @@ public:
|
|||
}
|
||||
|
||||
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) {
|
||||
jobRunO(_data, sceneContext, renderContext, _output.edit<O>());
|
||||
}
|
||||
|
@ -245,7 +241,7 @@ public:
|
|||
}
|
||||
|
||||
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) {
|
||||
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) {}
|
||||
|
||||
bool isEnabled() const { return _concept->isEnabled(); }
|
||||
void setEnabled(bool isEnabled) { _concept->setEnabled(isEnabled); }
|
||||
|
||||
const Varying getInput() const { return _concept->getInput(); }
|
||||
const Varying getOutput() const { return _concept->getOutput(); }
|
||||
QConfigPointer& getConfiguration() const { return _concept->getConfiguration(); }
|
||||
|
@ -310,9 +303,11 @@ public:
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
renderContext->jobConfig.reset();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -344,8 +339,6 @@ public:
|
|||
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:
|
||||
template <class T, class C> friend class Model;
|
||||
|
|
Loading…
Reference in a new issue