HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
retainedSceneIndex.h
Go to the documentation of this file.
1 //
2 // Copyright 2021 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_RETAINED_SCENE_INDEX_H
8 #define PXR_IMAGING_HD_RETAINED_SCENE_INDEX_H
9 
10 #include "pxr/pxr.h"
11 
12 #include "pxr/usd/sdf/pathTable.h"
13 
15 
17 
20 
21 ///
22 /// \class HdRetainedSceneIndex
23 ///
24 /// Concrete scene container which can be externally populated and dirtied.
25 ///
27 {
28 public:
29 
30  /// Creates a new retained scene index.
31  HD_API
32  static HdRetainedSceneIndexRefPtr New() {
34  }
35 
36  // ------------------------------------------------------------------------
37 
39  {
42  HdContainerDataSourceHandle dataSource;
43  };
44 
45  using AddedPrimEntries = std::vector<AddedPrimEntry>;
46 
47  /// Add a prim to the retained scene index. Each added entry has a path,
48  /// type, and datasource; the retained scene index assumes ownership of
49  /// these and uses them to answer scene queries. This will also generate
50  /// a PrimsAdded notification, if applicable.
51  HD_API
52  virtual void AddPrims(const AddedPrimEntries &entries);
53 
54  /// Removes a prim subtree from the retained scene index. This will also
55  /// generate a PrimsRemoved notification, if applicable.
56  HD_API
57  virtual void RemovePrims(
59 
60  /// Invalidates prim data in the retained scene index. This scene index
61  /// doesn't have any internal invalidation mechanisms, but it generates
62  /// a PrimsDirtied notification, if applicable. Subclasses can use it for
63  /// invalidation of caches or retained data.
64  HD_API
65  virtual void DirtyPrims(
67 
68  // ------------------------------------------------------------------------
69  // HdSceneIndexBase implementations.
70 
71  HD_API
72  HdSceneIndexPrim GetPrim(const SdfPath & primPath) const override;
73 
74  HD_API
75  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
76 
77 protected:
78 
79  HD_API
81 
82 private:
83 
84  struct _PrimEntry
85  {
86  HdSceneIndexPrim prim;
87  };
88 
89  using _PrimEntryTable = SdfPathTable<_PrimEntry>;
90  _PrimEntryTable _entries;
91 
92 };
93 
95 
96 #endif // PXR_IMAGING_HD_RETAINED_SCENE_INDEX_H
TfRefPtr< T > TfCreateRefPtr(T *ptr)
Definition: refPtr.h:1190
HD_API HdRetainedSceneIndex()
virtual HD_API void RemovePrims(const HdSceneIndexObserver::RemovedPrimEntries &entries)
SdfPath primPath
#define HD_API
Definition: api.h:23
TfToken primType
std::vector< AddedPrimEntry > AddedPrimEntries
HD_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
virtual HD_API void AddPrims(const AddedPrimEntries &entries)
Definition: token.h:70
std::vector< class SdfPath > SdfPathVector
HD_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
static HD_API HdRetainedSceneIndexRefPtr New()
Creates a new retained scene index.
TF_DECLARE_REF_PTRS(HdRetainedSceneIndex)
HdContainerDataSourceHandle dataSource
Definition: path.h:273
virtual HD_API void DirtyPrims(const HdSceneIndexObserver::DirtiedPrimEntries &entries)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74