Loading...
Searching...
No Matches
mergingSceneIndex.h
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_MERGING_SCENE_H
8#define PXR_IMAGING_HD_MERGING_SCENE_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/filteringSceneIndex.h"
12
13PXR_NAMESPACE_OPEN_SCOPE
14
17
26{
27public:
28
29 static HdMergingSceneIndexRefPtr New() {
30 return TfCreateRefPtr(new HdMergingSceneIndex);
31 }
32
40 HD_API
42 const HdSceneIndexBaseRefPtr &inputScene,
43 const SdfPath &activeInputSceneRoot);
44
45 HD_API
46 void InsertInputScene(
47 const size_t pos,
48 const HdSceneIndexBaseRefPtr &inputScene,
49 const SdfPath &activeInputSceneRoot);
50
51 HD_API
52 void RemoveInputScene(const HdSceneIndexBaseRefPtr &sceneIndex);
53
55 HD_API
56 std::vector<HdSceneIndexBaseRefPtr> GetInputScenes() const override;
57
58 // satisfying HdSceneIndexBase
59 HD_API
60 HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
61
62 HD_API
63 SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
64
65protected:
66 HD_API
68
69private:
70
71 void _PrimsAdded(
72 const HdSceneIndexBase &sender,
74
75 void _PrimsRemoved(
76 const HdSceneIndexBase &sender,
78
79 void _PrimsDirtied(
80 const HdSceneIndexBase &sender,
82
83 friend class _Observer;
84
85 class _Observer : public HdSceneIndexObserver
86 {
87 public:
88 _Observer(HdMergingSceneIndex *owner)
89 : _owner(owner) {}
90
91 void PrimsAdded(
92 const HdSceneIndexBase &sender,
93 const AddedPrimEntries &entries) override;
94
95 void PrimsRemoved(
96 const HdSceneIndexBase &sender,
97 const RemovedPrimEntries &entries) override;
98
99 void PrimsDirtied(
100 const HdSceneIndexBase &sender,
101 const DirtiedPrimEntries &entries) override;
102
103 void PrimsRenamed(
104 const HdSceneIndexBase &sender,
105 const RenamedPrimEntries &entries) override;
106
107 private:
108 HdMergingSceneIndex *_owner;
109 };
110
111 _Observer _observer;
112
113 struct _InputEntry
114 {
115 HdSceneIndexBaseRefPtr sceneIndex;
116 SdfPath sceneRoot;
117
118 _InputEntry(const HdSceneIndexBaseRefPtr &sceneIndex,
119 const SdfPath &sceneRoot)
120 : sceneIndex(sceneIndex)
121 , sceneRoot(sceneRoot)
122 {
123 }
124 };
125
126 using _InputEntries = std::vector<_InputEntry>;
127
128 _InputEntries _inputs;
129};
130
131
132PXR_NAMESPACE_CLOSE_SCOPE
133
134#endif //PXR_IMAGING_HD_MERGING_SCENE_H
An abstract base class for scene indexes that have one or more input scene indexes which serve as a b...
Merges multiple scenes together.
HD_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Returns a pair of (prim type, datasource) for the object at primPath.
HD_API std::vector< HdSceneIndexBaseRefPtr > GetInputScenes() const override
satisfying HdFilteringSceneIndex
HD_API void AddInputScene(const HdSceneIndexBaseRefPtr &inputScene, const SdfPath &activeInputSceneRoot)
Adds a scene with activeInputSceneRoot specifying the shallowest path at which prims should be consid...
HD_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
Returns the paths of all scene index prims located immediately below primPath.
Abstract interface to scene data.
Definition: sceneIndex.h:48
Observer of scene data.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35