mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
Simplified pick item jobs by using inherited enabled flag in render::Job::Config
This commit is contained in:
parent
7de6079df8
commit
27227d6bd2
2 changed files with 11 additions and 17 deletions
|
@ -10,22 +10,22 @@
|
|||
//
|
||||
#include "PickItemsJob.h"
|
||||
|
||||
PickItemsJob::PickItemsJob() {
|
||||
}
|
||||
|
||||
void PickItemsJob::configure(const Config& config) {
|
||||
_isEnabled = config.isEnabled;
|
||||
}
|
||||
|
||||
void PickItemsJob::run(const render::RenderContextPointer& renderContext, const PickItemsJob::Input& input, PickItemsJob::Output& output) {
|
||||
output.clear();
|
||||
|
||||
if (_isEnabled) {
|
||||
float minIsectDistance = std::numeric_limits<float>::max();
|
||||
auto& itemBounds = input;
|
||||
auto itemID = findNearestItem(renderContext, itemBounds, minIsectDistance);
|
||||
float minIsectDistance = std::numeric_limits<float>::max();
|
||||
auto& itemBounds = input;
|
||||
auto itemID = findNearestItem(renderContext, itemBounds, minIsectDistance);
|
||||
|
||||
if (render::Item::isValidID(itemID)) {
|
||||
output.emplace_back(itemID);
|
||||
}
|
||||
}
|
||||
if (render::Item::isValidID(itemID)) {
|
||||
output.emplace_back(itemID);
|
||||
}
|
||||
}
|
||||
|
||||
render::ItemID PickItemsJob::findNearestItem(const render::RenderContextPointer& renderContext, const render::ItemBounds& inputs, float& minIsectDistance) const {
|
||||
|
|
|
@ -15,16 +15,10 @@
|
|||
#include <render/Engine.h>
|
||||
|
||||
class PickItemsConfig : public render::Job::Config {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool isEnabled MEMBER isEnabled NOTIFY dirty)
|
||||
|
||||
public:
|
||||
|
||||
bool isEnabled{ false };
|
||||
|
||||
signals:
|
||||
|
||||
void dirty();
|
||||
PickItemsConfig() : render::Job::Config(false) {}
|
||||
};
|
||||
|
||||
class PickItemsJob {
|
||||
|
@ -36,7 +30,7 @@ public:
|
|||
using Output = render::ItemBounds;
|
||||
using JobModel = render::Job::ModelIO<PickItemsJob, Input, Output, Config>;
|
||||
|
||||
PickItemsJob() {}
|
||||
PickItemsJob();
|
||||
|
||||
void configure(const Config& config);
|
||||
void run(const render::RenderContextPointer& renderContext, const PickItemsJob::Input& input, PickItemsJob::Output& output);
|
||||
|
|
Loading…
Reference in a new issue