All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
renderPass.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_PLUGIN_HD_EMBREE_RENDER_PASS_H
8#define PXR_IMAGING_PLUGIN_HD_EMBREE_RENDER_PASS_H
9
10#include "pxr/pxr.h"
11
12#include "pxr/imaging/hd/aov.h"
13#include "pxr/imaging/hd/renderPass.h"
14#include "pxr/imaging/hd/renderThread.h"
15#include "pxr/imaging/plugin/hdEmbree/renderer.h"
16#include "pxr/imaging/plugin/hdEmbree/renderBuffer.h"
17
19#include "pxr/base/gf/rect2i.h"
20
21#include <atomic>
22
23PXR_NAMESPACE_OPEN_SCOPE
24
33class HdEmbreeRenderPass final : public HdRenderPass
34{
35public:
42 HdRprimCollection const &collection,
43 HdRenderThread *renderThread,
44 HdEmbreeRenderer *renderer,
45 std::atomic<int> *sceneVersion);
46
49
50 // -----------------------------------------------------------------------
51 // HdRenderPass API
52
55 bool IsConverged() const override;
56
57protected:
58
59 // -----------------------------------------------------------------------
60 // HdRenderPass API
61
66 void _Execute(HdRenderPassStateSharedPtr const& renderPassState,
67 TfTokenVector const &renderTags) override;
68
70 void _MarkCollectionDirty() override {}
71
72private:
73 // A handle to the render thread.
74 HdRenderThread *_renderThread;
75
76 // A handle to the global renderer.
77 HdEmbreeRenderer *_renderer;
78
79 // A reference to the global scene version.
80 std::atomic<int> *_sceneVersion;
81
82 // The last scene version we rendered with.
83 int _lastSceneVersion;
84
85 // The last settings version we rendered with.
86 int _lastSettingsVersion;
87
88 // The pixels written to. Like viewport in OpenGL,
89 // but coordinates are y-Down.
90 GfRect2i _dataWindow;
91
92 // The view matrix: world space to camera space
93 GfMatrix4d _viewMatrix;
94 // The projection matrix: camera space to NDC space (with
95 // respect to the data window).
96 GfMatrix4d _projMatrix;
97
98 // The list of aov buffers this renderpass should write to.
99 HdRenderPassAovBindingVector _aovBindings;
100
101 // If no attachments are provided, provide an anonymous renderbuffer for
102 // color and depth output.
103 HdEmbreeRenderBuffer _colorBuffer;
104 HdEmbreeRenderBuffer _depthBuffer;
105
106 // Were the color/depth buffer converged the last time we blitted them?
107 bool _converged;
108};
109
110PXR_NAMESPACE_CLOSE_SCOPE
111
112#endif // PXR_IMAGING_PLUGIN_HD_EMBREE_RENDER_PASS_H
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:71
A 2D rectangle with integer coordinates.
Definition: rect2i.h:43
HdRenderPass represents a single render iteration, rendering a view of the scene (the HdRprimCollecti...
Definition: renderPass.h:34
HdEmbreeRenderPass(HdRenderIndex *index, HdRprimCollection const &collection, HdRenderThread *renderThread, HdEmbreeRenderer *renderer, std::atomic< int > *sceneVersion)
Renderpass constructor.
void _MarkCollectionDirty() override
Update internal tracking to reflect a dirty collection.
Definition: renderPass.h:70
bool IsConverged() const override
Determine whether the sample buffer has enough samples.
~HdEmbreeRenderPass() override
Renderpass destructor.
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's raycasting abilities.
Definition: renderer.h:38
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:104
An abstract class representing a single render iteration over a set of prims (the HdRprimCollection),...
Definition: renderPass.h:53
HdRenderThread is a utility that specific render delegates can choose to use depending on their needs...
Definition: renderThread.h:129
A named, semantic collection of objects.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440