7#ifndef PXR_IMAGING_HD_PRIM_TYPE_INDEX_H
8#define PXR_IMAGING_HD_PRIM_TYPE_INDEX_H
11#include "pxr/imaging/hd/types.h"
12#include "pxr/imaging/hd/sortedIds.h"
14#include "pxr/usd/sdf/path.h"
18#include <unordered_map>
20PXR_NAMESPACE_OPEN_SCOPE
23class HdRenderDelegate;
27using HdSceneDelegatePtrVector = std::vector<HdSceneDelegate*>;
32template <
class PrimType>
33class Hd_PrimTypeIndex {
62 void InsertPrim(
const TfToken &typeId,
66 HdRenderDelegate *renderDelegate);
73 void RemovePrim(
const TfToken &typeId,
76 HdRenderDelegate *renderDelegate);
85 void RemoveSubtree(
const SdfPath &root,
88 HdRenderDelegate *renderDelegate);
93 PrimType *GetPrim(
const TfToken &typeId,
104 PrimType *GetFallbackPrim(
TfToken const &typeId)
const;
112 void GetPrimSubtree(
const TfToken &typeId,
114 SdfPathVector *outPaths);
124 bool CreateFallbackPrims(HdRenderDelegate *renderDelegate);
131 void DestroyFallbackPrims(HdRenderDelegate *renderDelegate);
142 HdRenderDelegate *renderDelegate);
146 const HdSceneDelegatePtrVector& GetSceneDelegatesForDirtyPrims();
154 typedef std::unordered_map<SdfPath, _PrimInfo, SdfPath::Hash> _PrimMap;
156 struct _PrimTypeEntry
159 Hd_SortedIds primIds;
160 PrimType *fallbackPrim;
165 , fallbackPrim(nullptr)
170 typedef std::unordered_map<TfToken, size_t, TfToken::HashFunctor> _TypeIndex;
172 typedef std::vector<_PrimTypeEntry> _PrimTypeList;
174 _PrimTypeList _entries;
176 HdSceneDelegatePtrVector _dirtyPrimDelegates;
184 HdDirtyBits initialDirtyState);
194 HdDirtyBits dirtyBits);
196 static PrimType *_RenderDelegateCreatePrim(HdRenderDelegate *renderDelegate,
199 static PrimType *_RenderDelegateCreateFallbackPrim(
200 HdRenderDelegate *renderDelegate,
203 static void _RenderDelegateDestroyPrim(HdRenderDelegate *renderDelegate,
207 Hd_PrimTypeIndex(
const Hd_PrimTypeIndex &) =
delete;
208 Hd_PrimTypeIndex &operator =(
const Hd_PrimTypeIndex &) =
delete;
211PXR_NAMESPACE_CLOSE_SCOPE
Tracks changes from the HdSceneDelegate, providing invalidation cues to the render engine.
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
Adapter class providing data exchange with the client scene graph.
A path value used to locate objects in layers or scenegraphs.
Token for efficient comparison, assignment, and hashing of known strings.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.