All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
uvTexture.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 GLF_UVTEXTURE_H
25 #define GLF_UVTEXTURE_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/imaging/glf/api.h"
31 #include "pxr/imaging/glf/baseTexture.h"
32 
33 #include "pxr/base/tf/declarePtrs.h"
34 #include "pxr/base/tf/token.h"
35 
36 #include <string>
37 
38 PXR_NAMESPACE_OPEN_SCOPE
39 
40 
42 
50 class GlfUVTexture : public GlfBaseTexture {
51 public:
56  GLF_API
57  static GlfUVTextureRefPtr New(
58  TfToken const &imageFilePath,
59  unsigned int cropTop = 0,
60  unsigned int cropBottom = 0,
61  unsigned int cropLeft = 0,
62  unsigned int cropRight = 0,
63  GlfImage::ImageOriginLocation originLocation =
64  GlfImage::OriginUpperLeft);
65 
66  GLF_API
67  static GlfUVTextureRefPtr New(
68  std::string const &imageFilePath,
69  unsigned int cropTop = 0,
70  unsigned int cropBottom = 0,
71  unsigned int cropLeft = 0,
72  unsigned int cropRight = 0,
73  GlfImage::ImageOriginLocation originLocation =
74  GlfImage::OriginUpperLeft);
75 
76  int GetNumDimensions() const override;
77 
80  GLF_API
81  static bool IsSupportedImageFile(TfToken const &imageFilePath);
82  GLF_API
83  static bool IsSupportedImageFile(std::string const &imageFilePath);
84 
85  GLF_API
86  VtDictionary GetTextureInfo(bool forceLoad) override;
87 
88  GLF_API
89  bool IsMinFilterSupported(GLenum filter) override;
90 
91 protected:
92  GLF_API
94  TfToken const &imageFilePath,
95  unsigned int cropTop,
96  unsigned int cropBottom,
97  unsigned int cropLeft,
98  unsigned int cropRight,
99  GlfImage::ImageOriginLocation originLocation =
100  GlfImage::OriginUpperLeft);
101 
102  GLF_API
103  void _ReadTexture() override;
104 
105  GLF_API
106  virtual bool _GenerateMipmap() const;
107  GLF_API
108  const TfToken& _GetImageFilePath() const;
109  unsigned int _GetCropTop() const {return _cropTop;}
110  unsigned int _GetCropBottom() const {return _cropBottom;}
111  unsigned int _GetCropLeft() const {return _cropLeft;}
112  unsigned int _GetCropRight() const {return _cropRight;}
113 
114 private:
115  const TfToken _imageFilePath;
116  const unsigned int _cropTop;
117  const unsigned int _cropBottom;
118  const unsigned int _cropLeft;
119  const unsigned int _cropRight;
120 };
121 
122 
123 PXR_NAMESPACE_CLOSE_SCOPE
124 
125 #endif // GLF_UVTEXTURE_H
int GetNumDimensions() const override
Is this a 1-, 2- or 3-dimensional texture.
Represents a texture object in Glf.
Definition: uvTexture.h:50
A map with string keys and VtValue values.
Definition: dictionary.h:61
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:89
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
static GLF_API GlfUVTextureRefPtr New(TfToken const &imageFilePath, unsigned int cropTop=0, unsigned int cropBottom=0, unsigned int cropLeft=0, unsigned int cropRight=0, GlfImage::ImageOriginLocation originLocation=GlfImage::OriginUpperLeft)
Creates a new texture instance for the image file at imageFilePath.
ImageOriginLocation
Specifies whether to treat the image origin as the upper-left corner or the lower left...
Definition: image.h:60
Represents a texture object in Glf.
Definition: baseTexture.h:52
static GLF_API bool IsSupportedImageFile(TfToken const &imageFilePath)
Returns true if the file at imageFilePath is an image that can be used with this texture object...