HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sceneMaterialPruningSceneIndex.h
Go to the documentation of this file.
1 //
2 // Copyright 2024 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 #ifndef PXR_IMAGING_HDSI_SCENE_MATERIAL_PRUNING_SCENE_INDEX_H
7 #define PXR_IMAGING_HDSI_SCENE_MATERIAL_PRUNING_SCENE_INDEX_H
8 
9 #include "pxr/pxr.h"
10 
12 #include "pxr/imaging/hdsi/api.h"
13 
15 
17 
18 namespace HdsiSceneMaterialPruningSceneIndex_Impl
19 {
20 
21 struct _Info;
22 using _InfoSharedPtr = std::shared_ptr<_Info>;
23 
24 }
25 
26 ///
27 /// A scene index that prunes materials and material bindings.
28 ///
29 /// The scene index can be disabled.
30 ///
31 /// If enabled, prims of type material are pruned unless the bool data
32 /// source at a specified locator return true. The locator can be specified
33 /// by giving a builtinMaterialLocator to the inputArgs when constructing
34 /// the scene index.
35 ///
36 /// Furthermore, for a prim that is not a material, the materialBindings are
37 /// pruned unless the bool data source for materialIsFinal of the
38 /// HdLegacyDisplayStyleSchema returns true.
39 ///
40 /// Note that an alternative implementation could prune a material if the
41 /// all materialBindings targeting the material have been pruned.
42 /// However, we chose here to go for a simpler implementation and require
43 /// clients to tag materials as builtin.
44 ///
47 {
48 public:
49  HDSI_API
50  static HdsiSceneMaterialPruningSceneIndexRefPtr
51  New(HdSceneIndexBaseRefPtr const &inputSceneIndex);
52 
53  /// Is scene index actually pruning?
54  HDSI_API
55  bool GetEnabled() const;
56  /// Enable scene index to prune.
57  HDSI_API
58  void SetEnabled(bool);
59 
60 public: // HdSceneIndex overrides
61  HDSI_API
62  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
63  HDSI_API
64  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
65 
66 protected: // HdSingleInputFilteringSceneIndexBase overrides
67  HDSI_API
68  void _PrimsAdded(
69  const HdSceneIndexBase &sender,
70  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
71  HDSI_API
72  void _PrimsRemoved(
73  const HdSceneIndexBase &sender,
74  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
75  HDSI_API
76  void _PrimsDirtied(
77  const HdSceneIndexBase &sender,
78  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
79 
80 private:
81  HDSI_API
83  HdSceneIndexBaseRefPtr const &inputSceneIndex);
84  HDSI_API
85  ~HdsiSceneMaterialPruningSceneIndex() override;
86 
87  void _ProcessDirtiedEntryHelper(
90 
92 };
93 
95 
96 #endif
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
static HDSI_API HdsiSceneMaterialPruningSceneIndexRefPtr New(HdSceneIndexBaseRefPtr const &inputSceneIndex)
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
HDSI_API void _PrimsDirtied(const HdSceneIndexBase &sender, const HdSceneIndexObserver::DirtiedPrimEntries &entries) override
HDSI_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
std::vector< class SdfPath > SdfPathVector
HDSI_API void _PrimsRemoved(const HdSceneIndexBase &sender, const HdSceneIndexObserver::RemovedPrimEntries &entries) override
HDSI_API bool GetEnabled() const
Is scene index actually pruning?
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(HdsiSceneMaterialPruningSceneIndex)
Definition: path.h:280
#define HDSI_API
Definition: api.h:23
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HDSI_API void _PrimsAdded(const HdSceneIndexBase &sender, const HdSceneIndexObserver::AddedPrimEntries &entries) override
HDSI_API void SetEnabled(bool)
Enable scene index to prune.