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 virtual ~HdxSelectionTracker();
98
102 HDX_API
103 virtual void UpdateSelection(HdRenderIndex *index);
104
113 HDX_API
114 virtual bool GetSelectionOffsetBuffer(const HdRenderIndex *index,
115 bool enableSelectionHighlight,
116 bool enableLocateHighlight,
117 VtIntArray *offsets) const;
118
119 HDX_API
120 virtual VtVec4fArray GetSelectedPointColors(const HdRenderIndex *index);
121
126 HDX_API
127 int GetVersion() const;
128
133 HDX_API
134 void SetSelection(HdSelectionSharedPtr const &selection);
135
139 HDX_API
140 HdSelectionSharedPtr const &GetSelectionMap() const;
141
142protected:
145 HDX_API
147
148private:
149 bool _GetSelectionOffsets(HdSelectionSharedPtr const &selection,
151 const HdRenderIndex *index,
152 size_t modeOffset,
153 std::vector<int>* offsets) const;
154
155 // A helper class to obtain the union of the selection computed
156 // by querying the scene indices (with the HdxSelectionSceneIndexObserver)
157 // and the selection set with SetSelection.
158 class _MergedSelection;
159 std::unique_ptr<_MergedSelection> _mergedSelection;
160};
161
162
163PXR_NAMESPACE_CLOSE_SCOPE
164
165#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:104
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.