Loading...
Searching...
No Matches
subtextureIdentifier.h
1//
2// Copyright 2020 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_IMAGING_HD_ST_SUBTEXTURE_IDENTIFIER_H
25#define PXR_IMAGING_HD_ST_SUBTEXTURE_IDENTIFIER_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hdSt/api.h"
29
30#include "pxr/base/tf/token.h"
31
32#include <memory>
33
34PXR_NAMESPACE_OPEN_SCOPE
35
37
46{
47public:
48 using ID = size_t;
49
50 HDST_API
51 virtual std::unique_ptr<HdStSubtextureIdentifier> Clone() const = 0;
52
53 HDST_API
55
56protected:
57 HDST_API
58 friend size_t hash_value(const HdStSubtextureIdentifier &subId);
59
60 virtual ID _Hash() const = 0;
61};
62
63HDST_API
64size_t hash_value(const HdStSubtextureIdentifier &subId);
65
73{
74public:
77 HDST_API
78 TfToken const &GetFieldName() const { return _fieldName; }
79
82 HDST_API
83 int GetFieldIndex() const { return _fieldIndex; }
84
85 HDST_API
87
88protected:
89 HDST_API
90 HdStFieldBaseSubtextureIdentifier(TfToken const &fieldName, int fieldIndex);
91
92 HDST_API
93 ID _Hash() const override;
94
95private:
96 TfToken _fieldName;
97 int _fieldIndex;
98};
99
114{
115public:
118 HDST_API
119 explicit HdStAssetUvSubtextureIdentifier(bool flipVertically,
120 bool premultiplyAlpha,
121 const TfToken& sourceColorSpace);
122
123 HDST_API
124 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
125
126 HDST_API
127 bool GetFlipVertically() const { return _flipVertically; }
128
129 HDST_API
130 bool GetPremultiplyAlpha() const { return _premultiplyAlpha; }
131
132 HDST_API
133 TfToken GetSourceColorSpace() const { return _sourceColorSpace; }
134
135 HDST_API
137
138protected:
139 HDST_API
140 ID _Hash() const override;
141
142private:
143 bool _flipVertically;
144 bool _premultiplyAlpha;
145 TfToken _sourceColorSpace;
146};
147
172{
173public:
174 HDST_API
176
177 HDST_API
179
180 HDST_API
181 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
182
185 HDST_API
187
188protected:
189 HDST_API
190 ID _Hash() const override;
191};
192
201{
202public:
204 HDST_API
205 explicit HdStPtexSubtextureIdentifier(bool premultiplyAlpha);
206
207 HDST_API
208 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
209
210 HDST_API
211 bool GetPremultiplyAlpha() const { return _premultiplyAlpha; }
212
213 HDST_API
215
216protected:
217 HDST_API
218 ID _Hash() const override;
219
220private:
221 bool _premultiplyAlpha;
222};
223
232{
233public:
236 HDST_API
237 explicit HdStUdimSubtextureIdentifier(bool premultiplyAlpha,
238 const TfToken& sourceColorSpace);
239
240 HDST_API
241 std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
242
243 HDST_API
244 bool GetPremultiplyAlpha() const { return _premultiplyAlpha; }
245
246 HDST_API
247 TfToken GetSourceColorSpace() const { return _sourceColorSpace; }
248
249 HDST_API
251
252protected:
253 HDST_API
254 ID _Hash() const override;
255
256private:
257 bool _premultiplyAlpha;
258 TfToken _sourceColorSpace;
259};
260
261PXR_NAMESPACE_CLOSE_SCOPE
262
263#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:88
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...