All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
selectionTask.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef HDX_SELECTION_TASK_H
25 #define HDX_SELECTION_TASK_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdx/api.h"
29 #include "pxr/imaging/hdx/version.h"
30 #include "pxr/imaging/hd/task.h"
31 #include "pxr/imaging/glf/simpleLightingContext.h"
32 
33 #include "pxr/base/gf/vec4f.h"
34 
35 #include <boost/shared_ptr.hpp>
36 
37 PXR_NAMESPACE_OPEN_SCOPE
38 
39 
40 class HdRenderIndex;
41 class HdSceneDelegate;
42 
43 struct HdxSelectionTaskParams
44 {
45  bool enableSelection;
46  GfVec4f selectionColor;
47  GfVec4f locateColor;
48 };
49 
50 typedef boost::shared_ptr<class HdBufferArrayRange> HdBufferArrayRangeSharedPtr;
51 
60 class HdxSelectionTask : public HdTask {
61 public:
62  HDX_API
63  HdxSelectionTask(HdSceneDelegate* delegate, SdfPath const& id);
64 
65  HDX_API
66  virtual ~HdxSelectionTask();
67 
69  HDX_API
70  virtual void Sync(HdSceneDelegate* delegate,
71  HdTaskContext* ctx,
72  HdDirtyBits* dirtyBits) override;
73 
74 
76  HDX_API
77  virtual void Prepare(HdTaskContext* ctx,
78  HdRenderIndex* renderIndex) override;
79 
81  HDX_API
82  virtual void Execute(HdTaskContext* ctx) override;
83 
84 
85 private:
86  int _lastVersion;
87  bool _hasSelection;
88  HdxSelectionTaskParams _params;
89  HdBufferArrayRangeSharedPtr _selOffsetBar;
90  HdBufferArrayRangeSharedPtr _selUniformBar;
91  HdBufferArrayRangeSharedPtr _selPointColorsBar;
92 
93  HdxSelectionTask() = delete;
94  HdxSelectionTask(const HdxSelectionTask &) = delete;
95  HdxSelectionTask &operator =(const HdxSelectionTask &) = delete;
96 };
97 
98 // VtValue requirements
99 HDX_API
100 std::ostream& operator<<(std::ostream& out,
101  const HdxSelectionTaskParams& pv);
102 HDX_API
103 bool operator==(const HdxSelectionTaskParams& lhs,
104  const HdxSelectionTaskParams& rhs);
105 HDX_API
106 bool operator!=(const HdxSelectionTaskParams& lhs,
107  const HdxSelectionTaskParams& rhs);
108 
109 
110 PXR_NAMESPACE_CLOSE_SCOPE
111 
112 #endif //HDX_SELECTION_TASK_H
113 
virtual HDX_API void Execute(HdTaskContext *ctx) override
Execute render pass task.
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:119
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
virtual HDX_API void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the render pass resources.
Adapter class providing data exchange with the client scene graph.
virtual HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare the tasks resources.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
Basic type for a vector of 4 float components.
Definition: vec4f.h:63
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
The SelectionTask is responsible for setting up render pass global buffers for selection and depositi...
Definition: selectionTask.h:60