All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
37 HD_API
39 const HdSceneIndexBaseRefPtr &inputScene,
40 const SdfPath &activeInputSceneRoot);
41
42 HD_API
43 void RemoveInputScene(const HdSceneIndexBaseRefPtr &sceneIndex);
44
46 HD_API
47 std::vector<HdSceneIndexBaseRefPtr> GetInputScenes() const override;
48
49 // satisfying HdSceneIndexBase
50 HD_API
51 HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
52
53 HD_API
54 SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
55
56protected:
57 HD_API
59
60private:
61
62 void _PrimsAdded(
63 const HdSceneIndexBase &sender,
65
66 void _PrimsRemoved(
67 const HdSceneIndexBase &sender,
69
70 void _PrimsDirtied(
71 const HdSceneIndexBase &sender,
73
74 friend class _Observer;
75
76 class _Observer : public HdSceneIndexObserver
77 {
78 public:
79 _Observer(HdMergingSceneIndex *owner)
80 : _owner(owner) {}
81
82 void PrimsAdded(
83 const HdSceneIndexBase &sender,
84 const AddedPrimEntries &entries) override;
85
86 void PrimsRemoved(
87 const HdSceneIndexBase &sender,
88 const RemovedPrimEntries &entries) override;
89
90 void PrimsDirtied(
91 const HdSceneIndexBase &sender,
92 const DirtiedPrimEntries &entries) override;
93
94 void PrimsRenamed(
95 const HdSceneIndexBase &sender,
96 const RenamedPrimEntries &entries) override;
97
98 private:
99 HdMergingSceneIndex *_owner;
100 };
101
102 _Observer _observer;
103
104 struct _InputEntry
105 {
106 HdSceneIndexBaseRefPtr sceneIndex;
107 SdfPath sceneRoot;
108
109 _InputEntry(const HdSceneIndexBaseRefPtr &sceneIndex,
110 const SdfPath &sceneRoot)
111 : sceneIndex(sceneIndex)
112 , sceneRoot(sceneRoot)
113 {
114 }
115 };
116
117 using _InputEntries = std::vector<_InputEntry>;
118
119 _InputEntries _inputs;
120};
121
122
123PXR_NAMESPACE_CLOSE_SCOPE
124
125#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