Loading...
Searching...
No Matches
selectionTracker.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_TRACKER_H
8#define PXR_IMAGING_HDX_SELECTION_TRACKER_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/selection.h"
14#include "pxr/base/vt/array.h"
15#include <vector>
16#include <memory>
17
18PXR_NAMESPACE_OPEN_SCOPE
19
20
21class HdRenderIndex;
22
23using HdxSelectionTrackerSharedPtr =
24 std::shared_ptr<class HdxSelectionTracker>;
25
77
78
93{
94public:
95 HDX_API
97
98 HDX_API
99 virtual ~HdxSelectionTracker();
100
104 HDX_API
105 virtual void UpdateSelection(HdRenderIndex *index);
106
115 HDX_API
116 virtual bool GetSelectionOffsetBuffer(const HdRenderIndex *index,
117 bool enableSelectionHighlight,
118 bool enableLocateHighlight,
119 VtIntArray *offsets) const;
120
121 HDX_API
122 virtual VtVec4fArray GetSelectedPointColors(const HdRenderIndex *index);
123
128 HDX_API
129 int GetVersion() const;
130
135 HDX_API
136 void SetSelection(HdSelectionSharedPtr const &selection);
137
141 HDX_API
142 HdSelectionSharedPtr const &GetSelectionMap() const;
143
144protected:
147 HDX_API
149
150private:
151 bool _GetSelectionOffsets(HdSelectionSharedPtr const &selection,
153 const HdRenderIndex *index,
154 size_t modeOffset,
155 std::vector<int>* offsets) const;
156
157 // A helper class to obtain the union of the selection computed
158 // by querying the scene indices (with the HdxSelectionSceneIndexObserver)
159 // and the selection set with SetSelection.
160 class _MergedSelection;
161 std::unique_ptr<_MergedSelection> _mergedSelection;
162};
163
164
165PXR_NAMESPACE_CLOSE_SCOPE
166
167#endif //PXR_IMAGING_HDX_SELECTION_TRACKER_H
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:105
HighlightMode
Selection modes allow differentiation in selection highlight behavior.
Definition: selection.h:39
HdxSelectionTracker takes HdSelection and generates a GPU buffer to be used.
virtual HDX_API void UpdateSelection(HdRenderIndex *index)
Optional override to update the selection (either compute HdSelection and call SetSelection or update...
HDX_API void _IncrementVersion()
Increments the internal selection state version, used for invalidation via GetVersion().
HDX_API int GetVersion() const
Returns a monotonically increasing version number, which increments whenever the result of GetBuffers...
virtual HDX_API bool GetSelectionOffsetBuffer(const HdRenderIndex *index, bool enableSelectionHighlight, bool enableLocateHighlight, VtIntArray *offsets) const
Encodes the selection state (HdxSelection) as an integer array.
HDX_API HdSelectionSharedPtr const & GetSelectionMap() const
Returns selection set with SetSelection.
HDX_API void SetSelection(HdSelectionSharedPtr const &selection)
Set the collection of selected objects.