forked from wetadigital/USDPluginExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
renderDelegate.h
112 lines (83 loc) · 3.54 KB
/
renderDelegate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//
// Copyright © 2023 Weta Digital Limited
//
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <pxr/imaging/hd/renderDelegate.h>
#include <pxr/imaging/hd/resourceRegistry.h>
PXR_NAMESPACE_OPEN_SCOPE
class HdTriRenderParam;
/// \class HdTriRenderDelegate
///
/// Hydra renderer interface for the tri renderer.
class HdTriRenderDelegate final : public HdRenderDelegate
{
public:
/// Default constructor.
HdTriRenderDelegate();
/// Constructor with render settings.
HdTriRenderDelegate(const HdRenderSettingsMap& settingsMap);
/// Destrucutor.
virtual ~HdTriRenderDelegate() override;
/// Cannot copy.
HdTriRenderDelegate(const HdTriRenderDelegate&) = delete;
HdTriRenderDelegate& operator=(const HdTriRenderDelegate&) = delete;
/// Query supported hydra prim types.
virtual const TfTokenVector& GetSupportedRprimTypes() const override;
virtual const TfTokenVector& GetSupportedSprimTypes() const override;
virtual const TfTokenVector& GetSupportedBprimTypes() const override;
/// Return this delegate's render param, which provides top-level scene
/// state.
/// \return An instance of HdEmbreeRenderParam.
virtual HdRenderParam* GetRenderParam() const override;
/// Returns a list of user-configurable render settings, available in the
/// UI.
virtual HdRenderSettingDescriptorList GetRenderSettingDescriptors()
const override;
/// Get the resource registry.
virtual HdResourceRegistrySharedPtr GetResourceRegistry() const override;
/// Create render pass.
virtual HdRenderPassSharedPtr CreateRenderPass(
HdRenderIndex* index,
const HdRprimCollection& collection) override;
/// Create an instancer.
virtual HdInstancer* CreateInstancer(HdSceneDelegate* delegate,
const SdfPath& id) override;
/// Destroy an instancer.
virtual void DestroyInstancer(HdInstancer* instancer) override;
/// Create a new Rprim.
virtual HdRprim* CreateRprim(const TfToken& typeId,
const SdfPath& rprimId) override;
virtual void DestroyRprim(HdRprim* rprim) override;
/// Create a new Sprim.
virtual HdSprim* CreateSprim(const TfToken& typeId,
const SdfPath& sprimId) override;
/// TODO.
virtual HdSprim* CreateFallbackSprim(const TfToken& typeId) override;
/// Destroy an existing Sprim.
virtual void DestroySprim(HdSprim* sprim) override;
/// Create a new buffer prim.
virtual HdBprim* CreateBprim(const TfToken& typeId,
const SdfPath& bprimId) override;
/// Create a fallback buffer prim.
virtual HdBprim* CreateFallbackBprim(const TfToken& typeId) override;
/// Destroy an existing Bprim.
virtual void DestroyBprim(HdBprim* bprim) override;
/// Do work.
virtual void CommitResources(HdChangeTracker* tracker) override;
/// Return the AOV description for \param aovName.
/// This will be used to initialize the aov buffers.
virtual HdAovDescriptor GetDefaultAovDescriptor(
const TfToken& aovName) const override;
private:
// Setup routine (used in both constructors).
void _Setup();
static const TfTokenVector SUPPORTED_RPRIM_TYPES;
static const TfTokenVector SUPPORTED_SPRIM_TYPES;
static const TfTokenVector SUPPORTED_BPRIM_TYPES;
std::unique_ptr<HdTriRenderParam> _renderParam;
HdRenderSettingDescriptorList _settingDescriptors;
HdResourceRegistrySharedPtr _resourceRegistry;
};
PXR_NAMESPACE_CLOSE_SCOPE