Loading...
Searching...
No Matches
subtextureIdentifier.h
1//
2// Copyright 2020 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_ST_SUBTEXTURE_IDENTIFIER_H
8#define PXR_IMAGING_HD_ST_SUBTEXTURE_IDENTIFIER_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12
13#include "pxr/base/tf/token.h"
14
15#include <memory>
16
17PXR_NAMESPACE_OPEN_SCOPE
18
20
29{
30public:
31 using ID = size_t;
32
33 HDST_API
34 virtual std::unique_ptr<HdStSubtextureIdentifier> Clone() const = 0;
35
36 HDST_API
38
39protected:
40 HDST_API
41 friend size_t hash_value(const HdStSubtextureIdentifier &subId);
42
43 virtual ID _Hash() const = 0;
44};
45
46HDST_API
47size_t hash_value(const HdStSubtextureIdentifier &subId);
48
56{
57public:
60 HDST_API
61 TfToken const &GetFieldName() const { return _fieldName; }
62
65 HDST_API
66 int GetFieldIndex() const { return _fieldIndex; }
67
68 HDST_API
70
71protected:
72 HDST_API
73 HdStFieldBaseSubtextureIdentifier(TfToken const &fieldName, int fieldIndex);
74
75 HDST_API
76 ID _Hash() const override;
77
78private:
79 TfToken _fieldName;
80 int _fieldIndex;
81};
82
97{
98public:
101 HDST_API
102 explicit HdStAssetUvSubtextureIdentifier(bool flipVertically,
103 bool premultiplyAlpha,
104 const TfToken& sourceColorSpace);
105
106 HDST_API
107 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
108
109 HDST_API
110 bool GetFlipVertically() const { return _flipVertically; }
111
112 HDST_API
113 bool GetPremultiplyAlpha() const { return _premultiplyAlpha; }
114
115 HDST_API
116 TfToken GetSourceColorSpace() const { return _sourceColorSpace; }
117
118 HDST_API
120
121protected:
122 HDST_API
123 ID _Hash() const override;
124
125private:
126 bool _flipVertically;
127 bool _premultiplyAlpha;
128 TfToken _sourceColorSpace;
129};
130
155{
156public:
157 HDST_API
159
160 HDST_API
162
163 HDST_API
164 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
165
168 HDST_API
170
171protected:
172 HDST_API
173 ID _Hash() const override;
174};
175
184{
185public:
187 HDST_API
188 explicit HdStPtexSubtextureIdentifier(bool premultiplyAlpha);
189
190 HDST_API
191 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
192
193 HDST_API
194 bool GetPremultiplyAlpha() const { return _premultiplyAlpha; }
195
196 HDST_API
198
199protected:
200 HDST_API
201 ID _Hash() const override;
202
203private:
204 bool _premultiplyAlpha;
205};
206
215{
216public:
219 HDST_API
220 explicit HdStUdimSubtextureIdentifier(bool premultiplyAlpha,
221 const TfToken& sourceColorSpace);
222
223 HDST_API
224 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
225
226 HDST_API
227 bool GetPremultiplyAlpha() const { return _premultiplyAlpha; }
228
229 HDST_API
230 TfToken GetSourceColorSpace() const { return _sourceColorSpace; }
231
232 HDST_API
234
235protected:
236 HDST_API
237 ID _Hash() const override;
238
239private:
240 bool _premultiplyAlpha;
241 TfToken _sourceColorSpace;
242};
243
244PXR_NAMESPACE_CLOSE_SCOPE
245
246#endif
Specifies whether a UV texture should be loaded flipped vertically, whether it should be loaded with ...
HDST_API HdStAssetUvSubtextureIdentifier(bool flipVertically, bool premultiplyAlpha, const TfToken &sourceColorSpace)
C'tor takes bool whether flipping vertically, whether to pre-multiply by alpha, and the texture's sou...
Used as a tag that the Storm texture system returns a HdStDynamicUvTextureObject that is populated by...
virtual HDST_API HdStDynamicUvTextureImplementation * GetTextureImplementation() const
Textures can return their own HdStDynamicUvTextureImplementation to customize the load and commit beh...
Allows external clients to specify how a UV texture is loaded from, e.g., a file and how it is commit...
Base class for information identifying a grid in a volume field file.
HDST_API int GetFieldIndex() const
Get field index.
HDST_API TfToken const & GetFieldName() const
Get field name.
Specifies whether a Ptex texture should be loaded with pre-multiplied alpha values.
HDST_API HdStPtexSubtextureIdentifier(bool premultiplyAlpha)
C'tor takes bool whether to pre-multiply by alpha.
Base class for additional information to identify a texture in a file that can contain several textur...
Specifies whether a Udim texture should be loaded with pre-multiplied alpha values and the color spac...
HDST_API HdStUdimSubtextureIdentifier(bool premultiplyAlpha, const TfToken &sourceColorSpace)
C'tor takes bool whether to pre-multiply by alpha and the texture's source color space.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...