HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
baseTextureData.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_BASE_TEXTURE_DATA_H
25 #define PXR_IMAGING_GLF_BASE_TEXTURE_DATA_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/glf/api.h"
29 #include "pxr/imaging/glf/image.h"
30 #include "pxr/imaging/glf/utils.h"
31 #include "pxr/imaging/garch/gl.h"
33 #include "pxr/base/tf/refPtr.h"
34 #include "pxr/base/tf/weakPtr.h"
35 
36 
38 
39 
41 
43  public TfWeakBase
44 {
45 public:
46  GlfBaseTextureData() = default;
47 
48  GLF_API
49  virtual ~GlfBaseTextureData();
50 
51  // Disallow copies
52  GlfBaseTextureData(const GlfBaseTextureData&) = delete;
54 
55  struct WrapInfo {
57  hasWrapModeS(false), hasWrapModeT(false), hasWrapModeR(false),
59 
60  bool hasWrapModeS;
66  };
67 
68  /// Is this a 1-, 2- or 3-dimensional texture.
69  virtual int NumDimensions() const = 0;
70 
71  virtual int ResizedWidth(int mipLevel = 0) const = 0;
72 
73  virtual int ResizedHeight(int mipLevel = 0) const = 0;
74 
75  virtual int ResizedDepth(int mipLevel = 0) const = 0;
76 
77  virtual GLenum GLInternalFormat() const = 0;
78 
79  virtual GLenum GLFormat() const = 0;
80 
81  virtual GLenum GLType() const = 0;
82 
83  virtual size_t TargetMemory() const = 0;
84 
85  virtual WrapInfo GetWrapInfo() const = 0;
86 
87  virtual size_t ComputeBytesUsed() const = 0;
88 
89  virtual size_t ComputeBytesUsedByMip(int mipLevel = 0) const = 0;
90 
91  virtual bool Read(int degradeLevel,
92  bool generateMipmap,
93  GlfImage::ImageOriginLocation originLocation =
95 
96  virtual bool HasRawBuffer(int mipLevel = 0) const = 0;
97 
98  virtual unsigned char * GetRawBuffer(int mipLevel = 0) const = 0;
99 
100  virtual int GetNumMipLevels() const = 0;
101 
102  virtual bool IsCompressed() const {
104  }
105 
106 protected:
107  // Map image format and type and encoding to GL format.
108  GLF_API
110  GLenum format, GLenum type, bool isSRGB);
111 
112 };
113 
114 
116 
117 #endif // GLF_BASETEXTURE_DATA
virtual size_t ComputeBytesUsed() const =0
virtual int ResizedDepth(int mipLevel=0) const =0
GLF_API bool GlfIsCompressedFormat(GLenum format)
#define GLF_API
Definition: api.h:40
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(GlfBaseTextureData)
ImageOriginLocation
Definition: image.h:58
virtual bool HasRawBuffer(int mipLevel=0) const =0
virtual size_t TargetMemory() const =0
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glew.h:1254
unsigned int GLenum
Definition: cl.hpp:166
virtual int NumDimensions() const =0
Is this a 1-, 2- or 3-dimensional texture.
GlfBaseTextureData & operator=(const GlfBaseTextureData &)=delete
virtual GLenum GLType() const =0
static GLF_API GLenum _GLInternalFormatFromImageData(GLenum format, GLenum type, bool isSRGB)
virtual GLenum GLFormat() const =0
virtual int GetNumMipLevels() const =0
virtual WrapInfo GetWrapInfo() const =0
virtual bool IsCompressed() const
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
virtual unsigned char * GetRawBuffer(int mipLevel=0) const =0
virtual GLenum GLInternalFormat() const =0
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
#define GL_REPEAT
Definition: glew.h:725
GlfBaseTextureData()=default
virtual int ResizedWidth(int mipLevel=0) const =0
virtual GLF_API ~GlfBaseTextureData()
virtual size_t ComputeBytesUsedByMip(int mipLevel=0) const =0
virtual bool Read(int degradeLevel, bool generateMipmap, GlfImage::ImageOriginLocation originLocation=GlfImage::OriginUpperLeft)=0
virtual int ResizedHeight(int mipLevel=0) const =0