HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
imageShader.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_HD_IMAGE_SHADER_H
8 #define PXR_IMAGING_HD_IMAGE_SHADER_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
13 #include "pxr/imaging/hd/sprim.h"
14 #include "pxr/imaging/hd/version.h"
15 
17 #include "pxr/base/vt/dictionary.h"
18 
20 
21 #define HD_IMAGE_SHADER_TOKENS \
22  (enabled) \
23  (priority) \
24  (filePath) \
25  (constants) \
26  (materialNetwork)
27 
29 
30 class HdSceneDelegate;
31 
33  std::unique_ptr<class HdMaterialNetworkInterface>;
34 
35 /// \class HdImageShader
36 ///
37 /// An image shader.
38 ///
39 class HdImageShader : public HdSprim
40 {
41 public:
42  HD_API
43  HdImageShader(SdfPath const & id);
44  HD_API
45  ~HdImageShader() override;
46 
47  // Change tracking for HdImageShader
49  Clean = 0,
50  DirtyEnabled = 1 << 0,
51  DirtyPriority = 1 << 1,
52  DirtyFilePath = 1 << 2,
53  DirtyConstants = 1 << 3,
55 
61  };
62 
63  // ---------------------------------------------------------------------- //
64  /// Sprim API
65  // ---------------------------------------------------------------------- //
66 
67  /// Synchronizes state from the delegate to this object.
68  HD_API
69  void Sync(
70  HdSceneDelegate* sceneDelegate,
71  HdRenderParam* renderParam,
72  HdDirtyBits* dirtyBits) override;
73 
74  /// Returns the minimal set of dirty bits to place in the
75  /// change tracker for use in the first sync of this prim.
76  /// Typically this would be all dirty bits.
77  HD_API
78  HdDirtyBits GetInitialDirtyBitsMask() const override;
79 
80  // ---------------------------------------------------------------------- //
81  /// Image shader parameters accessor API
82  // ---------------------------------------------------------------------- //
83  HD_API
84  bool GetEnabled() const;
85 
86  HD_API
87  int GetPriority() const;
88 
89  HD_API
90  const std::string& GetFilePath() const;
91 
92  HD_API
93  const VtDictionary& GetConstants() const;
94 
95  HD_API
97 
98 private:
99  bool _enabled;
100  int _priority;
101  std::string _filePath;
102  VtDictionary _constants;
103  HdMaterialNetwork2 _materialNetwork;
104  HdMaterialNetworkInterfaceUniquePtr _materialNetworkInterface;
105 };
106 
108 
109 #endif // PXR_IMAGING_HD_IMAGE_SHADER_H
HD_API const VtDictionary & GetConstants() const
HD_API bool GetEnabled() const
Image shader parameters accessor API.
HD_API HdImageShader(SdfPath const &id)
uint32_t HdDirtyBits
Definition: types.h:143
#define HD_API
Definition: api.h:23
HD_API const std::string & GetFilePath() const
HD_API int GetPriority() const
#define HD_IMAGE_SHADER_TOKENS
Definition: imageShader.h:21
HD_API ~HdImageShader() override
HD_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Sprim API.
Definition: path.h:273
Definition: sprim.h:34
std::unique_ptr< class HdMaterialNetworkInterface > HdMaterialNetworkInterfaceUniquePtr
Definition: imageShader.h:33
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API const HdMaterialNetworkInterface * GetMaterialNetwork() const
HD_API HdDirtyBits GetInitialDirtyBitsMask() const override
TF_DECLARE_PUBLIC_TOKENS(HdImageShaderTokens, HD_API, HD_IMAGE_SHADER_TOKENS)