Loading...
Searching...
No Matches
mergingSceneIndex.h
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_MERGING_SCENE_H
25#define PXR_IMAGING_HD_MERGING_SCENE_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hd/filteringSceneIndex.h"
29
30PXR_NAMESPACE_OPEN_SCOPE
31
34
43{
44public:
45
46 static HdMergingSceneIndexRefPtr New() {
47 return TfCreateRefPtr(new HdMergingSceneIndex);
48 }
49
54 HD_API
56 const HdSceneIndexBaseRefPtr &inputScene,
57 const SdfPath &activeInputSceneRoot);
58
59 HD_API
60 void RemoveInputScene(const HdSceneIndexBaseRefPtr &sceneIndex);
61
63 HD_API
64 std::vector<HdSceneIndexBaseRefPtr> GetInputScenes() const override;
65
66 // satisfying HdSceneIndexBase
67 HD_API
68 HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
69
70 HD_API
71 SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
72
73protected:
74 HD_API
76
77private:
78
79 void _PrimsAdded(
80 const HdSceneIndexBase &sender,
82
83 void _PrimsRemoved(
84 const HdSceneIndexBase &sender,
86
87 void _PrimsDirtied(
88 const HdSceneIndexBase &sender,
90
91 friend class _Observer;
92
93 class _Observer : public HdSceneIndexObserver
94 {
95 public:
96 _Observer(HdMergingSceneIndex *owner)
97 : _owner(owner) {}
98
99 void PrimsAdded(
100 const HdSceneIndexBase &sender,
101 const AddedPrimEntries &entries) override;
102
103 void PrimsRemoved(
104 const HdSceneIndexBase &sender,
105 const RemovedPrimEntries &entries) override;
106
107 void PrimsDirtied(
108 const HdSceneIndexBase &sender,
109 const DirtiedPrimEntries &entries) override;
110
111 void PrimsRenamed(
112 const HdSceneIndexBase &sender,
113 const RenamedPrimEntries &entries) override;
114
115 private:
116 HdMergingSceneIndex *_owner;
117 };
118
119 _Observer _observer;
120
121 struct _InputEntry
122 {
123 HdSceneIndexBaseRefPtr sceneIndex;
124 SdfPath sceneRoot;
125
126 _InputEntry(const HdSceneIndexBaseRefPtr &sceneIndex,
127 const SdfPath &sceneRoot)
128 : sceneIndex(sceneIndex)
129 , sceneRoot(sceneRoot)
130 {
131 }
132 };
133
134 using _InputEntries = std::vector<_InputEntry>;
135
136 _InputEntries _inputs;
137};
138
139
140PXR_NAMESPACE_CLOSE_SCOPE
141
142#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:65
Observer of scene data.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:75
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:52