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
21
30{
31public:
32 using ID = size_t;
33
34 HDST_API
35 virtual std::unique_ptr<HdStSubtextureIdentifier> Clone() const = 0;
36
37 HDST_API
39
40protected:
41 HDST_API
42 friend size_t hash_value(const HdStSubtextureIdentifier &subId);
43
44 virtual ID _Hash() const = 0;
45};
46
47HDST_API
48size_t hash_value(const HdStSubtextureIdentifier &subId);
49
57{
58public:
61 HDST_API
62 TfToken const &GetFieldName() const { return _fieldName; }
63
66 HDST_API
67 int GetFieldIndex() const { return _fieldIndex; }
68
69 HDST_API
71
72protected:
73 HDST_API
74 HdStFieldBaseSubtextureIdentifier(TfToken const &fieldName, int fieldIndex);
75
76 HDST_API
77 ID _Hash() const override;
78
79private:
80 TfToken _fieldName;
81 int _fieldIndex;
82};
83
98{
99public:
102 HDST_API
103 explicit HdStAssetUvSubtextureIdentifier(bool flipVertically,
104 bool premultiplyAlpha,
105 const TfToken& sourceColorSpace);
106
107 HDST_API
108 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
109
110 HDST_API
111 bool GetFlipVertically() const { return _flipVertically; }
112
113 HDST_API
114 bool GetPremultiplyAlpha() const { return _premultiplyAlpha; }
115
116 HDST_API
117 TfToken GetSourceColorSpace() const { return _sourceColorSpace; }
118
119 HDST_API
121
122protected:
123 HDST_API
124 ID _Hash() const override;
125
126private:
127 bool _flipVertically;
128 bool _premultiplyAlpha;
129 TfToken _sourceColorSpace;
130};
131
156{
157public:
158 HDST_API
160
161 HDST_API
163
164 HDST_API
165 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
166
169 HDST_API
171
172protected:
173 HDST_API
174 ID _Hash() const override;
175};
176
185{
186public:
188 HDST_API
189 explicit HdStPtexSubtextureIdentifier(bool premultiplyAlpha);
190
191 HDST_API
192 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
193
194 HDST_API
195 bool GetPremultiplyAlpha() const { return _premultiplyAlpha; }
196
197 HDST_API
199
200protected:
201 HDST_API
202 ID _Hash() const override;
203
204private:
205 bool _premultiplyAlpha;
206};
207
216{
217public:
220 HDST_API
221 explicit HdStUdimSubtextureIdentifier(bool premultiplyAlpha,
222 const TfToken& sourceColorSpace);
223
224 HDST_API
225 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
226
227 HDST_API
228 bool GetPremultiplyAlpha() const { return _premultiplyAlpha; }
229
230 HDST_API
231 TfToken GetSourceColorSpace() const { return _sourceColorSpace; }
232
233 HDST_API
235
236protected:
237 HDST_API
238 ID _Hash() const override;
239
240private:
241 bool _premultiplyAlpha;
242 TfToken _sourceColorSpace;
243};
244
257{
258public:
259 HDST_API
261
262 HDST_API
264
265 HDST_API
266 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
267
270 HDST_API
273
274protected:
275 HDST_API
276 ID _Hash() const override;
277};
278
279PXR_NAMESPACE_CLOSE_SCOPE
280
281#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 HdStDynamicCubemapTextureObject that is populat...
virtual HDST_API HdStDynamicCubemapTextureImplementation * GetTextureImplementation() const
Textures can return their own HdStDynamicUvTextureImplementation to customize the load and commit beh...
Allows external clients to specify how a cubemap texture is loaded from, e.g., a file and how it is c...
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...