Loading...
Searching...
No Matches
primvarSchema.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//
25
26/* ************************************************************************** */
27/* ** ** */
28/* ** This file is generated by a script. ** */
29/* ** ** */
30/* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
31/* ** Edit hdSchemaDefs.py instead to make changes. ** */
32/* ** ** */
33/* ************************************************************************** */
34
35#ifndef PXR_IMAGING_HD_PRIMVAR_SCHEMA_H
36#define PXR_IMAGING_HD_PRIMVAR_SCHEMA_H
37
39
40#include "pxr/imaging/hd/api.h"
41
42#include "pxr/imaging/hd/schema.h"
43
44// --(BEGIN CUSTOM CODE: Includes)--
45// --(END CUSTOM CODE: Includes)--
46
47PXR_NAMESPACE_OPEN_SCOPE
48
49// --(BEGIN CUSTOM CODE: Declares)--
50// --(END CUSTOM CODE: Declares)--
51
52#define HD_PRIMVAR_SCHEMA_TOKENS \
53 (primvarValue) \
54 (indexedPrimvarValue) \
55 (indices) \
56 (interpolation) \
57 (role) \
58 (transform) \
59 (constant) \
60 (uniform) \
61 (varying) \
62 (vertex) \
63 (faceVarying) \
64 (instance) \
65 (point) \
66 (normal) \
67 (vector) \
68 (color) \
69 (pointIndex) \
70 (edgeIndex) \
71 (faceIndex) \
72 (textureCoordinate) \
73
74TF_DECLARE_PUBLIC_TOKENS(HdPrimvarSchemaTokens, HD_API,
75 HD_PRIMVAR_SCHEMA_TOKENS);
76
77//-----------------------------------------------------------------------------
78
79
80class HdPrimvarSchema : public HdSchema
81{
82public:
85
86 HdPrimvarSchema(HdContainerDataSourceHandle container)
87 : HdSchema(container) {}
88
90
91// --(BEGIN CUSTOM CODE: Schema Methods)--
92
93 // If the primvar does not have indices, GetPrimvarValue() and
94 // GetIndexedPrimvarValue() will return the same thing. If the primvar
95 // does has indices, GetPrimvarValue() will return the flattened value,
96 // while GetIndexedPrimvarValue() will return the unflattened value.
97 HD_API
98 HdSampledDataSourceHandle GetPrimvarValue();
99
100 HD_API
101 HdSampledDataSourceHandle GetIndexedPrimvarValue();
102
103 // Returns true if it contains data sources for an indexed primvar value
104 // and for indices.
105 HD_API
106 bool IsIndexed();
107
108 // If the primvar does not have indices, GetFlattenedPrimvarValue() will
109 // just return the primvarValue data source which is also returned by
110 // GetPrimVarValue().
111 // If the primvar does have indices, GetFlattenedPrivmarValue() will return
112 // the flattened value.
113 //
114 // Note that GetPrimvarValue actually flattens the primvar even though
115 // the name and the grouping under ACCESSORS suggests that it is merely
116 // retrieving the primvarValue data source.
117 //
118 // The behavior of GetPrimvarValue might be conformed to simply return
119 // the primvarValue data source. Thus, clients who need the flattening
120 // behavior should explicitly call GetFlattenedPrimvarValue.
121 //
122 HD_API
123 HdSampledDataSourceHandle GetFlattenedPrimvarValue();
124
125// --(END CUSTOM CODE: Schema Methods)--
126
129
130 HD_API
131 HdIntArrayDataSourceHandle GetIndices() const;
132
133 HD_API
134 HdTokenDataSourceHandle GetInterpolation() const;
135
136 HD_API
137 HdTokenDataSourceHandle GetRole() const;
138
140
143
151 HD_API
152 static HdContainerDataSourceHandle
153 BuildRetained(
154 const HdSampledDataSourceHandle &primvarValue,
155 const HdSampledDataSourceHandle &indexedPrimvarValue,
156 const HdIntArrayDataSourceHandle &indices,
157 const HdTokenDataSourceHandle &interpolation,
158 const HdTokenDataSourceHandle &role
159 );
160
168 {
169 public:
170 HD_API
171 Builder &SetPrimvarValue(
172 const HdSampledDataSourceHandle &primvarValue);
173 HD_API
174 Builder &SetIndexedPrimvarValue(
175 const HdSampledDataSourceHandle &indexedPrimvarValue);
176 HD_API
177 Builder &SetIndices(
178 const HdIntArrayDataSourceHandle &indices);
179 HD_API
180 Builder &SetInterpolation(
181 const HdTokenDataSourceHandle &interpolation);
182 HD_API
183 Builder &SetRole(
184 const HdTokenDataSourceHandle &role);
185
187 HD_API
188 HdContainerDataSourceHandle Build();
189
190 private:
191 HdSampledDataSourceHandle _primvarValue;
192 HdSampledDataSourceHandle _indexedPrimvarValue;
193 HdIntArrayDataSourceHandle _indices;
194 HdTokenDataSourceHandle _interpolation;
195 HdTokenDataSourceHandle _role;
196
197 };
198
209 HD_API
210 static HdTokenDataSourceHandle BuildInterpolationDataSource(
211 const TfToken &interpolation);
212
225 HD_API
226 static HdTokenDataSourceHandle BuildRoleDataSource(
227 const TfToken &role);
228
230};
231
232PXR_NAMESPACE_CLOSE_SCOPE
233
234#endif
Utility class for setting sparse sets of child data source fields to be filled as arguments into Buil...
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
Schema classes represent a structured view of the inherently unstructured container data source passe...
Definition: schema.h:43
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:98