Loading...
Searching...
No Matches
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 PXR_IMAGING_HDX_SELECTION_TASK_H
25#define PXR_IMAGING_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
32#include "pxr/base/gf/vec4f.h"
33
34#include <memory>
35
36PXR_NAMESPACE_OPEN_SCOPE
37
38
39class HdRenderIndex;
40class HdSceneDelegate;
41
42struct HdxSelectionTaskParams
43{
44 bool enableSelectionHighlight;
45 bool enableLocateHighlight;
46 float occludedSelectionOpacity; // lerp factor when blending
47 // occluded selection
48 GfVec4f selectionColor; // "active" selection color
49 GfVec4f locateColor; // "rollover" selection color
50};
51
52using HdBufferArrayRangeSharedPtr = std::shared_ptr<class HdBufferArrayRange>;
53
62class HdxSelectionTask : public HdTask
63{
64public:
65 HDX_API
66 HdxSelectionTask(HdSceneDelegate* delegate, SdfPath const& id);
67
68 HDX_API
69 ~HdxSelectionTask() override;
70
72 HDX_API
73 void Sync(HdSceneDelegate* delegate,
74 HdTaskContext* ctx,
75 HdDirtyBits* dirtyBits) override;
76
77
79 HDX_API
80 void Prepare(HdTaskContext* ctx,
81 HdRenderIndex* renderIndex) override;
82
84 HDX_API
85 void Execute(HdTaskContext* ctx) override;
86
87
88private:
89 int _lastVersion;
90 bool _hasSelection;
91 HdxSelectionTaskParams _params;
92 HdBufferArrayRangeSharedPtr _selOffsetBar;
93 HdBufferArrayRangeSharedPtr _selUniformBar;
94 size_t _pointColorsBufferSize;
95
96 HdxSelectionTask() = delete;
97 HdxSelectionTask(const HdxSelectionTask &) = delete;
98 HdxSelectionTask &operator =(const HdxSelectionTask &) = delete;
99};
100
101// VtValue requirements
102HDX_API
103std::ostream& operator<<(std::ostream& out,
104 const HdxSelectionTaskParams& pv);
105HDX_API
106bool operator==(const HdxSelectionTaskParams& lhs,
107 const HdxSelectionTaskParams& rhs);
108HDX_API
109bool operator!=(const HdxSelectionTaskParams& lhs,
110 const HdxSelectionTaskParams& rhs);
111
112
113PXR_NAMESPACE_CLOSE_SCOPE
114
115#endif //PXR_IMAGING_HDX_SELECTION_TASK_H
116
Basic type for a vector of 4 float components.
Definition: vec4f.h:63
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:121
Adapter class providing data exchange with the client scene graph.
The SelectionTask is responsible for setting up render pass global buffers for selection and depositi...
Definition: selectionTask.h:63
HDX_API void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the render pass resources.
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare the tasks resources.
HDX_API void Execute(HdTaskContext *ctx) override
Execute render pass task.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:291
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].