All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderPass.h
1 //
2 // Copyright 2016 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 HDEMBREE_RENDER_PASS_H
25 #define HDEMBREE_RENDER_PASS_H
26 
27 #include "pxr/pxr.h"
28 
29 #include "pxr/imaging/hd/aov.h"
30 #include "pxr/imaging/hd/renderPass.h"
31 #include "pxr/imaging/hd/renderThread.h"
32 #include "pxr/imaging/hdEmbree/renderer.h"
33 #include "pxr/imaging/hdEmbree/renderBuffer.h"
34 #include "pxr/imaging/hdx/compositor.h"
35 
36 #include "pxr/base/gf/matrix4d.h"
37 
38 #include <atomic>
39 
40 PXR_NAMESPACE_OPEN_SCOPE
41 
42 typedef boost::shared_ptr<class GlfGLContext> GlfGLContextSharedPtr;
43 
52 class HdEmbreeRenderPass final : public HdRenderPass {
53 public:
60  HdRprimCollection const &collection,
61  HdRenderThread *renderThread,
62  HdEmbreeRenderer *renderer,
63  std::atomic<int> *sceneVersion);
64 
66  virtual ~HdEmbreeRenderPass();
67 
68  // -----------------------------------------------------------------------
69  // HdRenderPass API
70 
73  virtual bool IsConverged() const override;
74 
75 protected:
76 
77  // -----------------------------------------------------------------------
78  // HdRenderPass API
79 
84  virtual void _Execute(HdRenderPassStateSharedPtr const& renderPassState,
85  TfTokenVector const &renderTags) override;
86 
88  virtual void _MarkCollectionDirty() override {}
89 
90 private:
91  // A handle to the render thread.
92  HdRenderThread *_renderThread;
93 
94  // A handle to the global renderer.
95  HdEmbreeRenderer *_renderer;
96 
97  // A reference to the global scene version.
98  std::atomic<int> *_sceneVersion;
99 
100  // The last scene version we rendered with.
101  int _lastSceneVersion;
102 
103  // The last settings version we rendered with.
104  int _lastSettingsVersion;
105 
106  // The width of the viewport we're rendering into.
107  unsigned int _width;
108  // The height of the viewport we're rendering into.
109  unsigned int _height;
110 
111  // The view matrix: world space to camera space
112  GfMatrix4d _viewMatrix;
113  // The projection matrix: camera space to NDC space
114  GfMatrix4d _projMatrix;
115 
116  // The list of aov buffers this renderpass should write to.
117  HdRenderPassAovBindingVector _aovBindings;
118 
119  // If no attachments are provided, provide an anonymous renderbuffer for
120  // color and depth output.
121  HdEmbreeRenderBuffer _colorBuffer;
122  HdEmbreeRenderBuffer _depthBuffer;
123 
124  // Were the color/depth buffer converged the last time we blitted them?
125  bool _converged;
126 
127  // A compositor utility class, for rendering the final result to the
128  // viewport.
129  HdxCompositor _compositor;
130 };
131 
132 PXR_NAMESPACE_CLOSE_SCOPE
133 
134 #endif // HDEMBREE_RENDER_PASS_H
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:119
HdEmbreeRenderPass(HdRenderIndex *index, HdRprimCollection const &collection, HdRenderThread *renderThread, HdEmbreeRenderer *renderer, std::atomic< int > *sceneVersion)
Renderpass constructor.
virtual ~HdEmbreeRenderPass()
Renderpass destructor.
An abstract class representing a single render iteration over a set of prims (the HdRprimCollection)...
Definition: renderPass.h:71
This class is a utility for rendering deep raytracer or aov output (color/depth) to the GL framebuffe...
Definition: compositor.h:47
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
HdRenderPass represents a single render iteration, rendering a view of the scene (the HdRprimCollecti...
Definition: renderPass.h:52
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:438
A named, semantic collection of objects.
virtual void _MarkCollectionDirty() override
Update internal tracking to reflect a dirty collection.
Definition: renderPass.h:88
virtual void _Execute(HdRenderPassStateSharedPtr const &renderPassState, TfTokenVector const &renderTags) override
Draw the scene with the bound renderpass state.
HdEmbreeRenderer implements a renderer on top of Embree&#39;s raycasting abilities.
Definition: renderer.h:54
virtual bool IsConverged() const override
Determine whether the sample buffer has enough samples.
HdRenderThread is a utility that specific render delegates can choose to use depending on their needs...
Definition: renderThread.h:146