Loading...
Searching...
No Matches
selectionTracker.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_TRACKER_H
25#define PXR_IMAGING_HDX_SELECTION_TRACKER_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/selection.h"
31#include "pxr/base/vt/array.h"
32#include <vector>
33#include <memory>
34
35PXR_NAMESPACE_OPEN_SCOPE
36
37
38class HdRenderIndex;
39
40using HdxSelectionTrackerSharedPtr =
41 std::shared_ptr<class HdxSelectionTracker>;
42
94
95
110{
111public:
112 HDX_API
114 virtual ~HdxSelectionTracker();
115
119 HDX_API
120 virtual void UpdateSelection(HdRenderIndex *index);
121
130 HDX_API
131 virtual bool GetSelectionOffsetBuffer(const HdRenderIndex *index,
132 bool enableSelectionHighlight,
133 bool enableLocateHighlight,
134 VtIntArray *offsets) const;
135
136 HDX_API
137 virtual VtVec4fArray GetSelectedPointColors(const HdRenderIndex *index);
138
143 HDX_API
144 int GetVersion() const;
145
150 HDX_API
151 void SetSelection(HdSelectionSharedPtr const &selection);
152
156 HDX_API
157 HdSelectionSharedPtr const &GetSelectionMap() const;
158
159protected:
162 HDX_API
164
165private:
166 bool _GetSelectionOffsets(HdSelectionSharedPtr const &selection,
168 const HdRenderIndex *index,
169 size_t modeOffset,
170 std::vector<int>* offsets) const;
171
172 // A helper class to obtain the union of the selection computed
173 // by querying the scene indices (with the HdxSelectionSceneIndexObserver)
174 // and the selection set with SetSelection.
175 class _MergedSelection;
176 std::unique_ptr<_MergedSelection> _mergedSelection;
177};
178
179
180PXR_NAMESPACE_CLOSE_SCOPE
181
182#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:121
HighlightMode
Selection modes allow differentiation in selection highlight behavior.
Definition: selection.h:56
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.