HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
subtextureIdentifier.h
Go to the documentation of this file.
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 
35 
36 ///
37 /// \class HdStSubtextureIdentifier
38 ///
39 /// Base class for additional information to identify a texture in a
40 /// file that can contain several textures (e.g., frames in a movie or
41 /// grids in an OpenVDB file).
42 ///
44 {
45 public:
46  using ID = size_t;
47 
48  HDST_API
49  virtual std::unique_ptr<HdStSubtextureIdentifier> Clone() const = 0;
50 
51  HDST_API
52  virtual ID Hash() const;
53 
54  HDST_API
55  virtual ~HdStSubtextureIdentifier();
56 };
57 
58 ///
59 /// \class HdStVdbSubtextureIdentifier
60 ///
61 /// Identifies the grid in an OpenVDB file by its name.
62 ///
64 {
65 public:
66  /// C'tor using name of grid in OpenVDB file
67  HDST_API
68  explicit HdStVdbSubtextureIdentifier(TfToken const &gridName);
69 
70  HDST_API
71  std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
72 
73  HDST_API
74  ID Hash() const override;
75 
76  /// Name of grid in OpenVDB file
77  HDST_API
78  TfToken const &GetGridName() const { return _gridName; }
79 
80  HDST_API
82 
83 private:
84  TfToken _gridName;
85 };
86 
87 ///
88 /// \class HdStUvOrientationSubtextureIdentifier
89 ///
90 /// Specifies whether a UV texture should be loaded flipped vertically.
91 ///
92 /// This class is here for the texture system to support both the
93 /// legacy HwUvTexture_1 (flipVertically = true) and UsdUvTexture
94 /// (flipVertically = false) which have opposite conventions for the
95 /// vertical orientation.
96 ///
99 {
100 public:
101  /// C'tor takes bool whether flipping vertically
102  HDST_API
103  explicit HdStUvOrientationSubtextureIdentifier(bool flipVertically);
104 
105  HDST_API
106  std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
107 
108  HDST_API
109  ID Hash() const override;
110 
111  HDST_API
112  bool GetFlipVertically() const { return _flipVertically; }
113 
114  HDST_API
116 
117 private:
118  bool _flipVertically;
119 };
120 
121 ///
122 /// \class HdStDynamicUvSubtextureIdentifier
123 ///
124 /// Used as a tag that the Storm texture system returns a
125 /// HdStDynamicUvTextureObject that is populated by a client rather
126 /// than by the Storm texture system.
127 ///
129  : public HdStSubtextureIdentifier
130 {
131 public:
132  HDST_API
134 
135  HDST_API
137 
138  HDST_API
139  std::unique_ptr<HdStSubtextureIdentifier> Clone() const override;
140 
141  HDST_API
142  ID Hash() const override;
143 };
144 
146 
147 #endif
virtual HDST_API ~HdStSubtextureIdentifier()
virtual HDST_API ID Hash() const
HDST_API ID Hash() const override
HDST_API ID Hash() const override
HDST_API ID Hash() const override
HDST_API TfToken const & GetGridName() const
Name of grid in OpenVDB file.
Definition: token.h:87
HDST_API ~HdStVdbSubtextureIdentifier() override
HDST_API HdStUvOrientationSubtextureIdentifier(bool flipVertically)
C'tor takes bool whether flipping vertically.
HDST_API ~HdStUvOrientationSubtextureIdentifier() override
HDST_API HdStVdbSubtextureIdentifier(TfToken const &gridName)
C'tor using name of grid in OpenVDB file.
HDST_API std::unique_ptr< HdStSubtextureIdentifier > Clone() const override
HDST_API std::unique_ptr< HdStSubtextureIdentifier > Clone() const override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
virtual HDST_API std::unique_ptr< HdStSubtextureIdentifier > Clone() const =0
#define HDST_API
Definition: api.h:40
HDST_API ~HdStDynamicUvSubtextureIdentifier() override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
HDST_API std::unique_ptr< HdStSubtextureIdentifier > Clone() const override