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
66class HdPrimvarSchema : public HdSchema
67{
68public:
71
72 HdPrimvarSchema(HdContainerDataSourceHandle container)
73 : HdSchema(container) {}
74
76
77// --(BEGIN CUSTOM CODE: Schema Methods)--
78
79 // If the primvar does not have indices, GetPrimvarValue() and
80 // GetIndexedPrimvarValue() will return the same thing. If the primvar
81 // does has indices, GetPrimvarValue() will return the flattened value,
82 // while GetIndexedPrimvarValue() will return the unflattened value.
83 HD_API
84 HdSampledDataSourceHandle GetPrimvarValue() const;
85
86 HD_API
87 HdSampledDataSourceHandle GetIndexedPrimvarValue() const;
88
89 // Returns true if it contains data sources for an indexed primvar value
90 // and for indices.
91 HD_API
92 bool IsIndexed() const;
93
94 // If the primvar does not have indices, GetFlattenedPrimvarValue() will
95 // just return the primvarValue data source which is also returned by
96 // GetPrimVarValue().
97 // If the primvar does have indices, GetFlattenedPrivmarValue() will return
98 // the flattened value.
99 //
100 // Note that GetPrimvarValue actually flattens the primvar even though
101 // the name and the grouping under ACCESSORS suggests that it is merely
102 // retrieving the primvarValue data source.
103 //
104 // The behavior of GetPrimvarValue might be conformed to simply return
105 // the primvarValue data source. Thus, clients who need the flattening
106 // behavior should explicitly call GetFlattenedPrimvarValue.
107 //
108 HD_API
109 HdSampledDataSourceHandle GetFlattenedPrimvarValue() const;
110
111// --(END CUSTOM CODE: Schema Methods)--
112
115
116 HD_API
117 HdIntArrayDataSourceHandle GetIndices() const;
118
119 HD_API
120 HdTokenDataSourceHandle GetInterpolation() const;
121
122 HD_API
123 HdTokenDataSourceHandle GetRole() const;
124
127 HD_API
128 HdIntDataSourceHandle GetElementSize() const;
129
131
134
142 HD_API
143 static HdContainerDataSourceHandle
144 BuildRetained(
145 const HdSampledDataSourceHandle &primvarValue,
146 const HdSampledDataSourceHandle &indexedPrimvarValue,
147 const HdIntArrayDataSourceHandle &indices,
148 const HdTokenDataSourceHandle &interpolation,
149 const HdTokenDataSourceHandle &role,
150 const HdIntDataSourceHandle &elementSize
151 );
152
160 {
161 public:
162 HD_API
163 Builder &SetPrimvarValue(
164 const HdSampledDataSourceHandle &primvarValue);
165 HD_API
166 Builder &SetIndexedPrimvarValue(
167 const HdSampledDataSourceHandle &indexedPrimvarValue);
168 HD_API
169 Builder &SetIndices(
170 const HdIntArrayDataSourceHandle &indices);
171 HD_API
172 Builder &SetInterpolation(
173 const HdTokenDataSourceHandle &interpolation);
174 HD_API
175 Builder &SetRole(
176 const HdTokenDataSourceHandle &role);
177 HD_API
178 Builder &SetElementSize(
179 const HdIntDataSourceHandle &elementSize);
180
182 HD_API
183 HdContainerDataSourceHandle Build();
184
185 private:
186 HdSampledDataSourceHandle _primvarValue;
187 HdSampledDataSourceHandle _indexedPrimvarValue;
188 HdIntArrayDataSourceHandle _indices;
189 HdTokenDataSourceHandle _interpolation;
190 HdTokenDataSourceHandle _role;
191 HdIntDataSourceHandle _elementSize;
192
193 };
194
205 HD_API
206 static HdTokenDataSourceHandle BuildInterpolationDataSource(
207 const TfToken &interpolation);
208
221 HD_API
222 static HdTokenDataSourceHandle BuildRoleDataSource(
223 const TfToken &role);
224
226};
227
228PXR_NAMESPACE_CLOSE_SCOPE
229
230#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:92