Loading...
Searching...
No Matches
instancer.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_HD_INSTANCER_H
8#define PXR_IMAGING_HD_INSTANCER_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/version.h"
13#include "pxr/imaging/hd/types.h"
14
15#include "pxr/usd/sdf/path.h"
16
17#include <mutex>
18
19PXR_NAMESPACE_OPEN_SCOPE
20
21class HdSceneDelegate;
22class HdRenderIndex;
23class HdRprim;
24class HdRenderParam;
25
107
109public:
111 HD_API
112 HdInstancer(HdSceneDelegate* delegate, SdfPath const& id);
113
114 HD_API
115 virtual ~HdInstancer();
116
118 SdfPath const& GetId() const { return _id; }
119
121 SdfPath const& GetParentId() const { return _parentId; }
122
123 HdSceneDelegate* GetDelegate() const { return _delegate; }
124
125 HD_API
126 static int GetInstancerNumLevels(HdRenderIndex& index,
127 HdRprim const& rprim);
128
129 HD_API
130 static TfTokenVector const & GetBuiltinPrimvarNames();
131
132 HD_API
133 virtual void Sync(HdSceneDelegate *sceneDelegate,
134 HdRenderParam *renderParam,
135 HdDirtyBits *dirtyBits);
136
137 HD_API
138 virtual void Finalize(HdRenderParam *renderParam);
139
140 HD_API
141 virtual HdDirtyBits GetInitialDirtyBitsMask() const;
142
143 HD_API
144 static void _SyncInstancerAndParents(
145 HdRenderIndex &renderIndex,
146 SdfPath const& instancerId);
147
148protected:
149 HD_API
150 void _UpdateInstancer(HdSceneDelegate *delegate,
151 HdDirtyBits *dirtyBits);
152
153private:
154 HdSceneDelegate* _delegate;
155 SdfPath _id;
156 SdfPath _parentId;
157
158 // XXX: This mutex exists for _SyncInstancerAndParents, which will go
159 // away when the render index calls sync on instancers.
160 std::mutex _instanceLock;
161};
162
163
164PXR_NAMESPACE_CLOSE_SCOPE
165
166#endif // PXR_IMAGING_HD_INSTANCER_H
This class exists to facilitate point cloud style instancing.
Definition instancer.h:108
SdfPath const & GetParentId() const
Returns the parent instancer identifier.
Definition instancer.h:121
SdfPath const & GetId() const
Returns the identifier.
Definition instancer.h:118
HD_API HdInstancer(HdSceneDelegate *delegate, SdfPath const &id)
Constructor.
The render index is part of the Hydra 1.0 API and is only used for emulation purposes so that HdScene...
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
The render engine state for a given rprim from the scene graph.
Definition rprim.h:38
Adapter class providing data exchange with the client scene graph.
A path value used to locate objects in layers or scenegraphs.
Definition path.h:281
std::vector< TfToken > TfTokenVector
Convenience types.
Definition token.h:440