Overte C++ Documentation
PickItemsJob.h
1 //
2 // PickItemsJob.h
3 // render-utils/src/
4 //
5 // Created by Olivier Prat on 08/08/17.
6 // Copyright 2017 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_render_utils_PickItemsJob_h
13 #define hifi_render_utils_PickItemsJob_h
14 
15 #include <render/Engine.h>
16 #include <render/Item.h>
17 
18 class PickItemsConfig : public render::Job::Config {
19  Q_OBJECT
20  Q_PROPERTY(bool pick MEMBER pick NOTIFY dirty)
21 
22 public:
23 
24  bool pick{ false };
25 
26 signals:
27  void dirty();
28 };
29 
30 class PickItemsJob {
31 
32 public:
33 
34  using Config = PickItemsConfig;
35  using Input = render::ItemBounds;
36  using Output = render::ItemBounds;
37  using JobModel = render::Job::ModelIO<PickItemsJob, Input, Output, Config>;
38 
39  PickItemsJob(render::ItemKey::Flags validKeys = render::ItemKey::Builder().withTypeMeta().withTypeShape().build()._flags, render::ItemKey::Flags excludeKeys = 0);
40 
41  void configure(const Config& config);
42  void run(const render::RenderContextPointer& renderContext, const PickItemsJob::Input& input, PickItemsJob::Output& output);
43 
44 private:
45 
46  render::ItemKey::Flags _validKeys;
47  render::ItemKey::Flags _excludeKeys;
48  bool _isEnabled{ false };
49 
50  render::ItemBound findNearestItem(const render::RenderContextPointer& renderContext, const render::ItemBounds& inputs, float& minIsectDistance) const;
51 };
52 
53 #endif // hifi_render_utils_PickItemsJob_h
54 
55