HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
imageShaderSchema.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 ////////////////////////////////////////////////////////////////////////
8 
9 /* ************************************************************************** */
10 /* ** ** */
11 /* ** This file is generated by a script. ** */
12 /* ** ** */
13 /* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
14 /* ** Edit hdSchemaDefs.py instead to make changes. ** */
15 /* ** ** */
16 /* ************************************************************************** */
17 
18 #ifndef PXR_IMAGING_HD_IMAGE_SHADER_SCHEMA_H
19 #define PXR_IMAGING_HD_IMAGE_SHADER_SCHEMA_H
20 
21 /// \file
22 
23 #include "pxr/imaging/hd/api.h"
26 
27 #include "pxr/imaging/hd/schema.h"
28 
29 // --(BEGIN CUSTOM CODE: Includes)--
30 // --(END CUSTOM CODE: Includes)--
31 
33 
34 // --(BEGIN CUSTOM CODE: Declares)--
35 // --(END CUSTOM CODE: Declares)--
36 
37 #define HD_IMAGE_SHADER_SCHEMA_TOKENS \
38  (imageShader) \
39  (enabled) \
40  (priority) \
41  (filePath) \
42  (constants) \
43  (materialNetwork) \
44 
45 TF_DECLARE_PUBLIC_TOKENS(HdImageShaderSchemaTokens, HD_API,
47 
48 //-----------------------------------------------------------------------------
49 
50 
52 {
53 public:
54  /// \name Schema retrieval
55  /// @{
56 
57  HdImageShaderSchema(HdContainerDataSourceHandle container)
58  : HdSchema(container) {}
59 
60  /// Retrieves a container data source with the schema's default name token
61  /// "imageShader" from the parent container and constructs a
62  /// HdImageShaderSchema instance.
63  /// Because the requested container data source may not exist, the result
64  /// should be checked with IsDefined() or a bool comparison before use.
65  HD_API
67  const HdContainerDataSourceHandle &fromParentContainer);
68 
69  /// @}
70 
71 // --(BEGIN CUSTOM CODE: Schema Methods)--
72 // --(END CUSTOM CODE: Schema Methods)--
73 
74  /// \name Member accessor
75  /// @{
76 
77  HD_API
79 
80  HD_API
82 
83  HD_API
85 
86  HD_API
88 
89  HD_API
91 
92  /// @}
93 
94  /// \name Schema location
95  /// @{
96 
97  /// Returns a token where the container representing this schema is found in
98  /// a container by default.
99  HD_API
100  static const TfToken &GetSchemaToken();
101 
102  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
103  /// where the container representing this schema is found by default.
104  HD_API
105  static const HdDataSourceLocator &GetDefaultLocator();
106 
107  /// @}
108 
109  /// \name Data source locators for members
110  ///
111  /// The following methods return an HdDataSourceLocator (relative to the
112  /// prim-level data source) where the data source for a member can be found.
113  ///
114  /// This is often useful for checking intersection against the
115  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
116  /// @{
117 
118  /// Prim-level relative data source locator to locate enabled.
119  HD_API
120  static const HdDataSourceLocator &GetEnabledLocator();
121 
122  /// Prim-level relative data source locator to locate priority.
123  HD_API
124  static const HdDataSourceLocator &GetPriorityLocator();
125 
126  /// Prim-level relative data source locator to locate filePath.
127  HD_API
128  static const HdDataSourceLocator &GetFilePathLocator();
129 
130  /// Prim-level relative data source locator to locate constants.
131  HD_API
133 
134  /// Prim-level relative data source locator to locate materialNetwork.
135  HD_API
137  /// @}
138 
139  /// \name Schema construction
140  /// @{
141 
142  /// \deprecated Use Builder instead.
143  ///
144  /// Builds a container data source which includes the provided child data
145  /// sources. Parameters with nullptr values are excluded. This is a
146  /// low-level interface. For cases in which it's desired to define
147  /// the container with a sparse set of child fields, the Builder class
148  /// is often more convenient and readable.
149  HD_API
150  static HdContainerDataSourceHandle
153  const HdIntDataSourceHandle &priority,
154  const HdStringDataSourceHandle &filePath,
155  const HdContainerDataSourceHandle &constants,
156  const HdContainerDataSourceHandle &materialNetwork
157  );
158 
159  /// \class HdImageShaderSchema::Builder
160  ///
161  /// Utility class for setting sparse sets of child data source fields to be
162  /// filled as arguments into BuildRetained. Because all setter methods
163  /// return a reference to the instance, this can be used in the "builder
164  /// pattern" form.
165  class Builder
166  {
167  public:
168  HD_API
171  HD_API
173  const HdIntDataSourceHandle &priority);
174  HD_API
176  const HdStringDataSourceHandle &filePath);
177  HD_API
179  const HdContainerDataSourceHandle &constants);
180  HD_API
182  const HdContainerDataSourceHandle &materialNetwork);
183 
184  /// Returns a container data source containing the members set thus far.
185  HD_API
186  HdContainerDataSourceHandle Build();
187 
188  private:
189  HdBoolDataSourceHandle _enabled;
190  HdIntDataSourceHandle _priority;
191  HdStringDataSourceHandle _filePath;
192  HdContainerDataSourceHandle _constants;
193  HdContainerDataSourceHandle _materialNetwork;
194 
195  };
196 
197  /// @}
198 };
199 
201 
202 #endif
static HD_API HdContainerDataSourceHandle BuildRetained(const HdBoolDataSourceHandle &enabled, const HdIntDataSourceHandle &priority, const HdStringDataSourceHandle &filePath, const HdContainerDataSourceHandle &constants, const HdContainerDataSourceHandle &materialNetwork)
HdImageShaderSchema(HdContainerDataSourceHandle container)
HD_API Builder & SetEnabled(const HdBoolDataSourceHandle &enabled)
static HD_API HdImageShaderSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
HD_API HdMaterialNetworkSchema GetMaterialNetwork() const
static HD_API const HdDataSourceLocator & GetConstantsLocator()
Prim-level relative data source locator to locate constants.
HdStringDataSource::Handle HdStringDataSourceHandle
#define HD_API
Definition: api.h:23
#define HD_IMAGE_SHADER_SCHEMA_TOKENS
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glcorearb.h:2539
HD_API Builder & SetFilePath(const HdStringDataSourceHandle &filePath)
HD_API HdSampledDataSourceContainerSchema GetConstants() const
HD_API Builder & SetPriority(const HdIntDataSourceHandle &priority)
HD_API HdIntDataSourceHandle GetPriority() const
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
Definition: token.h:70
HD_API HdBoolDataSourceHandle GetEnabled() const
static HD_API const HdDataSourceLocator & GetDefaultLocator()
HdBoolDataSource::Handle HdBoolDataSourceHandle
HD_API Builder & SetMaterialNetwork(const HdContainerDataSourceHandle &materialNetwork)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
static HD_API const HdDataSourceLocator & GetMaterialNetworkLocator()
Prim-level relative data source locator to locate materialNetwork.
static HD_API const TfToken & GetSchemaToken()
HD_API Builder & SetConstants(const HdContainerDataSourceHandle &constants)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
TF_DECLARE_PUBLIC_TOKENS(HdImageShaderSchemaTokens, HD_API, HD_IMAGE_SHADER_SCHEMA_TOKENS)
static HD_API const HdDataSourceLocator & GetPriorityLocator()
Prim-level relative data source locator to locate priority.
HdIntDataSource::Handle HdIntDataSourceHandle
static HD_API const HdDataSourceLocator & GetFilePathLocator()
Prim-level relative data source locator to locate filePath.
HD_API HdStringDataSourceHandle GetFilePath() const
static HD_API const HdDataSourceLocator & GetEnabledLocator()
Prim-level relative data source locator to locate enabled.