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 Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_IMAGING_HD_RETAINED_SCENE_INDEX_H
25 #define PXR_IMAGING_HD_RETAINED_SCENE_INDEX_H
26 
27 #include "pxr/pxr.h"
28 
29 #include "pxr/usd/sdf/pathTable.h"
30 
32 
34 
37 
38 ///
39 /// \class HdRetainedSceneIndex
40 ///
41 /// Concrete scene container which can be externally populated and dirtied.
42 ///
44 {
45 public:
46 
47  /// Creates a new retained scene index.
48  HD_API
49  static HdRetainedSceneIndexRefPtr New() {
51  }
52 
53  // ------------------------------------------------------------------------
54 
56  {
59  HdContainerDataSourceHandle dataSource;
60  };
61 
62  using AddedPrimEntries = std::vector<AddedPrimEntry>;
63 
64  /// Add a prim to the retained scene index. Each added entry has a path,
65  /// type, and datasource; the retained scene index assumes ownership of
66  /// these and uses them to answer scene queries. This will also generate
67  /// a PrimsAdded notification, if applicable.
68  HD_API
69  virtual void AddPrims(const AddedPrimEntries &entries);
70 
71  /// Removes a prim subtree from the retained scene index. This will also
72  /// generate a PrimsRemoved notification, if applicable.
73  HD_API
74  virtual void RemovePrims(
76 
77  /// Invalidates prim data in the retained scene index. This scene index
78  /// doesn't have any internal invalidation mechanisms, but it generates
79  /// a PrimsDirtied notification, if applicable. Subclasses can use it for
80  /// invalidation of caches or retained data.
81  HD_API
82  virtual void DirtyPrims(
84 
85  // ------------------------------------------------------------------------
86  // HdSceneIndexBase implementations.
87 
88  HD_API
89  HdSceneIndexPrim GetPrim(const SdfPath & primPath) const override;
90 
91  HD_API
92  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
93 
94 protected:
95 
96  HD_API
98 
99 private:
100 
101  struct _PrimEntry
102  {
103  HdSceneIndexPrim prim;
104  };
105 
106  using _PrimEntryTable = SdfPathTable<_PrimEntry>;
107  _PrimEntryTable _entries;
108 
109 };
110 
112 
113 #endif // PXR_IMAGING_HD_RETAINED_SCENE_INDEX_H
TfRefPtr< T > TfCreateRefPtr(T *ptr)
Definition: refPtr.h:1198
HD_API HdRetainedSceneIndex()
virtual HD_API void RemovePrims(const HdSceneIndexObserver::RemovedPrimEntries &entries)
SdfPath primPath
#define HD_API
Definition: api.h:40
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:87
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:291
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
Definition: path.h:212
virtual HD_API void DirtyPrims(const HdSceneIndexObserver::DirtiedPrimEntries &entries)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91