HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
uvTextureStorageData.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 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_GLF_UV_TEXTURE_STORAGE_DATA_H
25 #define PXR_IMAGING_GLF_UV_TEXTURE_STORAGE_DATA_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/glf/api.h"
29 #include "pxr/imaging/glf/image.h"
31 
32 #include "pxr/base/vt/value.h"
33 
35 
36 
38 
40 {
41 public:
42  GLF_API
43  static GlfUVTextureStorageDataRefPtr
44  New(unsigned int width,
45  unsigned int height,
46  const VtValue &storageData);
47 
48  GLF_API
49  virtual ~GlfUVTextureStorageData();
50 
51  int NumDimensions() const override;
52 
53  // GlfBaseTextureData overrides
54  int ResizedWidth(int mipLevel = 0) const override {
55  return _resizedWidth;
56  };
57 
58  int ResizedHeight(int mipLevel = 0) const override {
59  return _resizedHeight;
60  };
61 
62  int ResizedDepth(int mipLevel = 0) const override {
63  return 1;
64  };
65 
66  GLenum GLInternalFormat() const override {
67  return _glInternalFormat;
68  };
69 
70  GLenum GLFormat() const override {
71  return _glFormat;
72  };
73 
74  GLenum GLType() const override {
75  return _glType;
76  };
77 
78  size_t TargetMemory() const override {
79  return _targetMemory;
80  };
81 
82  WrapInfo GetWrapInfo() const override {
83  return _wrapInfo;
84  };
85 
86  GLF_API
87  size_t ComputeBytesUsed() const override;
88 
89  size_t ComputeBytesUsedByMip(int mipLevel = 0) const override {
90  return ComputeBytesUsed();
91  }
92 
93  GLF_API
94  bool HasRawBuffer(int mipLevel = 0) const override;
95 
96  GLF_API
97  unsigned char * GetRawBuffer(int mipLevel = 0) const override;
98 
99  GLF_API
100  bool Read(
101  int degradeLevel,
102  bool generateMipmap,
103  GlfImage::ImageOriginLocation originLocation =
104  GlfImage::OriginUpperLeft) override;
105 
106  GLF_API
107  bool IsCompressed() const override;
108 
109  GLF_API
110  int GetNumMipLevels() const override;
111 
112 private:
113 
115  unsigned int width,
116  unsigned int height,
117  const VtValue &storageData);
118 
119  size_t _targetMemory;
120 
121  int _resizedWidth, _resizedHeight;
122  int _bytesPerPixel;
123 
124  // Note: may not want to retain copy of original data
125  // if _storageData is used for larger images
126  VtValue _storageData;
127 
128  GLenum _glInternalFormat, _glFormat, _glType;
129 
130  WrapInfo _wrapInfo;
131 
132  int _size;
133 
134  unsigned char *_rawBuffer;
135 };
136 
138 
139 #endif // PXR_IMAGING_GLF_UV_TEXTURE_STORAGE_DATA_H
virtual GLF_API ~GlfUVTextureStorageData()
int ResizedDepth(int mipLevel=0) const override
#define GLF_API
Definition: api.h:40
GLenum GLFormat() const override
int ResizedWidth(int mipLevel=0) const override
WrapInfo GetWrapInfo() const override
GLint GLint GLint GLint GLint GLint GLsizei width
Definition: glew.h:1252
ImageOriginLocation
Definition: image.h:58
GLF_API bool Read(int degradeLevel, bool generateMipmap, GlfImage::ImageOriginLocation originLocation=GlfImage::OriginUpperLeft) override
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
Definition: glew.h:1252
int ResizedHeight(int mipLevel=0) const override
unsigned int GLenum
Definition: cl.hpp:166
int NumDimensions() const override
Is this a 1-, 2- or 3-dimensional texture.
size_t ComputeBytesUsedByMip(int mipLevel=0) const override
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(GlfUVTextureStorageData)
size_t TargetMemory() const override
GLF_API int GetNumMipLevels() const override
GLF_API size_t ComputeBytesUsed() const override
GLF_API unsigned char * GetRawBuffer(int mipLevel=0) const override
GLenum GLInternalFormat() const override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
static GLF_API GlfUVTextureStorageDataRefPtr New(unsigned int width, unsigned int height, const VtValue &storageData)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: value.h:174
GLenum GLType() const override
GLF_API bool HasRawBuffer(int mipLevel=0) const override
GLF_API bool IsCompressed() const override