24 #ifndef GLF_UVTEXTURE_DATA_H
25 #define GLF_UVTEXTURE_DATA_H
28 #include "pxr/imaging/glf/api.h"
29 #include "pxr/imaging/glf/image.h"
30 #include "pxr/imaging/glf/baseTextureData.h"
32 #include <boost/shared_ptr.hpp>
37 PXR_NAMESPACE_OPEN_SCOPE
40 typedef boost::shared_ptr<class GlfImage> GlfImageSharedPtr;
44 class GlfUVTextureData :
public GlfBaseTextureData {
57 return (targetMemory == rhs.targetMemory &&
58 cropTop == rhs.cropTop &&
59 cropBottom == rhs.cropBottom &&
60 cropLeft == rhs.cropLeft &&
61 cropRight == rhs.cropRight);
64 bool operator!=(
const Params& rhs)
const
66 return !(*
this == rhs);
70 unsigned int cropTop, cropBottom, cropLeft, cropRight;
74 static GlfUVTextureDataRefPtr
75 New(std::string
const &filePath,
78 unsigned int cropBottom,
79 unsigned int cropLeft,
80 unsigned int cropRight);
83 static GlfUVTextureDataRefPtr
84 New(std::string
const &filePath, Params
const ¶ms);
86 int NumDimensions()
const override;
88 const Params& GetParams()
const {
return _params; }
92 int ResizedWidth(
int mipLevel = 0)
const override;
95 int ResizedHeight(
int mipLevel = 0)
const override;
98 int ResizedDepth(
int mipLevel = 0)
const override;
100 GLenum GLInternalFormat()
const override {
101 return _glInternalFormat;
104 GLenum GLFormat()
const override {
108 GLenum GLType()
const override {
112 size_t TargetMemory()
const override {
113 return _targetMemory;
116 WrapInfo GetWrapInfo()
const override {
121 size_t ComputeBytesUsed()
const override;
124 size_t ComputeBytesUsedByMip(
int mipLevel = 0)
const override;
127 bool HasRawBuffer(
int mipLevel = 0)
const override;
130 unsigned char * GetRawBuffer(
int mipLevel = 0)
const override;
137 GlfImage::OriginUpperLeft)
override;
140 int GetNumMipLevels()
const override;
147 : size(0), offset(0), width(0), height(0)
159 struct _DegradedImageInput {
160 _DegradedImageInput(
double scaleX,
double scaleY,
161 GlfImageSharedPtr image) : scaleX(scaleX), scaleY(scaleY)
163 images.push_back(image);
166 _DegradedImageInput(
double scaleX,
double scaleY)
167 : scaleX(scaleX), scaleY(scaleY)
172 std::vector<GlfImageSharedPtr> images;
182 _DegradedImageInput _ReadDegradedImageInput(
bool generateMipmap,
184 size_t degradeLevel);
188 _DegradedImageInput _GetDegradedImageInputChain(
double scaleX,
196 int _GetNumMipLevelsValid(
const GlfImageSharedPtr image)
const;
198 GlfUVTextureData(std::string
const &filePath, Params
const ¶ms);
199 virtual ~GlfUVTextureData();
201 const std::string _filePath;
202 const Params _params;
204 size_t _targetMemory;
206 int _nativeWidth, _nativeHeight;
207 int _resizedWidth, _resizedHeight;
210 GLenum _glInternalFormat, _glFormat, _glType;
216 std::unique_ptr<unsigned char[]> _rawBuffer;
217 std::vector<Mip> _rawBufferMips;
221 PXR_NAMESPACE_CLOSE_SCOPE
223 #endif // GLF_UVTEXTURE_DATA_H
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
ImageOriginLocation
Specifies whether to treat the image origin as the upper-left corner or the lower left...
VT_API bool operator==(VtDictionary const &, VtDictionary const &)
Equality comparison.