All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pickFromRenderBufferTask.h
1 //
2 // Copyright 2019 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 HDX_PICK_FROM_RENDERBUFFER_TASK_H
25 #define HDX_PICK_FROM_RENDERBUFFER_TASK_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdx/api.h"
29 #include "pxr/imaging/hdx/progressiveTask.h"
30 
31 #include "pxr/imaging/hd/camera.h"
32 #include "pxr/imaging/hd/renderBuffer.h"
33 #include "pxr/imaging/hdx/pickTask.h"
34 
35 PXR_NAMESPACE_OPEN_SCOPE
36 
40 {
42  : primIdBufferPath()
43  , instanceIdBufferPath()
44  , elementIdBufferPath()
45  , depthBufferPath()
46  , cameraId()
47  , viewport()
48  {}
49 
50  SdfPath primIdBufferPath;
51  SdfPath instanceIdBufferPath;
52  SdfPath elementIdBufferPath;
53  SdfPath depthBufferPath;
54 
55  // The id of the camera used to generate the id buffers.
56  SdfPath cameraId;
57 
58  // The viewport of the camera used to generate the id buffers.
59  GfVec4d viewport;
60 };
61 
70 {
71 public:
72  HDX_API
74 
75  HDX_API
76  virtual ~HdxPickFromRenderBufferTask();
77 
79  virtual bool IsConverged() const override;
80 
82  HDX_API
83  virtual void Sync(HdSceneDelegate* delegate,
84  HdTaskContext* ctx,
85  HdDirtyBits* dirtyBits) override;
86 
88  HDX_API
89  virtual void Prepare(HdTaskContext* ctx,
90  HdRenderIndex* renderIndex) override;
91 
93  HDX_API
94  virtual void Execute(HdTaskContext* ctx) override;
95 
96 private:
98  HdxPickTaskContextParams _contextParams;
99  // We need to cache a pointer to the render index so Execute() can
100  // map prim ID to paths.
101  HdRenderIndex *_index;
102 
103  HdRenderBuffer *_primId;
104  HdRenderBuffer *_instanceId;
105  HdRenderBuffer *_elementId;
106  HdRenderBuffer *_depth;
107  const HdCamera *_camera;
108 
109  bool _converged;
110 
111  HdxPickFromRenderBufferTask() = delete;
112  HdxPickFromRenderBufferTask(const HdxPickFromRenderBufferTask &) = delete;
113  HdxPickFromRenderBufferTask &operator =(
114  const HdxPickFromRenderBufferTask &) = delete;
115 };
116 
117 // VtValue requirements
118 HDX_API
119 std::ostream& operator<<(std::ostream& out, const HdxPickFromRenderBufferTaskParams& pv);
120 HDX_API
123 HDX_API
126 
127 PXR_NAMESPACE_CLOSE_SCOPE
128 
129 #endif //HDX_PICK_FROM_RENDERBUFFER_TASK_H
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:119
Pick task context params.
Definition: pickTask.h:119
This is an interface class that declares that derived tasks implement some form of progressive render...
Hydra schema for a camera that pulls the basic params (see above) during Sync.
Definition: camera.h:80
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
Basic type for a vector of 4 double components.
Definition: vec4d.h:63
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
A task for running picking queries against pre-existing id buffers.
Adapter class providing data exchange with the client scene graph.
virtual HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare the pick task.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
virtual bool IsConverged() const override
Hooks for progressive rendering.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
virtual HDX_API void Execute(HdTaskContext *ctx) override
Execute the pick task.
A render buffer is a handle to a data resource that can be rendered into, such as a 2d image for a dr...
Definition: renderBuffer.h:48
virtual HDX_API void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the render pass resources.