Loading...
Searching...
No Matches
selectionTask.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HDX_SELECTION_TASK_H
8#define PXR_IMAGING_HDX_SELECTION_TASK_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdx/api.h"
12#include "pxr/imaging/hdx/version.h"
13#include "pxr/imaging/hd/task.h"
14
15#include "pxr/base/gf/vec4f.h"
16
17#include <memory>
18
19PXR_NAMESPACE_OPEN_SCOPE
20
21
22class HdRenderIndex;
23class HdSceneDelegate;
24
25struct HdxSelectionTaskParams
26{
27 bool enableSelectionHighlight;
28 bool enableLocateHighlight;
29 float occludedSelectionOpacity; // lerp factor when blending
30 // occluded selection
31 GfVec4f selectionColor; // "active" selection color
32 GfVec4f locateColor; // "rollover" selection color
33};
34
35using HdBufferArrayRangeSharedPtr = std::shared_ptr<class HdBufferArrayRange>;
36
46{
47public:
48 using TaskParams = HdxSelectionTaskParams;
49
50 HDX_API
51 HdxSelectionTask(HdSceneDelegate* delegate, SdfPath const& id);
52
53 HDX_API
54 ~HdxSelectionTask() override;
55
57 HDX_API
58 void Sync(HdSceneDelegate* delegate,
59 HdTaskContext* ctx,
60 HdDirtyBits* dirtyBits) override;
61
62
64 HDX_API
65 void Prepare(HdTaskContext* ctx,
66 HdRenderIndex* renderIndex) override;
67
69 HDX_API
70 void Execute(HdTaskContext* ctx) override;
71
72
73private:
74 int _lastVersion;
75 bool _hasSelection;
76 HdxSelectionTaskParams _params;
77 HdBufferArrayRangeSharedPtr _selOffsetBar;
78 HdBufferArrayRangeSharedPtr _selUniformBar;
79 size_t _pointColorsBufferSize;
80
81 HdxSelectionTask() = delete;
82 HdxSelectionTask(const HdxSelectionTask &) = delete;
83 HdxSelectionTask &operator =(const HdxSelectionTask &) = delete;
84};
85
86// VtValue requirements
87HDX_API
88std::ostream& operator<<(std::ostream& out,
89 const HdxSelectionTaskParams& pv);
90HDX_API
91bool operator==(const HdxSelectionTaskParams& lhs,
92 const HdxSelectionTaskParams& rhs);
93HDX_API
94bool operator!=(const HdxSelectionTaskParams& lhs,
95 const HdxSelectionTaskParams& rhs);
96
97
98PXR_NAMESPACE_CLOSE_SCOPE
99
100#endif //PXR_IMAGING_HDX_SELECTION_TASK_H
101
Basic type for a vector of 4 float components.
Definition: vec4f.h:46
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:105
Adapter class providing data exchange with the client scene graph.
HdTask represents a unit of work to perform during a Hydra render.
Definition: task.h:44
The SelectionTask is responsible for setting up render pass global buffers for selection and depositi...
Definition: selectionTask.h:46
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:274
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].