HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
materialSchema.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_MATERIAL_SCHEMA_H
19 #define PXR_IMAGING_HD_MATERIAL_SCHEMA_H
20 
21 /// \file
22 
23 #include "pxr/imaging/hd/api.h"
25 
26 #include "pxr/imaging/hd/schema.h"
27 
28 // --(BEGIN CUSTOM CODE: Includes)--
29 // --(END CUSTOM CODE: Includes)--
30 
32 
33 // --(BEGIN CUSTOM CODE: Declares)--
34 // --(END CUSTOM CODE: Declares)--
35 
36 #define HD_MATERIAL_SCHEMA_TOKENS \
37  (material) \
38  ((universalRenderContext, "")) \
39  ((all, "__all")) \
40  (terminals) \
41  (surface) \
42  (displacement) \
43  (volume) \
44 
45 TF_DECLARE_PUBLIC_TOKENS(HdMaterialSchemaTokens, HD_API,
47 
48 //-----------------------------------------------------------------------------
49 
50 // The Material schema is a container schema that provides the correct
51 // material definition per render context.
52 //
53 // For example, a material may specify several render contexts like the
54 // universalRenderContext (""), Renderman ("ri"), Storm ("glslfx"), etc. Each
55 // render context will then provide the specific definition for the renderer,
56 // which is defined by the MaterialNetwork schema. The universalRenderContext
57 // applies to all renderers.
58 //
59 // See "Custom Code: Schema Methods" section for ASCII art diagram.
60 //
61 
62 class HdMaterialSchema : public HdSchema
63 {
64 public:
65  /// \name Schema retrieval
66  /// @{
67 
68  HdMaterialSchema(HdContainerDataSourceHandle container)
69  : HdSchema(container) {}
70 
71  /// Retrieves a container data source with the schema's default name token
72  /// "material" from the parent container and constructs a
73  /// HdMaterialSchema instance.
74  /// Because the requested container data source may not exist, the result
75  /// should be checked with IsDefined() or a bool comparison before use.
76  HD_API
78  const HdContainerDataSourceHandle &fromParentContainer);
79 
80  /// @}
81 
82 // --(BEGIN CUSTOM CODE: Schema Methods)--
83 
84  /// \name ASCII Art Diagram
85  /// @{
86 
87  /// The following diagram depicts an example scene index prim
88  /// "Plastic_Material". "Plastic_Material" is a scene index prim that has
89  /// multiple container data sources, like 'material' (HdMaterialSchema) and
90  /// 'materialOverride' (HdMaterialOverrideSchema). "Plastic_Material" as a
91  /// scene index prim also has a scene index prim type, which is type
92  /// 'material'. (See HdPrimTypeTokens).
93 
94  /// Note the following:
95  /// 1. The data flows from left to right.
96  /// 2. The lines between "materialOverride" and "interfaceMappings"
97  /// are not true connections and are not backed by the
98  /// MaterialConnection schema. Each item within "materialOverride"
99  /// and "interfaceMappings" is loosely coupled by their matching
100  /// names.
101  /// 3. The connections in the diagram are drawn with an 'o' to indicate
102  /// the source where the connection was authored, and these
103  /// connections are backed by the MaterialConnection schema.
104 
105  /// +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
106  /// | |
107  /// | "Plastic_Material" [scene index prim name] |
108  /// | |
109  /// | +-----------------------------------+ +--------------------------------------------------------------------------------------------------------------------------------------------------------+ |
110  /// | | materialOverride | | material | |
111  /// | | +------------------------------+ | | +--------------------------------------------------------------------------------------------------------------------------------------------------+ | |
112  /// | | | interfaceValues | | | | ri [materialNetwork for Renderman render context] | | |
113  /// | | | | | | | +-----------------------+ +--------------------------------------------------------------------------------+ +-------------------+ | | |
114  /// | | | *globalVal = 0.2-------------+-+----+ | | |interfaceMappings | | nodes | |terminals | | | |
115  /// | | | | | | | | | | | +--------------------+ | | | | | |
116  /// | | | *globalSpecularKface = 0.666-+-+-+ +-+--+--+-+*globalVal o-----------+---+ | |"Color_Manipulate" | | +-+-o*surface | | | |
117  /// | | | | | | | | | | | | |[materialNode] | | | | | | | |
118  /// | | +------------------------------+ | +--+-+--+--+-+*globalSpecularKface o-+-+ | | | | | | | | | | |
119  /// | | | | | | | | +---+-+-*adjustVal *out+----+ | | +-------------------+ | | |
120  /// | +-----------------------------------+ | | +-----------------------+ | | | | | | | | | | |
121  /// | | | | | | +--------------------+ | +-----------------------+ +--------------------+ | | | | |
122  /// | | | | | | | |"MaterialLayer" | |"PxrSurface" | | | | | |
123  /// | | | | | | | |[materialNode] | |[materialNode] | | | | | |
124  /// | | | | | | | | | | | | | | | |
125  /// | | | +-+---+---------------------------+--+--*specularKface *out+--+-o*materialIn *out+-+-+ | | |
126  /// | | | | | | | | | | | | | |
127  /// | | | | | | | *diffuseK = 0.12 | | | | | | |
128  /// | | | | | +----------------------+ | | | +--------------------+ | | | |
129  /// | | | | | |"Color_RetargetLayer" | | | | | | | |
130  /// | | | | | |[materialNode] | +--+-o*someInput_A | | | | |
131  /// | | | | | | | | | | | | |
132  /// | | | +---+-+-*valRemapAmount *out+-----+-o*someInput_B | | | | |
133  /// | | | | | | | | | | | |
134  /// | | | | +----------------------+ +-----------------------+ | | | |
135  /// | | | | | | | |
136  /// | | | | | | | |
137  /// | | | | | | | |
138  /// | | | | | | | |
139  /// | | | +--------------------------------------------------------------------------------+ | | |
140  /// | | | | | |
141  /// | | +--------------------------------------------------------------------------------------------------------------------------------------------------+ | |
142  /// | | | |
143  /// | +--------------------------------------------------------------------------------------------------------------------------------------------------------+ |
144  /// | |
145  /// +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
146 
147  /// @}
148 
149  HD_API
151 
152  HD_API
154 
155  HD_API
157 
158  // Find the terminal (surface/volume/displcement) from a given data source locator.
159  HD_API
160  static TfToken
162  HdDataSourceLocator const& locator);
163 
164  HD_API
165  static TfToken
167  HdDataSourceLocator const& locator,
168  TfToken const& context);
169 
170  HD_API
171  static TfToken
173  HdDataSourceLocator const& locator,
174  TfTokenVector const &contexts);
175 
176 // --(END CUSTOM CODE: Schema Methods)--
177 
178  /// \name Member accessor
179  /// @{
180 
181  /// @}
182 
183  /// \name Schema location
184  /// @{
185 
186  /// Returns a token where the container representing this schema is found in
187  /// a container by default.
188  HD_API
189  static const TfToken &GetSchemaToken();
190 
191  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
192  /// where the container representing this schema is found by default.
193  HD_API
194  static const HdDataSourceLocator &GetDefaultLocator();
195 
196  /// @}
197 
198  /// \name Schema construction
199  /// @{
200  HD_API
201  static HdContainerDataSourceHandle
203  size_t count,
204  const TfToken *names,
205  const HdDataSourceBaseHandle *values);
206 
207  /// @}
208 };
209 
211 
212 #endif
HdMaterialSchema(HdContainerDataSourceHandle container)
HD_API HdMaterialNetworkSchema GetMaterialNetwork()
#define HD_API
Definition: api.h:23
#define HD_MATERIAL_SCHEMA_TOKENS
static HD_API HdContainerDataSourceHandle BuildRetained(size_t count, const TfToken *names, const HdDataSourceBaseHandle *values)
static HD_API HdMaterialSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
Definition: token.h:70
TF_DECLARE_PUBLIC_TOKENS(HdMaterialSchemaTokens, HD_API, HD_MATERIAL_SCHEMA_TOKENS)
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
static HD_API TfToken GetLocatorTerminal(HdDataSourceLocator const &locator)
static HD_API const TfToken & GetSchemaToken()
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static HD_API const HdDataSourceLocator & GetDefaultLocator()
GLint GLsizei count
Definition: glcorearb.h:405