HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
legacyDisplayStyleOverrideSceneIndex.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_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"
13 
14 #include <optional>
15 
17 
18 namespace HdsiLegacyDisplayStyleSceneIndex_Impl
19 {
20 struct _StyleInfo;
21 using _StyleInfoSharedPtr = std::shared_ptr<_StyleInfo>;
22 }
23 
25 
26 ///
27 /// \class HdsiLegacyDisplayStyleOverrideSceneIndex
28 ///
29 /// A scene index providing override fallback values for
30 /// the legacy display style for each prim.
31 ///
32 /// This will provide fallback values only when specific
33 /// fallback values have been specified.
34 /// Otherwise the fallback will be to the schema default values.
35 ///
36 /// So far, this supports only refineLevel and cullStyle.
37 ///
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 
52  /// Sets the refineLevelFallback
53  /// (at data source locator displayStyle:refineLevel)
54  /// for every prim in the input scene inedx.
55  ///
56  /// If an empty optional value is provided, a null data source will be
57  /// returned for the data source locator.
58  ///
59  HDSI_API
60  void SetRefineLevelFallback(const std::optional<int> &refineLevelFallback);
61 
62  /// Sets the cullStyleFallback
63  /// (at data source locator displayStyle:cullStyleFallback)
64  /// for every prim in the input scene index.
65  ///
66  /// If an empty token value is provided, a null data source will be
67  /// returned for the data source locator.
68  ///
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 
92  _StyleInfoSharedPtr const _styleInfo;
93 
94  /// Prim underlay data source.
95  HdContainerDataSourceHandle const _underlayDs;
96 };
97 
99 
100 #endif //PXR_IMAGING_HDSI_LEGACY_DISPLAY_STYLE_OVERRIDE_SCENE_INDEX_H
HdsiLegacyDisplayStyleOverrideSceneIndex(const HdSceneIndexBaseRefPtr &inputSceneIndex)
void _PrimsDirtied(const HdSceneIndexBase &sender, const HdSceneIndexObserver::DirtiedPrimEntries &entries) override
void _PrimsAdded(const HdSceneIndexBase &sender, const HdSceneIndexObserver::AddedPrimEntries &entries) override
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Definition: token.h:70
std::vector< class SdfPath > SdfPathVector
HDSI_API void SetCullStyleFallback(const TfToken &cullStyleFallback)
void _PrimsRemoved(const HdSceneIndexBase &sender, const HdSceneIndexObserver::RemovedPrimEntries &entries) override
TF_DECLARE_REF_PTRS(HdsiLegacyDisplayStyleOverrideSceneIndex)
Definition: path.h:280
#define HDSI_API
Definition: api.h:23
HDSI_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HDSI_API void SetRefineLevelFallback(const std::optional< int > &refineLevelFallback)
static HDSI_API HdsiLegacyDisplayStyleOverrideSceneIndexRefPtr New(const HdSceneIndexBaseRefPtr &inputSceneIndex)