Loading...
Searching...
No Matches
primvarSchema.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//
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_PRIMVAR_SCHEMA_H
19#define PXR_IMAGING_HD_PRIMVAR_SCHEMA_H
20
22
23#include "pxr/imaging/hd/api.h"
24
25#include "pxr/imaging/hd/schema.h"
26
27// --(BEGIN CUSTOM CODE: Includes)--
28// --(END CUSTOM CODE: Includes)--
29
30PXR_NAMESPACE_OPEN_SCOPE
31
32// --(BEGIN CUSTOM CODE: Declares)--
33// --(END CUSTOM CODE: Declares)--
34
35#define HD_PRIMVAR_SCHEMA_TOKENS \
36 (primvarValue) \
37 (indexedPrimvarValue) \
38 (indices) \
39 (interpolation) \
40 (role) \
41 (elementSize) \
42 (transform) \
43 (constant) \
44 (uniform) \
45 (varying) \
46 (vertex) \
47 (faceVarying) \
48 (instance) \
49 (point) \
50 (normal) \
51 (vector) \
52 (color) \
53 (pointIndex) \
54 (edgeIndex) \
55 (faceIndex) \
56 (textureCoordinate) \
57
58TF_DECLARE_PUBLIC_TOKENS(HdPrimvarSchemaTokens, HD_API,
59 HD_PRIMVAR_SCHEMA_TOKENS);
60
61//-----------------------------------------------------------------------------
62
63
64class HdPrimvarSchema : public HdSchema
65{
66public:
69
70 HdPrimvarSchema(HdContainerDataSourceHandle container)
71 : HdSchema(container) {}
72
74
75// --(BEGIN CUSTOM CODE: Schema Methods)--
76
77 // If the primvar does not have indices, GetPrimvarValue() and
78 // GetIndexedPrimvarValue() will return the same thing. If the primvar
79 // does has indices, GetPrimvarValue() will return the flattened value,
80 // while GetIndexedPrimvarValue() will return the unflattened value.
81 HD_API
82 HdSampledDataSourceHandle GetPrimvarValue() const;
83
84 HD_API
85 HdSampledDataSourceHandle GetIndexedPrimvarValue() const;
86
87 // Returns true if it contains data sources for an indexed primvar value
88 // and for indices.
89 HD_API
90 bool IsIndexed() const;
91
92 // If the primvar does not have indices, GetFlattenedPrimvarValue() will
93 // just return the primvarValue data source which is also returned by
94 // GetPrimVarValue().
95 // If the primvar does have indices, GetFlattenedPrivmarValue() will return
96 // the flattened value.
97 //
98 // Note that GetPrimvarValue actually flattens the primvar even though
99 // the name and the grouping under ACCESSORS suggests that it is merely
100 // retrieving the primvarValue data source.
101 //
102 // The behavior of GetPrimvarValue might be conformed to simply return
103 // the primvarValue data source. Thus, clients who need the flattening
104 // behavior should explicitly call GetFlattenedPrimvarValue.
105 //
106 HD_API
107 HdSampledDataSourceHandle GetFlattenedPrimvarValue() const;
108
109// --(END CUSTOM CODE: Schema Methods)--
110
113
114 HD_API
115 HdIntArrayDataSourceHandle GetIndices() const;
116
117 HD_API
118 HdTokenDataSourceHandle GetInterpolation() const;
119
120 HD_API
121 HdTokenDataSourceHandle GetRole() const;
122
125 HD_API
126 HdIntDataSourceHandle GetElementSize() const;
127
129
132
140 HD_API
141 static HdContainerDataSourceHandle
142 BuildRetained(
143 const HdSampledDataSourceHandle &primvarValue,
144 const HdSampledDataSourceHandle &indexedPrimvarValue,
145 const HdIntArrayDataSourceHandle &indices,
146 const HdTokenDataSourceHandle &interpolation,
147 const HdTokenDataSourceHandle &role,
148 const HdIntDataSourceHandle &elementSize
149 );
150
158 {
159 public:
160 HD_API
161 Builder &SetPrimvarValue(
162 const HdSampledDataSourceHandle &primvarValue);
163 HD_API
164 Builder &SetIndexedPrimvarValue(
165 const HdSampledDataSourceHandle &indexedPrimvarValue);
166 HD_API
167 Builder &SetIndices(
168 const HdIntArrayDataSourceHandle &indices);
169 HD_API
170 Builder &SetInterpolation(
171 const HdTokenDataSourceHandle &interpolation);
172 HD_API
173 Builder &SetRole(
174 const HdTokenDataSourceHandle &role);
175 HD_API
176 Builder &SetElementSize(
177 const HdIntDataSourceHandle &elementSize);
178
180 HD_API
181 HdContainerDataSourceHandle Build();
182
183 private:
184 HdSampledDataSourceHandle _primvarValue;
185 HdSampledDataSourceHandle _indexedPrimvarValue;
186 HdIntArrayDataSourceHandle _indices;
187 HdTokenDataSourceHandle _interpolation;
188 HdTokenDataSourceHandle _role;
189 HdIntDataSourceHandle _elementSize;
190
191 };
192
203 HD_API
204 static HdTokenDataSourceHandle BuildInterpolationDataSource(
205 const TfToken &interpolation);
206
219 HD_API
220 static HdTokenDataSourceHandle BuildRoleDataSource(
221 const TfToken &role);
222
224};
225
226PXR_NAMESPACE_CLOSE_SCOPE
227
228#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:26
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:81