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 
15 
16 namespace HdsiLegacyDisplayStyleSceneIndex_Impl
17 {
18 struct _StyleInfo;
19 using _StyleInfoSharedPtr = std::shared_ptr<_StyleInfo>;
20 }
21 
23 
24 ///
25 /// \class HdsiLegacyDisplayStyleOverrideSceneIndex
26 ///
27 /// A scene index overriding the legacy display style for each prim.
28 /// So far, it only supports the refine level and cull style.
29 ///
32 {
33 public:
34  HDSI_API
35  static HdsiLegacyDisplayStyleOverrideSceneIndexRefPtr
36  New(const HdSceneIndexBaseRefPtr &inputSceneIndex);
37 
38  HDSI_API
39  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
40 
41  HDSI_API
42  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
43 
44  /// A replacement for std::optional<int> that is not available until C++17.
45  struct OptionalInt
46  {
47  bool hasValue = false;
48  int value = 0;
49 
50  operator bool() const { return hasValue; }
51  int operator*() const { return value; }
52  };
53 
54  /// Sets the refine level (at data source locator displayStyle:refineLevel)
55  /// for every prim in the input scene inedx.
56  ///
57  /// If an empty optional value is provided, a null data source will be
58  /// returned for the data source locator.
59  ///
60  HDSI_API
61  void SetRefineLevel(const OptionalInt &refineLevel);
62 
63  /// Sets the cullStyleFallback (at data source locator displayStyle:cullStyleFallback)
64  /// for every prim in the input scene index.
65  ///
66  HDSI_API
67  void SetCullStyleFallback(const TfToken &cullStyleFallback);
68 
69 protected:
71  const HdSceneIndexBaseRefPtr &inputSceneIndex);
72 
73  void _PrimsAdded(
74  const HdSceneIndexBase &sender,
75  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
76 
77  void _PrimsRemoved(
78  const HdSceneIndexBase &sender,
79  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
80 
81  void _PrimsDirtied(
82  const HdSceneIndexBase &sender,
83  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
84 
85 private:
86  void _DirtyAllPrims(const HdDataSourceLocatorSet &locators);
87 
89  _StyleInfoSharedPtr const _styleInfo;
90 
91  /// Prim overlaj & underlay data sources.
92  HdContainerDataSourceHandle const _overlayDs;
93  HdContainerDataSourceHandle const _underlayDs;
94 };
95 
97 bool operator==(
100 
101 HDSI_API
102 bool operator!=(
105 
107 
108 #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
GLsizei const GLfloat * value
Definition: glcorearb.h:824
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
OutGridT const XformOp bool bool
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
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:556
TF_DECLARE_REF_PTRS(HdsiLegacyDisplayStyleOverrideSceneIndex)
HDSI_API void SetRefineLevel(const OptionalInt &refineLevel)
Definition: path.h:273
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
#define HDSI_API
Definition: api.h:23
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 HdsiLegacyDisplayStyleOverrideSceneIndexRefPtr New(const HdSceneIndexBaseRefPtr &inputSceneIndex)
A replacement for std::optional<int> that is not available until C++17.
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:542