Loading...
Searching...
No Matches
textureIdentifier.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_TEXTURE_IDENTIFIER_H
8#define PXR_IMAGING_HD_ST_TEXTURE_IDENTIFIER_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12
13#include "pxr/base/tf/token.h"
14#include "pxr/base/vt/value.h"
15
16#include <memory>
17
18PXR_NAMESPACE_OPEN_SCOPE
19
21
32{
33public:
34 using ID = size_t;
35
36 HDST_API
38
41 HDST_API
43 const TfToken &filePath,
44 const VtValue &fallback = VtValue(),
45 bool defaultToFallback = false);
46
50 HDST_API
52 const TfToken &filePath,
53 std::unique_ptr<const HdStSubtextureIdentifier> &&subtextureId,
54 const VtValue &fallback = VtValue(),
55 bool defaultToFallback = false);
56
57 HDST_API
59
60 HDST_API
61 HdStTextureIdentifier &operator=(HdStTextureIdentifier &&textureId);
62
63 HDST_API
64 HdStTextureIdentifier &operator=(const HdStTextureIdentifier &textureId);
65
66 HDST_API
68
71 const TfToken &GetFilePath() const {
72 return _filePath;
73 }
74
77 const VtValue &GetFallback() const {
78 return _fallback;
79 }
80
84 return _defaultToFallback;
85 }
86
94 return _subtextureId.get();
95 }
96
97 HDST_API
98 bool operator==(const HdStTextureIdentifier &other) const;
99 HDST_API
100 bool operator!=(const HdStTextureIdentifier &other) const;
101
102private:
103 TfToken _filePath;
104 VtValue _fallback;
105 bool _defaultToFallback = false;
106 std::unique_ptr<const HdStSubtextureIdentifier> _subtextureId;
107};
108
109HDST_API
110size_t hash_value(const HdStTextureIdentifier &);
111
112PXR_NAMESPACE_CLOSE_SCOPE
113
114#endif
Base class for additional information to identify a texture in a file that can contain several textur...
Class to identify a texture file or a texture within the texture file (e.g., a frame in a movie).
HDST_API HdStTextureIdentifier(const TfToken &filePath, std::unique_ptr< const HdStSubtextureIdentifier > &&subtextureId, const VtValue &fallback=VtValue(), bool defaultToFallback=false)
C'tor for files that can contain more than one texture (e.g., frames in a movie, grids in a VDB file)...
const HdStSubtextureIdentifier * GetSubtextureIdentifier() const
Get additional information identifying a texture in a file that can contain more than one texture (e....
const TfToken & GetFilePath() const
Get file path of texture file.
HDST_API HdStTextureIdentifier(const TfToken &filePath, const VtValue &fallback=VtValue(), bool defaultToFallback=false)
C'tor for files that can contain only one texture.
bool ShouldDefaultToFallback() const
Get if reading from _filePath should be skipped.
const VtValue & GetFallback() const
Get fallback value that's used if loading from _filePath fails.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:90
std::size_t hash_value(const half h)
Overload hash_value for half.
Definition: half.h:30
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...