24 #ifndef PXR_IMAGING_HDX_PICK_TASK_H
25 #define PXR_IMAGING_HDX_PICK_TASK_H
51 #define HDX_PICK_TOKENS \
56 (pickPrimsAndInstances) \
62 (resolveNearestToCamera) \
63 (resolveNearestToCenter) \
148 ,
pickTarget(HdxPickTokens->pickPrimsAndInstances)
149 ,
resolveMode(HdxPickTokens->resolveNearestToCamera)
212 return (int32_t(idColor[0] & 0xff) << 0) |
213 (int32_t(idColor[1] & 0xff) << 8) |
214 (int32_t(idColor[2] & 0xff) << 16) |
215 (int32_t(idColor[3] & 0xff) << 24);
228 void _InitIfNeeded();
229 void _CreateAovBindings();
230 void _CleanupAovBindings();
231 void _ResizeOrCreateBufferForAOV(
234 void _ConditionStencilWithGLCallback(
238 bool _UseOcclusionPass()
const;
239 bool _UseWidgetPass()
const;
243 _ReadAovBuffer(
TfToken const & aovName)
const;
261 std::vector<std::unique_ptr<HdStRenderBuffer>> _pickableAovBuffers;
264 size_t _pickableDepthIndex;
266 std::unique_ptr<HdStRenderBuffer> _widgetDepthStencilBuffer;
269 HdxPickTask() =
delete;
270 HdxPickTask(
const HdxPickTask &) =
delete;
271 HdxPickTask &operator =(
const HdxPickTask &) =
delete;
297 int const* instanceIds,
298 int const* elementIds,
317 HdxPickResult&
operator=(HdxPickResult &&);
346 bool _ResolveHit(
int index,
int x,
int y,
float z,
HdxPickHit* hit)
const;
347 size_t _GetHash(
int index)
const;
348 bool _IsValidHit(
int index)
const;
352 int _GetPrimId(
int index)
const {
353 return _primIds ? _primIds[
index] : -1;
355 int _GetInstanceId(
int index)
const {
356 return _instanceIds ? _instanceIds[
index] : -1;
358 int _GetElementId(
int index)
const {
359 return _elementIds ? _elementIds[
index] : -1;
361 int _GetEdgeId(
int index)
const {
362 return _edgeIds ? _edgeIds[
index] : -1;
364 int _GetPointId(
int index)
const {
365 return _pointIds ? _pointIds[
index] : -1;
371 GfVec3f _GetNormal(
int index)
const;
374 int const* _instanceIds;
375 int const* _elementIds;
377 int const* _pointIds;
379 float const* _depths;
422 #endif // PXR_IMAGING_HDX_PICK_TASK_H
bool enableSceneMaterials
std::shared_ptr< class HdRenderPassState > HdRenderPassStateSharedPtr
GfVec3f worldSpaceHitNormal
std::shared_ptr< class HdStShaderCode > HdStShaderCodeSharedPtr
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
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.
GLdouble GLdouble GLdouble z
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 const TfTokenVector & GetRenderTags() const override
HDX_API std::ostream & operator<<(std::ostream &out, const HdxPickHit &h)
std::unordered_map< TfToken, VtValue, TfToken::HashFunctor > HdTaskContext
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)
#define PXR_NAMESPACE_CLOSE_SCOPE
std::vector< GfVec4d > clipPlanes
std::vector< HdRenderPassAovBinding > HdRenderPassAovBindingVector
HdRprimCollection collection
HDX_API void ResolveNearestToCamera(HdxPickHitVector *allHits) const
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
std::function< void(void)> DepthMaskCallback