All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 (transform) \
42 (constant) \
43 (uniform) \
44 (varying) \
45 (vertex) \
46 (faceVarying) \
47 (instance) \
48 (point) \
49 (normal) \
50 (vector) \
51 (color) \
52 (pointIndex) \
53 (edgeIndex) \
54 (faceIndex) \
55 (textureCoordinate) \
56
57TF_DECLARE_PUBLIC_TOKENS(HdPrimvarSchemaTokens, HD_API,
58 HD_PRIMVAR_SCHEMA_TOKENS);
59
60//-----------------------------------------------------------------------------
61
62
63class HdPrimvarSchema : public HdSchema
64{
65public:
68
69 HdPrimvarSchema(HdContainerDataSourceHandle container)
70 : HdSchema(container) {}
71
73
74// --(BEGIN CUSTOM CODE: Schema Methods)--
75
76 // If the primvar does not have indices, GetPrimvarValue() and
77 // GetIndexedPrimvarValue() will return the same thing. If the primvar
78 // does has indices, GetPrimvarValue() will return the flattened value,
79 // while GetIndexedPrimvarValue() will return the unflattened value.
80 HD_API
81 HdSampledDataSourceHandle GetPrimvarValue();
82
83 HD_API
84 HdSampledDataSourceHandle GetIndexedPrimvarValue();
85
86 // Returns true if it contains data sources for an indexed primvar value
87 // and for indices.
88 HD_API
89 bool IsIndexed();
90
91 // If the primvar does not have indices, GetFlattenedPrimvarValue() will
92 // just return the primvarValue data source which is also returned by
93 // GetPrimVarValue().
94 // If the primvar does have indices, GetFlattenedPrivmarValue() will return
95 // the flattened value.
96 //
97 // Note that GetPrimvarValue actually flattens the primvar even though
98 // the name and the grouping under ACCESSORS suggests that it is merely
99 // retrieving the primvarValue data source.
100 //
101 // The behavior of GetPrimvarValue might be conformed to simply return
102 // the primvarValue data source. Thus, clients who need the flattening
103 // behavior should explicitly call GetFlattenedPrimvarValue.
104 //
105 HD_API
106 HdSampledDataSourceHandle GetFlattenedPrimvarValue();
107
108// --(END CUSTOM CODE: Schema Methods)--
109
112
113 HD_API
114 HdIntArrayDataSourceHandle GetIndices() const;
115
116 HD_API
117 HdTokenDataSourceHandle GetInterpolation() const;
118
119 HD_API
120 HdTokenDataSourceHandle GetRole() const;
121
123
126
134 HD_API
135 static HdContainerDataSourceHandle
136 BuildRetained(
137 const HdSampledDataSourceHandle &primvarValue,
138 const HdSampledDataSourceHandle &indexedPrimvarValue,
139 const HdIntArrayDataSourceHandle &indices,
140 const HdTokenDataSourceHandle &interpolation,
141 const HdTokenDataSourceHandle &role
142 );
143
151 {
152 public:
153 HD_API
154 Builder &SetPrimvarValue(
155 const HdSampledDataSourceHandle &primvarValue);
156 HD_API
157 Builder &SetIndexedPrimvarValue(
158 const HdSampledDataSourceHandle &indexedPrimvarValue);
159 HD_API
160 Builder &SetIndices(
161 const HdIntArrayDataSourceHandle &indices);
162 HD_API
163 Builder &SetInterpolation(
164 const HdTokenDataSourceHandle &interpolation);
165 HD_API
166 Builder &SetRole(
167 const HdTokenDataSourceHandle &role);
168
170 HD_API
171 HdContainerDataSourceHandle Build();
172
173 private:
174 HdSampledDataSourceHandle _primvarValue;
175 HdSampledDataSourceHandle _indexedPrimvarValue;
176 HdIntArrayDataSourceHandle _indices;
177 HdTokenDataSourceHandle _interpolation;
178 HdTokenDataSourceHandle _role;
179
180 };
181
192 HD_API
193 static HdTokenDataSourceHandle BuildInterpolationDataSource(
194 const TfToken &interpolation);
195
208 HD_API
209 static HdTokenDataSourceHandle BuildRoleDataSource(
210 const TfToken &role);
211
213};
214
215PXR_NAMESPACE_CLOSE_SCOPE
216
217#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