24#ifndef PXR_IMAGING_HD_PRIM_TYPE_INDEX_H
25#define PXR_IMAGING_HD_PRIM_TYPE_INDEX_H
28#include "pxr/imaging/hd/types.h"
29#include "pxr/imaging/hd/sortedIds.h"
31#include "pxr/usd/sdf/path.h"
35#include <unordered_map>
37PXR_NAMESPACE_OPEN_SCOPE
40class HdRenderDelegate;
44using HdSceneDelegatePtrVector = std::vector<HdSceneDelegate*>;
49template <
class PrimType>
50class Hd_PrimTypeIndex {
79 void InsertPrim(
const TfToken &typeId,
83 HdRenderDelegate *renderDelegate);
90 void RemovePrim(
const TfToken &typeId,
93 HdRenderDelegate *renderDelegate);
102 void RemoveSubtree(
const SdfPath &root,
105 HdRenderDelegate *renderDelegate);
110 PrimType *GetPrim(
const TfToken &typeId,
121 PrimType *GetFallbackPrim(
TfToken const &typeId)
const;
129 void GetPrimSubtree(
const TfToken &typeId,
131 SdfPathVector *outPaths);
141 bool CreateFallbackPrims(HdRenderDelegate *renderDelegate);
148 void DestroyFallbackPrims(HdRenderDelegate *renderDelegate);
159 HdRenderDelegate *renderDelegate);
163 const HdSceneDelegatePtrVector& GetSceneDelegatesForDirtyPrims();
171 typedef std::unordered_map<SdfPath, _PrimInfo, SdfPath::Hash> _PrimMap;
173 struct _PrimTypeEntry
176 Hd_SortedIds primIds;
177 PrimType *fallbackPrim;
182 , fallbackPrim(nullptr)
187 typedef std::unordered_map<TfToken, size_t, TfToken::HashFunctor> _TypeIndex;
189 typedef std::vector<_PrimTypeEntry> _PrimTypeList;
191 _PrimTypeList _entries;
193 HdSceneDelegatePtrVector _dirtyPrimDelegates;
201 HdDirtyBits initialDirtyState);
211 HdDirtyBits dirtyBits);
213 static PrimType *_RenderDelegateCreatePrim(HdRenderDelegate *renderDelegate,
216 static PrimType *_RenderDelegateCreateFallbackPrim(
217 HdRenderDelegate *renderDelegate,
220 static void _RenderDelegateDestroyPrim(HdRenderDelegate *renderDelegate,
224 Hd_PrimTypeIndex(
const Hd_PrimTypeIndex &) =
delete;
225 Hd_PrimTypeIndex &operator =(
const Hd_PrimTypeIndex &) =
delete;
228PXR_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.