24 #ifndef PXR_IMAGING_HDX_PICK_TASK_H
25 #define PXR_IMAGING_HDX_PICK_TASK_H
53 #define HDX_PICK_TOKENS \
58 (pickPrimsAndInstances) \
62 (pickPointsAndInstances) \
65 (resolveNearestToCamera) \
66 (resolveNearestToCenter) \
195 const TfToken &nameInPrimOrigin =
196 HdPrimOriginSchemaTokens->scenePath)
const;
240 ,
pickTarget(HdxPickTokens->pickPrimsAndInstances)
241 ,
resolveMode(HdxPickTokens->resolveNearestToCamera)
304 return (int32_t(idColor[0] & 0xff) << 0) |
305 (int32_t(idColor[1] & 0xff) << 8) |
306 (int32_t(idColor[2] & 0xff) << 16) |
307 (int32_t(idColor[3] & 0xff) << 24);
320 void _InitIfNeeded();
321 void _CreateAovBindings();
322 void _CleanupAovBindings();
323 void _ResizeOrCreateBufferForAOV(
326 void _ConditionStencilWithGLCallback(
330 bool _UseOcclusionPass()
const;
331 bool _UseWidgetPass()
const;
335 _ReadAovBuffer(
TfToken const & aovName)
const;
353 std::vector<std::unique_ptr<HdStRenderBuffer>> _pickableAovBuffers;
356 size_t _pickableDepthIndex;
358 std::unique_ptr<HdStRenderBuffer> _widgetDepthStencilBuffer;
361 HdxPickTask() =
delete;
362 HdxPickTask(
const HdxPickTask &) =
delete;
363 HdxPickTask &operator =(
const HdxPickTask &) =
delete;
389 int const* instanceIds,
390 int const* elementIds,
409 HdxPickResult&
operator=(HdxPickResult &&);
438 bool _ResolveHit(
int index,
int x,
int y,
float z,
HdxPickHit* hit)
const;
440 size_t _GetHash(
int index)
const;
441 bool _IsValidHit(
int index)
const;
445 int _GetPrimId(
int index)
const {
446 return _primIds ? _primIds[
index] : -1;
448 int _GetInstanceId(
int index)
const {
449 return _instanceIds ? _instanceIds[
index] : -1;
451 int _GetElementId(
int index)
const {
452 return _elementIds ? _elementIds[
index] : -1;
454 int _GetEdgeId(
int index)
const {
455 return _edgeIds ? _edgeIds[
index] : -1;
457 int _GetPointId(
int index)
const {
458 return _pointIds ? _pointIds[
index] : -1;
464 GfVec3f _GetNormal(
int index)
const;
467 int const* _instanceIds;
468 int const* _elementIds;
470 int const* _pointIds;
472 float const* _depths;
515 #endif // PXR_IMAGING_HDX_PICK_TASK_H
bool enableSceneMaterials
std::shared_ptr< class HdRenderPassState > HdRenderPassStateSharedPtr
GfVec3f worldSpaceHitNormal
std::shared_ptr< class HdStShaderCode > HdStShaderCodeSharedPtr
int instanceId
Index of the picked instance.
HDX_API size_t GetHash() const
std::shared_ptr< class HdRenderPass > HdRenderPassSharedPtr
HDX_API void Execute(HdTaskContext *ctx) override
Execute the pick task.
std::vector< HdxPickHit > HdxPickHitVector
GLdouble GLdouble GLdouble z
GfVec3f worldSpaceHitPoint
HDX_API void ResolveUnique(HdxPickHitVector *allHits) const
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
HdxPickHitVector * outHits
bool doUnpickablesOcclude
TF_DECLARE_PUBLIC_TOKENS(HdxPickTokens, HDX_API, HDX_PICK_TOKENS)
HdxPickTaskContextParams()
DepthMaskCallback depthMaskCallback
HDX_API void ResolveNearestToCenter(HdxPickHitVector *allHits) const
HDX_API ~HdxPickTask() override
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
static HDX_API HdxPrimOriginInfo FromPickHit(HdRenderIndex *renderIndex, const HdxPickHit &hit)
HDX_API HdxPickResult & operator=(HdxPickResult &&)
std::vector< TfToken > TfTokenVector
Convenience types.
HDX_API void ResolveAll(HdxPickHitVector *allHits) const
A utility class for resolving ID buffers into hits.
HDX_API SdfPath GetFullPath(const TfToken &nameInPrimOrigin=HdPrimOriginSchemaTokens->scenePath) const
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
HdContainerDataSourceHandle primOrigin
GfMatrix4d projectionMatrix
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 pick task.
GLfloat GLfloat GLfloat GLfloat h
HDX_API bool IsValid() const
Return whether the result was given well-formed parameters.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
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)
static int DecodeIDRenderColor(unsigned char const idColor[4])
Utility: Given a UNorm8Vec4 pixel, unpack it into an int32 ID.
HDX_API bool operator<(HdxPickHit const &lhs, HdxPickHit const &rhs)
HdContainerDataSourceHandle instancePrimOrigin
#define PXR_NAMESPACE_CLOSE_SCOPE
SdfPath instancerSceneIndexPath
The path of the instancer in the scene index.
std::vector< GfVec4d > clipPlanes
std::vector< HdRenderPassAovBinding > HdRenderPassAovBindingVector
std::vector< HdxInstancerContext > instancerContexts
HdRprimCollection collection
HDX_API void ResolveNearestToCamera(HdxPickHitVector *allHits) const
HdContainerDataSourceHandle instancerPrimOrigin
The prim origin data source of the instancer.
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
SdfPath instanceSceneIndexPath
std::function< void(void)> DepthMaskCallback