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 (colorSpace) \
42 (elementSize) \
43 (transform) \
44 (constant) \
45 (uniform) \
46 (varying) \
47 (vertex) \
48 (faceVarying) \
49 (instance) \
50 (point) \
51 (normal) \
52 (vector) \
53 (color) \
54 (pointIndex) \
55 (edgeIndex) \
56 (faceIndex) \
57 (textureCoordinate) \
58
59TF_DECLARE_PUBLIC_TOKENS(HdPrimvarSchemaTokens, HD_API,
60 HD_PRIMVAR_SCHEMA_TOKENS);
61
62//-----------------------------------------------------------------------------
63
64
67class HdPrimvarSchema : public HdSchema
68{
69public:
72
73 HdPrimvarSchema(HdContainerDataSourceHandle container)
74 : HdSchema(container) {}
75
77
78// --(BEGIN CUSTOM CODE: Schema Methods)--
79
80 // If the primvar does not have indices, GetPrimvarValue() and
81 // GetIndexedPrimvarValue() will return the same thing. If the primvar
82 // does has indices, GetPrimvarValue() will return the flattened value,
83 // while GetIndexedPrimvarValue() will return the unflattened value.
84 HD_API
85 HdSampledDataSourceHandle GetPrimvarValue() const;
86
87 HD_API
88 HdSampledDataSourceHandle GetIndexedPrimvarValue() const;
89
90 // Returns true if it contains data sources for an indexed primvar value
91 // and for indices.
92 HD_API
93 bool IsIndexed() const;
94
95 // If the primvar does not have indices, GetFlattenedPrimvarValue() will
96 // just return the primvarValue data source which is also returned by
97 // GetPrimVarValue().
98 // If the primvar does have indices, GetFlattenedPrivmarValue() will return
99 // the flattened value.
100 //
101 // Note that GetPrimvarValue actually flattens the primvar even though
102 // the name and the grouping under ACCESSORS suggests that it is merely
103 // retrieving the primvarValue data source.
104 //
105 // The behavior of GetPrimvarValue might be conformed to simply return
106 // the primvarValue data source. Thus, clients who need the flattening
107 // behavior should explicitly call GetFlattenedPrimvarValue.
108 //
109 HD_API
110 HdSampledDataSourceHandle GetFlattenedPrimvarValue() const;
111
112// --(END CUSTOM CODE: Schema Methods)--
113
116
117 HD_API
118 HdIntArrayDataSourceHandle GetIndices() const;
119
120 HD_API
121 HdTokenDataSourceHandle GetInterpolation() const;
122
123 HD_API
124 HdTokenDataSourceHandle GetRole() const;
125
126 HD_API
127 HdTokenDataSourceHandle GetColorSpace() const;
128
131 HD_API
132 HdIntDataSourceHandle GetElementSize() const;
133
135
138
146 HD_API
147 static HdContainerDataSourceHandle
148 BuildRetained(
149 const HdSampledDataSourceHandle &primvarValue,
150 const HdSampledDataSourceHandle &indexedPrimvarValue,
151 const HdIntArrayDataSourceHandle &indices,
152 const HdTokenDataSourceHandle &interpolation,
153 const HdTokenDataSourceHandle &role,
154 const HdTokenDataSourceHandle &colorSpace,
155 const HdIntDataSourceHandle &elementSize
156 );
157
165 {
166 public:
167 HD_API
168 Builder &SetPrimvarValue(
169 const HdSampledDataSourceHandle &primvarValue);
170 HD_API
171 Builder &SetIndexedPrimvarValue(
172 const HdSampledDataSourceHandle &indexedPrimvarValue);
173 HD_API
174 Builder &SetIndices(
175 const HdIntArrayDataSourceHandle &indices);
176 HD_API
177 Builder &SetInterpolation(
178 const HdTokenDataSourceHandle &interpolation);
179 HD_API
180 Builder &SetRole(
181 const HdTokenDataSourceHandle &role);
182 HD_API
183 Builder &SetColorSpace(
184 const HdTokenDataSourceHandle &colorSpace);
185 HD_API
186 Builder &SetElementSize(
187 const HdIntDataSourceHandle &elementSize);
188
190 HD_API
191 HdContainerDataSourceHandle Build();
192
193 private:
194 HdSampledDataSourceHandle _primvarValue;
195 HdSampledDataSourceHandle _indexedPrimvarValue;
196 HdIntArrayDataSourceHandle _indices;
197 HdTokenDataSourceHandle _interpolation;
198 HdTokenDataSourceHandle _role;
199 HdTokenDataSourceHandle _colorSpace;
200 HdIntDataSourceHandle _elementSize;
201
202 };
203
214 HD_API
215 static HdTokenDataSourceHandle BuildInterpolationDataSource(
216 const TfToken &interpolation);
217
230 HD_API
231 static HdTokenDataSourceHandle BuildRoleDataSource(
232 const TfToken &role);
233
235};
236
237PXR_NAMESPACE_CLOSE_SCOPE
238
239#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