HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
textureIdentifier.h
Go to the documentation of this file.
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 
15 #include <memory>
16 
18 
20 
21 ///
22 /// \class HdStTextureIdentifier
23 ///
24 /// Class to identify a texture file or a texture within the texture file
25 /// (e.g., a frame in a movie).
26 ///
27 /// The class has value semantics and uses HdStSubtextureIdentifier in a
28 /// polymorphic way.
29 ///
31 {
32 public:
33  using ID = size_t;
34 
35  HDST_API
37 
38  /// C'tor for files that can contain only one texture.
39  ///
40  HDST_API
41  explicit HdStTextureIdentifier(const TfToken &filePath);
42 
43  /// C'tor for files that can contain more than one texture (e.g.,
44  /// frames in a movie, grids in a VDB file).
45  ///
46  HDST_API
48  const TfToken &filePath,
49  std::unique_ptr<const HdStSubtextureIdentifier> &&subtextureId);
50 
51  HDST_API
53 
54  HDST_API
56 
57  HDST_API
59 
60  HDST_API
62 
63  /// Get file path of texture file.
64  ///
65  const TfToken &GetFilePath() const {
66  return _filePath;
67  }
68 
69  /// Get additional information identifying a texture in a file that
70  /// can contain more than one texture (e.g., a frame in a movie or
71  /// a grid in a VDB file).
72  ///
73  /// nullptr for files (e.g., png) that can contain only one texture.
74  ///
76  return _subtextureId.get();
77  }
78 
79  HDST_API
80  bool operator==(const HdStTextureIdentifier &other) const;
81  HDST_API
82  bool operator!=(const HdStTextureIdentifier &other) const;
83 
84 private:
85  TfToken _filePath;
86  std::unique_ptr<const HdStSubtextureIdentifier> _subtextureId;
87 };
88 
90 size_t hash_value(const HdStTextureIdentifier &);
91 
93 
94 #endif
HDST_API bool operator!=(const HdStTextureIdentifier &other) const
HDST_API HdStTextureIdentifier()
Definition: token.h:70
const TfToken & GetFilePath() const
HDST_API HdStTextureIdentifier & operator=(HdStTextureIdentifier &&textureId)
HDST_API ~HdStTextureIdentifier()
HDST_API size_t hash_value(const HdStTextureIdentifier &)
HDST_API bool operator==(const HdStTextureIdentifier &other) const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
const HdStSubtextureIdentifier * GetSubtextureIdentifier() const
#define HDST_API
Definition: api.h:23
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74