HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderSettingsFilteringSceneIndex.h
Go to the documentation of this file.
1 //
2 // Copyright 2023 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_HDSI_RENDER_SETTINGS_FILTERING_SCENE_INDEX_H
8 #define PXR_IMAGING_HDSI_RENDER_SETTINGS_FILTERING_SCENE_INDEX_H
9 
10 #include "pxr/imaging/hdsi/api.h"
12 
13 #include "pxr/base/vt/array.h"
15 #include "pxr/base/tf/token.h"
16 
18 
19 #define HDSI_RENDER_SETTINGS_FILTERING_SCENE_INDEX_TOKENS \
20  (namespacePrefixes) \
21  (fallbackPrimDs)
22 
23 TF_DECLARE_PUBLIC_TOKENS(HdsiRenderSettingsFilteringSceneIndexTokens, HDSI_API,
25 
27 
28 /// Scene index that provides the following functionality in service of the
29 /// HdRenderSettingsSchema:
30 /// - Filters the namespacedSettings based on the array of input prefixes
31 /// (provided via the \p inputArgs constructor argument) that
32 /// are relevant to the renderer. An empty array implies no filtering.
33 /// - Provides the computed opinion for the 'active' and 'shutterInterval'
34 /// fields.
35 /// - Registers dependencies to invalidate the 'active' and 'shutterInterval'
36 /// locators.
37 /// - Optionally adds a fallback render settings prim whose container data
38 /// source is provided via the \p inputArgs constructor argument.
39 ///
42 {
43 public:
44  HDSI_API
45  static HdsiRenderSettingsFilteringSceneIndexRefPtr
46  New(const HdSceneIndexBaseRefPtr &inputSceneIndex,
47  const HdContainerDataSourceHandle &inputArgs);
48 
49  HDSI_API
50  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
51 
52  HDSI_API
53  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
54 
55  /// Public API
56  HDSI_API
57  static const SdfPath& GetFallbackPrimPath();
58 
59  HDSI_API
60  static const SdfPath& GetRenderScope();
61 
62 protected:
63  HDSI_API
65  const HdSceneIndexBaseRefPtr &inputSceneIndex,
66  const HdContainerDataSourceHandle &inputArgs);
67 
68  /// Satisfying HdSingleInputFilteringSceneIndexBase
69  HDSI_API
70  void _PrimsAdded(
71  const HdSceneIndexBase &sender,
72  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
73 
74  HDSI_API
75  void _PrimsRemoved(
76  const HdSceneIndexBase &sender,
77  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
78 
79  HDSI_API
80  void _PrimsDirtied(
81  const HdSceneIndexBase &sender,
82  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
83 
84 private:
85  const VtArray<TfToken> _namespacePrefixes;
86  HdContainerDataSourceHandle _fallbackPrimDs;
87  bool _addedFallbackPrim;
88 };
89 
91 
92 #endif //PXR_IMAGING_HDSI_RENDER_SETTINGS_FILTERING_SCENE_INDEX_H
HDSI_API void _PrimsRemoved(const HdSceneIndexBase &sender, const HdSceneIndexObserver::RemovedPrimEntries &entries) override
HDSI_API void _PrimsAdded(const HdSceneIndexBase &sender, const HdSceneIndexObserver::AddedPrimEntries &entries) override
Satisfying HdSingleInputFilteringSceneIndexBase.
#define HDSI_RENDER_SETTINGS_FILTERING_SCENE_INDEX_TOKENS
HDSI_API HdsiRenderSettingsFilteringSceneIndex(const HdSceneIndexBaseRefPtr &inputSceneIndex, const HdContainerDataSourceHandle &inputArgs)
TF_DECLARE_WEAK_AND_REF_PTRS(HdsiRenderSettingsFilteringSceneIndex)
HDSI_API void _PrimsDirtied(const HdSceneIndexBase &sender, const HdSceneIndexObserver::DirtiedPrimEntries &entries) override
static HDSI_API HdsiRenderSettingsFilteringSceneIndexRefPtr New(const HdSceneIndexBaseRefPtr &inputSceneIndex, const HdContainerDataSourceHandle &inputArgs)
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
TF_DECLARE_PUBLIC_TOKENS(HdsiRenderSettingsFilteringSceneIndexTokens, HDSI_API, HDSI_RENDER_SETTINGS_FILTERING_SCENE_INDEX_TOKENS)
std::vector< class SdfPath > SdfPathVector
Definition: path.h:273
#define HDSI_API
Definition: api.h:23
static HDSI_API const SdfPath & GetRenderScope()
HDSI_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static HDSI_API const SdfPath & GetFallbackPrimPath()
Public API.