HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pickTask.h
Go to the documentation of this file.
1 //
2 // Copyright 2019 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_PICK_TASK_H
8 #define PXR_IMAGING_HDX_PICK_TASK_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hdx/api.h"
12 
15 #include "pxr/imaging/hd/enums.h"
20 #include "pxr/imaging/hd/task.h"
21 
22 #include "pxr/base/arch/align.h"
24 #include "pxr/base/gf/matrix4d.h"
25 #include "pxr/base/gf/vec2i.h"
26 #include "pxr/base/gf/vec2f.h"
27 #include "pxr/base/gf/vec4i.h"
28 #include "pxr/base/gf/vec4d.h"
29 #include "pxr/usd/sdf/path.h"
30 
31 #include <vector>
32 #include <memory>
33 
35 
36 #define HDX_PICK_TOKENS \
37  /* Task context */ \
38  (pickParams) \
39  \
40  /* Pick target */ \
41  (pickPrimsAndInstances) \
42  (pickFaces) \
43  (pickEdges) \
44  (pickPoints) \
45  (pickPointsAndInstances) \
46  \
47  /* Resolve mode */ \
48  (resolveNearestToCamera) \
49  (resolveNearestToCenter) \
50  (resolveUnique) \
51  (resolveAll) \
52  (resolveDeep)
53 
55 
56 class HdStRenderBuffer;
58 using HdStShaderCodeSharedPtr = std::shared_ptr<class HdStShaderCode>;
59 
60 class Hgi;
61 
62 /// Pick task params. This contains render-style state (for example), but is
63 /// augmented by HdxPickTaskContextParams, which is passed in on the task
64 /// context.
66 {
69  {}
70 
72 };
73 
74 /// Picking hit structure. This is output by the pick task as a record of
75 /// what objects the picking query found.
76 struct HdxPickHit
77 {
78  /// delegateID of HdSceneDelegate that provided the picked prim.
79  /// Irrelevant for scene indices.
80  ///
81  /// \deprecated
83  /// Path computed from scenePath's in primOrigin data source of
84  /// picked prim and instancers if provided by scene index.
85  /// Otherwise, path in render index.
87  /// Only supported for scene delegates, see HdxPrimOriginInfo for
88  /// scene indices.
89  ///
90  /// \deprecated Query terminal scene index for prim and extract instancer
91  /// from HdInstancedBySchema instead.
95  int edgeIndex;
99  /// normalizedDepth is in the range [0,1]. Nb: the pick depth buffer won't
100  /// contain items drawn with materialTag "displayInOverlay" for simplicity.
102 
103  inline bool IsValid() const {
104  return !objectId.IsEmpty();
105  }
106 
107  HDX_API
108  size_t GetHash() const;
109 };
110 
111 using HdxPickHitVector = std::vector<HdxPickHit>;
112 
113 /// Information about an instancer instancing a picked object (or an
114 /// instancer instancing such an instancer and so on).
116 {
117  /// The path of the instancer in the scene index.
119  /// The prim origin data source of the instancer.
120  HdContainerDataSourceHandle instancerPrimOrigin;
121 
122  /// For implicit instancing (native instancing in USD), the path of
123  /// the picked instance in the scene index.
125 
126  /// The prim origin data source of the picked (implicit) instance
127  ///
128  /// Note that typically, exactly one of instancePrimOrigin
129  /// or instancerPrimOrigin will contain data depending on whether
130  /// the instancing at the current level was implicit or not,
131  /// respectively. This is because for implicit instancing, there is no
132  /// authored instancer in the original scene (e.g., no USD instancer
133  /// prim for USD native instancing).
134  ///
135  /// For non-nested implicit instancing, the scenePath of the
136  /// instancePrimOrigin will be an absolute path.
137  /// For nested implicit instancing, the scenePath of the instancePrimOrigin
138  /// is an absolute path for the outer instancer context and a relative
139  /// path otherwise.
140  /// The relative path corresponds to an instance within a prototype that
141  /// was itself instanced. It is relative to the prototype's root.
142  ///
143  HdContainerDataSourceHandle instancePrimOrigin;
144  /// Index of the picked instance.
146 };
147 
148 /// A helper to extract information about the picked prim that allows
149 /// modern applications to identify a prim and, e.g., obtain the scene path
150 /// such as the path of the corresponding UsdPrim.
151 ///
152 /// Note that this helper assumes that we use scene indices and that the
153 /// primOrigin data source was populated for each pickable prim in the
154 /// scene index. Typically, an application will populate the scenePath in the
155 /// primOrigin data source. But the design allows an application to populate
156 /// the primOrigin container data source with arbitrary data that helps to
157 /// give context about a prim and identify the picked prim.
158 ///
159 /// Note that legacy applications using scene delegates cannot use
160 /// HdxPrimOriginInfo and have to translate the scene index path to a scene
161 /// path using the scene delegate API
162 /// HdSceneDelegate::GetScenePrimPath and
163 /// HdSceneDelegate::ConvertIndexPathToCachePath.
164 ///
166 {
167  /// Query terminal scene index for information about picked prim.
168  HDX_API
169  static HdxPrimOriginInfo
170  FromPickHit(HdSceneIndexBaseRefPtr const &terminalSceneIndex,
171  const HdxPickHit &hit);
172 
173  /// Query terminal scene index of render index for information about
174  /// picked prim.
175  ///
176  /// \deprecated Use overload taking scene index.
177  HDX_API
178  static HdxPrimOriginInfo
179  FromPickHit(HdRenderIndex * renderIndex,
180  const HdxPickHit &hit);
181 
182  /// Vectorized implementation of function to query terminal scene index
183  /// for information about picked prim. Amortizes the cost of computing the
184  /// array of all instance indices and locations for instancers.
185  HDX_API
186  static std::vector<HdxPrimOriginInfo>
187  FromPickHits(HdSceneIndexBaseRefPtr const &terminalSceneIndex,
188  const std::vector<HdxPickHit> &hits);
189 
190  /// Vectorized implementation of function to query terminal scene index
191  /// of render index for information about picked prim. Amortizes the cost
192  /// of computing the array of all instace indices and locations for
193  /// instancers.
194  ///
195  /// \deprecated Use overload taking scene index.
196  HDX_API
197  static std::vector<HdxPrimOriginInfo>
198  FromPickHits(HdRenderIndex * renderIndex,
199  const std::vector<HdxPickHit> &hits);
200 
201  /// Combines instance scene paths and prim scene path to obtain the full
202  /// scene path.
203  ///
204  /// The scene path is extracted from the prim origin container data
205  /// source by using the given key.
206  ///
207  HDX_API
209  const TfToken &nameInPrimOrigin =
210  HdPrimOriginSchemaTokens->scenePath) const;
211 
212  /// Computes an HdInstancerContext object (equivalent to the one computed
213  /// by GetScenePrimPath) from the vector of HdxInstancerContext objects.
214  /// Note that while HdxInstancerContext has a wealth of data about both
215  /// scene instancers and hydra-created instancers, HdInstancerContext
216  /// is meant to be just a list of (scene instancer, local instance id)
217  /// tuples, used by some clients (e.g. usdview) for selection processing.
218  HDX_API
220  const TfToken &nameInPrimOrigin =
221  HdPrimOriginSchemaTokens->scenePath) const;
222 
223  /// Information about the instancers instancing the picked object.
224  /// The outer most instancer will be first.
225  std::vector<HdxInstancerContext> instancerContexts;
226  /// The prim origin data source for the picked prim if provided
227  /// by the scene index.
228  HdContainerDataSourceHandle primOrigin;
229 };
230 
231 /// Pick task context params. This contains task params that can't come from
232 /// the scene delegate (like resolution mode and pick location, that might
233 /// be resolved late), as well as the picking collection and the output
234 /// hit vector.
235 /// 'pickTarget': The target of the pick operation, which may influence the
236 /// data filled in the HdxPickHit(s).
237 /// The available options are:
238 /// HdxPickTokens->pickPrimsAndInstances
239 /// HdxPickTokens->pickFaces
240 /// HdxPickTokens->pickEdges
241 /// HdxPickTokens->pickPoints
242 /// HdxPickTokens->pickPointsAndInstances
243 ///
244 /// 'resolveMode': Dictates the resolution of which hit(s) are returned in
245 /// 'outHits'.
246 /// The available options are:
247 /// 1. HdxPickTokens->resolveNearestToCamera : Returns the hit whose
248 /// position is nearest to the camera
249 /// 2. HdxPickTokens->resolveNearestToCenter : Returns the hit whose
250 /// position is nearest to center of the pick location/region.
251 /// 3. HdxPickTokens->resolveUnique : Returns the unique hits, by hashing
252 /// the relevant member fields of HdxPickHit. The 'pickTarget'
253 /// influences this operation. For e.g., the subprim indices are ignored
254 /// when the pickTarget is pickPrimsAndInstances.
255 /// 4. HdxPickTokens->resolveAll: Returns all the hits for the pick location
256 /// or region. The number of hits returned depends on the resolution
257 /// used and may have duplicates.
258 /// 5. HdxPickTokens->resolveDeep: Returns the unique hits not only of visible
259 /// geometry but also of all the geometry hiding behind. The 'pickTarget'
260 /// influences this operation. For e.g., the subprim indices are ignored
261 /// when the pickTarget is pickPrimsAndInstances.
262 ///
264 {
265  using DepthMaskCallback = std::function<void(void)>;
266 
268  : resolution(128, 128)
269  , maxNumDeepEntries(32000)
270  , pickTarget(HdxPickTokens->pickPrimsAndInstances)
271  , resolveMode(HdxPickTokens->resolveNearestToCamera)
272  , doUnpickablesOcclude(false)
273  , viewMatrix(1)
274  , projectionMatrix(1)
275  , clipPlanes()
276  , depthMaskCallback(nullptr)
277  , collection()
278  , alphaThreshold(0.0001f)
279  , outHits(nullptr)
280  {}
281 
289  std::vector<GfVec4d> clipPlanes;
294 };
295 
296 /// \class HdxPickTask
297 ///
298 /// A task for running picking queries against the current scene.
299 /// This task generates an id buffer for a "pick frustum" (normally the
300 /// camera frustum with the near plane narrowed to an (x,y) location and a
301 /// pick radius); then it resolves that id buffer into a series of prim paths.
302 /// The "Hit" output also contains subprim picking results (e.g. picked face,
303 /// edge, point, instance) and the intersection point in scene worldspace.
304 ///
305 /// HdxPickTask takes an HdxPickTaskParams through the scene delegate, and
306 /// HdxPickTaskContextParams through the task context as "pickParams".
307 /// It produces a hit vector, in the task context as "pickHits".
308 class HdxPickTask : public HdTask
309 {
310 public:
312 
313  HDX_API
314  HdxPickTask(HdSceneDelegate* delegate, SdfPath const& id);
315 
316  HDX_API
317  ~HdxPickTask() override;
318 
319  /// Sync the render pass resources
320  HDX_API
321  void Sync(HdSceneDelegate* delegate,
322  HdTaskContext* ctx,
323  HdDirtyBits* dirtyBits) override;
324 
325  /// Prepare the pick task
326  HDX_API
327  void Prepare(HdTaskContext* ctx,
328  HdRenderIndex* renderIndex) override;
329 
330  /// Execute the pick task
331  HDX_API
332  void Execute(HdTaskContext* ctx) override;
333 
334  HDX_API
335  const TfTokenVector &GetRenderTags() const override;
336 
337  /// Utility: Given a UNorm8Vec4 pixel, unpack it into an int32 ID.
338  static inline int DecodeIDRenderColor(unsigned char const idColor[4]) {
339  return (int32_t(idColor[0] & 0xff) << 0) |
340  (int32_t(idColor[1] & 0xff) << 8) |
341  (int32_t(idColor[2] & 0xff) << 16) |
342  (int32_t(idColor[3] & 0xff) << 24);
343  }
344 
345 private:
346  HdxPickTaskParams _params;
347  HdxPickTaskContextParams _contextParams;
348  TfTokenVector _renderTags;
349  bool _useOverlayPass;
350 
351  // We need to cache a pointer to the render index so Execute() can
352  // map prim ID to paths.
353  HdRenderIndex *_index;
354 
355  void _InitIfNeeded();
356  void _CreateAovBindings();
357  void _CleanupAovBindings();
358  void _ResizeOrCreateBufferForAOV(
359  const HdRenderPassAovBinding& aovBinding);
360 
361  void _ConditionStencilWithGLCallback(
363  HdRenderBuffer const * depthStencilBuffer);
364 
365  bool _UseOcclusionPass() const;
366  bool _UseOverlayPass() const;
367  void _UpdateUseOverlayPass();
368 
369  void _ClearPickBuffer();
370  void _ResolveDeep();
371 
372  template<typename T>
374  _ReadAovBuffer(TfToken const & aovName) const;
375 
376  HdRenderBuffer const * _FindAovBuffer(TfToken const & aovName) const;
377 
378  // Create a shared render pass each for pickables, unpickables, and
379  // items in overlay (which may draw on top even when occluded).
380  HdRenderPassSharedPtr _pickableRenderPass;
381  HdRenderPassSharedPtr _occluderRenderPass;
382  HdRenderPassSharedPtr _overlayRenderPass;
383 
384  // Having separate render pass states allows us to use different
385  // shader mixins if we choose to (we don't currently).
386  HdRenderPassStateSharedPtr _pickableRenderPassState;
387  HdRenderPassStateSharedPtr _occluderRenderPassState;
388  HdRenderPassStateSharedPtr _overlayRenderPassState;
389 
390  Hgi* _hgi;
391 
392  std::vector<std::unique_ptr<HdStRenderBuffer>> _pickableAovBuffers;
393  HdRenderPassAovBindingVector _pickableAovBindings;
394  HdRenderPassAovBinding _occluderAovBinding;
395  size_t _pickableDepthIndex;
396  TfToken _depthToken;
397  std::unique_ptr<HdStRenderBuffer> _overlayDepthStencilBuffer;
398  HdRenderPassAovBindingVector _overlayAovBindings;
399 
400  // pick buffer used for deep selection
401  HdBufferArrayRangeSharedPtr _pickBuffer;
402 
403  HdxPickTask() = delete;
404  HdxPickTask(const HdxPickTask &) = delete;
405  HdxPickTask &operator =(const HdxPickTask &) = delete;
406 };
407 
408 /// A utility class for resolving ID buffers into hits.
410 public:
411 
412  // Pick result takes a tuple of ID buffers:
413  // - (primId, instanceId, elementId, edgeId, pointId)
414  // along with some geometric buffers:
415  // - (depth, Neye)
416  // ... and resolves them into a series of hits, using one of the
417  // algorithms specified below.
418  //
419  // index is used to fill in the HdxPickHit structure;
420  // pickTarget is used to determine what a valid hit is;
421  // viewMatrix, projectionMatrix, depthRange are used for unprojection
422  // to calculate the worldSpaceHitPosition and worldSpaceHitNormal.
423  // bufferSize is the size of the ID buffers, and subRect is the sub-region
424  // of the id buffers to iterate over in the resolution algorithm.
425  //
426  // All buffers need to be the same size, if passed in. It's legal for
427  // only the depth and primId buffers to be provided; everything else is
428  // optional but provides a richer picking result.
429  HDX_API
430  HdxPickResult(int const* primIds,
431  int const* instanceIds,
432  int const* elementIds,
433  int const* edgeIds,
434  int const* pointIds,
435  int const* neyes,
436  float const* depths,
437  HdRenderIndex const *index,
438  TfToken const& pickTarget,
439  GfMatrix4d const& viewMatrix,
440  GfMatrix4d const& projectionMatrix,
441  GfVec2f const& depthRange,
442  GfVec2i const& bufferSize,
443  GfVec4i const& subRect);
444 
445  HDX_API
446  ~HdxPickResult();
447 
448  HDX_API
449  HdxPickResult(HdxPickResult &&);
450  HDX_API
451  HdxPickResult& operator=(HdxPickResult &&);
452 
453  /// Return whether the result was given well-formed parameters.
454  HDX_API
455  bool IsValid() const;
456 
457  /// Return the nearest single hit point. Note that this method may be
458  /// considerably more efficient, as it only needs to construct a single
459  /// Hit object.
460  HDX_API
461  void ResolveNearestToCamera(HdxPickHitVector* allHits) const;
462 
463  /// Return the nearest single hit point from the center of the viewport.
464  /// Note that this method may be considerably more efficient, as it only
465  /// needs to construct a single Hit object.
466  HDX_API
467  void ResolveNearestToCenter(HdxPickHitVector* allHits) const;
468 
469  /// Return all hit points. Note that this may contain redundant objects,
470  /// however it allows access to all depth values for a given object.
471  HDX_API
472  void ResolveAll(HdxPickHitVector* allHits) const;
473 
474  /// Return the set of unique hit points, keeping only the nearest depth
475  /// value.
476  HDX_API
477  void ResolveUnique(HdxPickHitVector* allHits) const;
478 
479 private:
480  bool _ResolveHit(int index, int x, int y, float z, HdxPickHit* hit) const;
481 
482  size_t _GetHash(int index) const;
483  bool _IsValidHit(int index) const;
484 
485  // Provide accessors for all of the ID buffers. Since all but _primIds
486  // are optional, if the buffer doesn't exist just return -1 (== no hit).
487  int _GetPrimId(int index) const {
488  return _primIds ? _primIds[index] : -1;
489  }
490  int _GetInstanceId(int index) const {
491  return _instanceIds ? _instanceIds[index] : -1;
492  }
493  int _GetElementId(int index) const {
494  return _elementIds ? _elementIds[index] : -1;
495  }
496  int _GetEdgeId(int index) const {
497  return _edgeIds ? _edgeIds[index] : -1;
498  }
499  int _GetPointId(int index) const {
500  return _pointIds ? _pointIds[index] : -1;
501  }
502 
503  // Provide an accessor for the normal buffer. If the normal buffer is
504  // provided, this function will unpack the normal. The fallback is
505  // GfVec3f(0.0f).
506  GfVec3f _GetNormal(int index) const;
507 
508  int const* _primIds;
509  int const* _instanceIds;
510  int const* _elementIds;
511  int const* _edgeIds;
512  int const* _pointIds;
513  int const* _neyes;
514  float const* _depths;
515  HdRenderIndex const *_index;
516  TfToken _pickTarget;
517  GfMatrix4d _ndcToWorld;
518  GfMatrix4d _eyeToWorld;
519  GfVec2f _depthRange;
520  GfVec2i _bufferSize;
521  GfVec4i _subRect;
522 };
523 
524 // For sorting, order hits by ndc depth.
525 HDX_API
526 bool operator<(HdxPickHit const& lhs, HdxPickHit const& rhs);
527 
528 // VtValue requirements
529 HDX_API
530 std::ostream& operator<<(std::ostream& out, const HdxPickHit& h);
531 HDX_API
532 bool operator==(const HdxPickHit& lhs,
533  const HdxPickHit& rhs);
534 HDX_API
535 bool operator!=(const HdxPickHit& lhs,
536  const HdxPickHit& rhs);
537 
538 HDX_API
539 std::ostream& operator<<(std::ostream& out, const HdxPickTaskParams& pv);
540 HDX_API
541 bool operator==(const HdxPickTaskParams& lhs,
542  const HdxPickTaskParams& rhs);
543 HDX_API
544 bool operator!=(const HdxPickTaskParams& lhs,
545  const HdxPickTaskParams& rhs);
546 
547 HDX_API
548 std::ostream& operator<<(std::ostream& out, const HdxPickTaskContextParams& pv);
549 HDX_API
550 bool operator==(const HdxPickTaskContextParams& lhs,
551  const HdxPickTaskContextParams& rhs);
552 HDX_API
553 bool operator!=(const HdxPickTaskContextParams& lhs,
554  const HdxPickTaskContextParams& rhs);
556 
557 #endif // PXR_IMAGING_HDX_PICK_TASK_H
static HDX_API HdxPrimOriginInfo FromPickHit(HdSceneIndexBaseRefPtr const &terminalSceneIndex, const HdxPickHit &hit)
Query terminal scene index for information about picked prim.
Definition: vec4i.h:43
HdCullStyle cullStyle
Definition: pickTask.h:71
std::shared_ptr< class HdRenderPassState > HdRenderPassStateSharedPtr
Definition: engine.h:25
GfVec3f worldSpaceHitNormal
Definition: pickTask.h:98
std::shared_ptr< class HdStShaderCode > HdStShaderCodeSharedPtr
HdCullStyle
Definition: enums.h:105
int instanceId
Index of the picked instance.
Definition: pickTask.h:145
HDX_API size_t GetHash() const
Definition: vec2i.h:43
std::shared_ptr< class HdRenderPass > HdRenderPassSharedPtr
Definition: engine.h:24
int edgeIndex
Definition: pickTask.h:95
SdfPath delegateId
Definition: pickTask.h:82
uint32_t HdDirtyBits
Definition: types.h:143
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
HDX_API void Execute(HdTaskContext *ctx) override
Execute the pick task.
SdfPath objectId
Definition: pickTask.h:86
int pointIndex
Definition: pickTask.h:96
std::vector< HdxPickHit > HdxPickHitVector
Definition: pickTask.h:111
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:848
Definition: vec3f.h:45
HDX_API void ResolveUnique(HdxPickHitVector *allHits) const
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
Definition: path.h:405
GLint y
Definition: glcorearb.h:103
GfVec3d worldSpaceHitPoint
Definition: pickTask.h:97
#define HDX_API
Definition: api.h:23
SdfPath instancerId
Definition: pickTask.h:92
HdxPickHitVector * outHits
Definition: pickTask.h:293
#define HDX_PICK_TOKENS
Definition: pickTask.h:36
TF_DECLARE_PUBLIC_TOKENS(HdxPickTokens, HDX_API, HDX_PICK_TOKENS)
HDX_API HdInstancerContext ComputeInstancerContext(const TfToken &nameInPrimOrigin=HdPrimOriginSchemaTokens->scenePath) const
DepthMaskCallback depthMaskCallback
Definition: pickTask.h:290
std::vector< std::pair< SdfPath, int > > HdInstancerContext
Instancer context: a pair of instancer paths and instance indices.
Definition: sceneDelegate.h:44
HDX_API void ResolveNearestToCenter(HdxPickHitVector *allHits) const
GLfloat f
Definition: glcorearb.h:1926
Definition: token.h:70
static HDX_API std::vector< HdxPrimOriginInfo > FromPickHits(HdSceneIndexBaseRefPtr const &terminalSceneIndex, const std::vector< HdxPickHit > &hits)
HDX_API ~HdxPickTask() override
float normalizedDepth
Definition: pickTask.h:101
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:556
HDX_API ~HdxPickResult()
HDX_API HdxPickResult & operator=(HdxPickResult &&)
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
int instanceIndex
Definition: pickTask.h:93
HDX_API void ResolveAll(HdxPickHitVector *allHits) const
A utility class for resolving ID buffers into hits.
Definition: pickTask.h:409
HDX_API SdfPath GetFullPath(const TfToken &nameInPrimOrigin=HdPrimOriginSchemaTokens->scenePath) const
Definition: task.h:43
Definition: path.h:280
GLint GLenum GLint x
Definition: glcorearb.h:409
HDX_API const TfTokenVector & GetRenderTags() const override
HDX_API std::ostream & operator<<(std::ostream &out, const HdxPickHit &h)
std::unordered_map< TfToken, VtValue, TfToken::HashFunctor > HdTaskContext
Definition: renderIndex.h:61
HdContainerDataSourceHandle primOrigin
Definition: pickTask.h:228
GfMatrix4d projectionMatrix
Definition: pickTask.h:288
HDX_API void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the render pass resources.
Definition: hgi.h:94
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare the pick task.
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
HDX_API bool IsValid() const
Return whether the result was given well-formed parameters.
HDX_API HdxPickResult(int const *primIds, int const *instanceIds, int const *elementIds, int const *edgeIds, int const *pointIds, int const *neyes, float const *depths, HdRenderIndex const *index, TfToken const &pickTarget, GfMatrix4d const &viewMatrix, GfMatrix4d const &projectionMatrix, GfVec2f const &depthRange, GfVec2i const &bufferSize, GfVec4i const &subRect)
Definition: vec2f.h:45
GLuint index
Definition: glcorearb.h:786
Definition: vec3d.h:45
static int DecodeIDRenderColor(unsigned char const idColor[4])
Utility: Given a UNorm8Vec4 pixel, unpack it into an int32 ID.
Definition: pickTask.h:338
HDX_API bool operator<(HdxPickHit const &lhs, HdxPickHit const &rhs)
HdContainerDataSourceHandle instancePrimOrigin
Definition: pickTask.h:143
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
Definition: bufferArray.h:27
SdfPath instancerSceneIndexPath
The path of the instancer in the scene index.
Definition: pickTask.h:118
std::vector< GfVec4d > clipPlanes
Definition: pickTask.h:289
int elementIndex
Definition: pickTask.h:94
std::vector< HdRenderPassAovBinding > HdRenderPassAovBindingVector
Definition: aov.h:137
bool IsValid() const
Definition: pickTask.h:103
std::vector< HdxInstancerContext > instancerContexts
Definition: pickTask.h:225
HdRprimCollection collection
Definition: pickTask.h:291
HDX_API void ResolveNearestToCamera(HdxPickHitVector *allHits) const
HdContainerDataSourceHandle instancerPrimOrigin
The prim origin data source of the instancer.
Definition: pickTask.h:120
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:542
SdfPath instanceSceneIndexPath
Definition: pickTask.h:124
std::function< void(void)> DepthMaskCallback
Definition: pickTask.h:265