legacyDisplayStyleOverrideSceneIndex.h
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_LEGACY_DISPLAY_STYLE_OVERRIDE_SCENE_INDEX_H
8 #define PXR_IMAGING_HDSI_LEGACY_DISPLAY_STYLE_OVERRIDE_SCENE_INDEX_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hdsi/api.h"
12 #include "pxr/imaging/hd/filteringSceneIndex.h"
13 
14 #include <optional>
15 
16 PXR_NAMESPACE_OPEN_SCOPE
17 
18 namespace HdsiLegacyDisplayStyleSceneIndex_Impl
19 {
20 struct _StyleInfo;
21 using _StyleInfoSharedPtr = std::shared_ptr<_StyleInfo>;
22 }
23 
25 
40 {
41 public:
42  HDSI_API
43  static HdsiLegacyDisplayStyleOverrideSceneIndexRefPtr
44  New(const HdSceneIndexBaseRefPtr &inputSceneIndex);
45 
46  HDSI_API
47  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
48 
49  HDSI_API
50  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
51 
59  HDSI_API
60  void SetRefineLevelFallback(const std::optional<int> &refineLevelFallback);
61 
69  HDSI_API
70  void SetCullStyleFallback(const TfToken &cullStyleFallback);
71 
72 protected:
74  const HdSceneIndexBaseRefPtr &inputSceneIndex);
75 
76  void _PrimsAdded(
77  const HdSceneIndexBase &sender,
78  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
79 
80  void _PrimsRemoved(
81  const HdSceneIndexBase &sender,
82  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
83 
84  void _PrimsDirtied(
85  const HdSceneIndexBase &sender,
86  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
87 
88 private:
89  void _DirtyAllPrims(const HdDataSourceLocatorSet &locators);
90 
91  HdsiLegacyDisplayStyleSceneIndex_Impl::
92  _StyleInfoSharedPtr const _styleInfo;
93 
95  HdContainerDataSourceHandle const _underlayDs;
96 };
97 
98 PXR_NAMESPACE_CLOSE_SCOPE
99 
100 #endif //PXR_IMAGING_HDSI_LEGACY_DISPLAY_STYLE_OVERRIDE_SCENE_INDEX_H
An abstract base class for a filtering scene index that observes a single input scene index.
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Returns a pair of (prim type, datasource).
HDSI_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
Returns the paths of all scene index prims located immediately below primPath.
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:80
A scene index providing override fallback values for the legacy display style for each prim.
Abstract interface to scene data.
Definition: sceneIndex.h:54
Represents a set of data source locators closed under descendancy.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:280
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58
HDSI_API void SetRefineLevelFallback(const std::optional< int > &refineLevelFallback)
Sets the refineLevelFallback (at data source locator displayStyle:refineLevel) for every prim in the ...
HDSI_API void SetCullStyleFallback(const TfToken &cullStyleFallback)
Sets the cullStyleFallback (at data source locator displayStyle:cullStyleFallback) for every prim in ...