All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
colorizeTask.h
1 //
2 // Copyright 2018 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_COLORIZE_TASK_H
25 #define HDX_COLORIZE_TASK_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdx/api.h"
29 #include "pxr/imaging/hdx/compositor.h"
30 #include "pxr/imaging/hdx/progressiveTask.h"
31 
32 PXR_NAMESPACE_OPEN_SCOPE
33 
34 class HdRenderBuffer;
35 
43 {
44 public:
45  HDX_API
46  HdxColorizeTask(HdSceneDelegate* delegate, SdfPath const& id);
47 
48  HDX_API
49  virtual ~HdxColorizeTask();
50 
52  virtual bool IsConverged() const override;
53 
55  HDX_API
56  virtual void Sync(HdSceneDelegate* delegate,
57  HdTaskContext* ctx,
58  HdDirtyBits* dirtyBits) override;
59 
61  HDX_API
62  virtual void Prepare(HdTaskContext* ctx,
63  HdRenderIndex* renderIndex) override;
64 
66  HDX_API
67  virtual void Execute(HdTaskContext* ctx) override;
68 
69 private:
70  // Incoming data
71  TfToken _aovName;
72  SdfPath _aovBufferPath;
73  SdfPath _depthBufferPath;
74  bool _applyColorQuantization;
75 
76  HdRenderBuffer *_aovBuffer;
77  HdRenderBuffer *_depthBuffer;
78 
79  // Ouptut data
80  uint8_t *_outputBuffer;
81  size_t _outputBufferSize;
82  bool _converged;
83 
84  HdxCompositor _compositor;
85  bool _needsValidation;
86 
87  HdxColorizeTask() = delete;
88  HdxColorizeTask(const HdxColorizeTask &) = delete;
89  HdxColorizeTask &operator =(const HdxColorizeTask &) = delete;
90 };
91 
97 {
99  : aovName()
100  , aovBufferPath()
101  , depthBufferPath()
102  , applyColorQuantization(true)
103  {}
104 
105  // XXX: Right now the API is pretty basic: draw buffer X as aov Y
106  // (e.g., colorize this buffer as float3 normals). Lots of room for
107  // cool improvements here!
108  TfToken aovName;
109  SdfPath aovBufferPath;
110  SdfPath depthBufferPath;
111  bool applyColorQuantization;
112 };
113 
114 // VtValue requirements
115 HDX_API
116 std::ostream& operator<<(std::ostream& out, const HdxColorizeTaskParams& pv);
117 HDX_API
118 bool operator==(const HdxColorizeTaskParams& lhs,
119  const HdxColorizeTaskParams& rhs);
120 HDX_API
121 bool operator!=(const HdxColorizeTaskParams& lhs,
122  const HdxColorizeTaskParams& rhs);
123 
124 PXR_NAMESPACE_CLOSE_SCOPE
125 
126 #endif // HDX_COLORIZE_TASK_H
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:119
virtual HDX_API void Execute(HdTaskContext *ctx) override
Execute the colorize task.
virtual bool IsConverged() const override
Hooks for progressive rendering.
This is an interface class that declares that derived tasks implement some form of progressive render...
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
This class is a utility for rendering deep raytracer or aov output (color/depth) to the GL framebuffe...
Definition: compositor.h:47
Adapter class providing data exchange with the client scene graph.
ColorizeTask parameters.
Definition: colorizeTask.h:96
virtual HDX_API void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the render pass resources.
A task for taking output AOV data and rendering it to the current GL buffer, possibly with a &quot;coloriz...
Definition: colorizeTask.h:42
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
virtual HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare the colorize 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