filteringSceneIndex.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_FILTERING_SCENE_INDEX_H
25 #define PXR_IMAGING_HD_FILTERING_SCENE_INDEX_H
26 
27 #include "pxr/pxr.h"
28 
29 #include <set>
30 #include <unordered_map>
31 
33 #include "pxr/base/tf/singleton.h"
34 
35 #include "pxr/usd/sdf/path.h"
36 
37 #include "pxr/imaging/hd/dataSource.h"
38 #include "pxr/imaging/hd/dataSourceLocator.h"
39 #include "pxr/imaging/hd/sceneIndex.h"
40 
41 PXR_NAMESPACE_OPEN_SCOPE
42 
44 
52 {
53 public:
54  virtual std::vector<HdSceneIndexBaseRefPtr> GetInputScenes() const = 0;
55 };
56 
57 
58 
60 
68 {
69 public:
70  HD_API
71  std::vector<HdSceneIndexBaseRefPtr> GetInputScenes() const final;
72 
73 protected:
74  HD_API
76  const HdSceneIndexBaseRefPtr &inputSceneIndex);
77 
78  virtual void _PrimsAdded(
79  const HdSceneIndexBase &sender,
80  const HdSceneIndexObserver::AddedPrimEntries &entries) = 0;
81 
82  virtual void _PrimsRemoved(
83  const HdSceneIndexBase &sender,
84  const HdSceneIndexObserver::RemovedPrimEntries &entries) = 0;
85 
86  virtual void _PrimsDirtied(
87  const HdSceneIndexBase &sender,
88  const HdSceneIndexObserver::DirtiedPrimEntries &entries) = 0;
89 
94  const HdSceneIndexBaseRefPtr &_GetInputSceneIndex() const {
95  return _inputSceneIndex;
96  }
97 
98 private:
99 
100  HdSceneIndexBaseRefPtr _inputSceneIndex;
101 
102  friend class _Observer;
103 
104  class _Observer : public HdSceneIndexObserver
105  {
106  public:
107  _Observer(HdSingleInputFilteringSceneIndexBase *owner)
108  : _owner(owner) {}
109 
110  void PrimsAdded(
111  const HdSceneIndexBase &sender,
112  const AddedPrimEntries &entries) override;
113 
114  void PrimsRemoved(
115  const HdSceneIndexBase &sender,
116  const RemovedPrimEntries &entries) override;
117 
118  void PrimsDirtied(
119  const HdSceneIndexBase &sender,
120  const DirtiedPrimEntries &entries) override;
121  private:
123  };
124 
125  _Observer _observer;
126 
127 };
128 
129 PXR_NAMESPACE_CLOSE_SCOPE
130 
131 #endif // PXR_IMAGING_HD_FILTERING_SCENE_INDEX_H
An abstract base class for a filtering scene index that observes a single input scene index.
Manage a single instance of an object.
Standard pointer typedefs.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:89
Observer of scene data.
Abstract interface to scene data.
Definition: sceneIndex.h:62
An abstract base class for scene indexes that have one or more input scene indexes which serve as a b...
const HdSceneIndexBaseRefPtr & _GetInputSceneIndex() const
Returns the input scene.