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 Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_IMAGING_HD_IMAGE_SHADER_H
25 #define PXR_IMAGING_HD_IMAGE_SHADER_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/version.h"
30 #include "pxr/imaging/hd/sprim.h"
31 
33 #include "pxr/base/vt/dictionary.h"
34 
35 #include <vector>
36 
38 
39 #define HD_IMAGE_SHADER_TOKENS \
40  (enabled) \
41  (priority) \
42  (filePath) \
43  (constants)
44 
46 
47 class HdSceneDelegate;
48 
49 /// \class HdImageShader
50 ///
51 /// An image shader.
52 ///
53 class HdImageShader : public HdSprim
54 {
55 public:
56  HD_API
57  HdImageShader(SdfPath const & id);
58  HD_API
59  ~HdImageShader() override;
60 
61  // Change tracking for HdImageShader
63  Clean = 0,
64  DirtyEnabled = 1 << 0,
65  DirtyPriority = 1 << 1,
66  DirtyFilePath = 1 << 2,
67  DirtyConstants = 1 << 3,
68 
73  };
74 
75  // ---------------------------------------------------------------------- //
76  /// Sprim API
77  // ---------------------------------------------------------------------- //
78 
79  /// Synchronizes state from the delegate to this object.
80  HD_API
81  void Sync(
82  HdSceneDelegate* sceneDelegate,
83  HdRenderParam* renderParam,
84  HdDirtyBits* dirtyBits) override;
85 
86  /// Returns the minimal set of dirty bits to place in the
87  /// change tracker for use in the first sync of this prim.
88  /// Typically this would be all dirty bits.
89  HD_API
90  HdDirtyBits GetInitialDirtyBitsMask() const override;
91 
92  // ---------------------------------------------------------------------- //
93  /// Image shader parameters accessor API
94  // ---------------------------------------------------------------------- //
95  HD_API
96  bool GetEnabled() const;
97 
98  HD_API
99  int GetPriority() const;
100 
101  HD_API
102  const std::string& GetFilePath() const;
103 
104  HD_API
105  const VtDictionary& GetConstants() const;
106 
107 private:
108  bool _enabled;
109  int _priority;
110  std::string _filePath;
111  VtDictionary _constants;
112 };
113 
115 
116 #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:158
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
#define HD_API
Definition: api.h:40
HD_API const std::string & GetFilePath() const
HD_API int GetPriority() const
#define HD_IMAGE_SHADER_TOKENS
Definition: imageShader.h:39
HD_API ~HdImageShader() override
HD_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Sprim API.
Definition: path.h:290
Definition: sprim.h:51
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
HD_API HdDirtyBits GetInitialDirtyBitsMask() const override
TF_DECLARE_PUBLIC_TOKENS(HdImageShaderTokens, HD_API, HD_IMAGE_SHADER_TOKENS)