ScummVM API documentation
te_3d_texture.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TETRAEDGE_TE_TE_3D_TEXTURE_H
23 #define TETRAEDGE_TE_TE_3D_TEXTURE_H
24 
25 #include "common/path.h"
26 #include "common/ptr.h"
27 #include "common/str.h"
28 
29 #include "tetraedge/te/te_image.h"
30 #include "tetraedge/te/te_intrusive_ptr.h"
31 #include "tetraedge/te/te_matrix4x4.h"
32 #include "tetraedge/te/te_resource.h"
33 #include "tetraedge/te/te_vector2s32.h"
34 
35 namespace Tetraedge {
36 
37 class Te3DTexture : public TeResource {
38 public:
39  Te3DTexture();
40  virtual ~Te3DTexture();
41 
42  virtual void bind() const = 0;
43  virtual void copyCurrentRender(uint xoffset, uint yoffset, uint x, uint y) = 0;
44  virtual void create() = 0;
45  virtual void destroy() = 0;
46  virtual void forceTexData(uint gltexture, uint xsize, uint ysize) = 0;
47 
48  TeImage::Format getFormat() const { return _format; }
49  bool hasAlpha() const;
50 
51  bool load(const Common::Path &path);
52  virtual bool load(const TeImage &img) = 0;
53  // The original passes a GL enum param, but it's only ever GL_INVALID or GL_ALPHA.
54  // Simplify to avoid leaking gl types.
55  static TeIntrusivePtr<Te3DTexture> load2(const Common::Path &path, bool alphaOnly);
56 
57  static TeVector2s32 optimisedSize(const TeVector2s32 &size);
58 
59  virtual bool unload() = 0;
60  virtual void update(const TeImage &img, uint xoff, uint yoff) = 0;
61 
62  virtual void writeTo(Graphics::Surface &surf) = 0;
63 
64  uint width() const { return _width; }
65  uint height() const { return _height; }
66  void setLoadAlphaOnly() { _alphaOnly = true; }
67 
68  static Te3DTexture *makeInstance();
69 
70 
71 protected:
72  uint _width;
73  uint _height;
74  TeImage::Format _format;
75  bool _createdTexture;
76  bool _loaded;
77  TeMatrix4x4 _matrix;
78 
79  bool _alphaOnly;
80 
81  uint _texWidth;
82  uint _texHeight;
83  uint _leftBorder;
84  uint _btmBorder;
85  uint _rightBorder;
86  uint _topBorder;
87  bool _flipY;
88 
89 };
90 
91 } // end namespace Tetraedge
92 
93 #endif // TETRAEDGE_TE_TE_3D_TEXTURE_H
Definition: te_image.h:40
Definition: detection.h:27
Definition: surface.h:67
Definition: te_resource.h:31
Definition: path.h:52
Definition: te_matrix4x4.h:37
Definition: te_3d_texture.h:37
Definition: te_intrusive_ptr.h:31
Definition: te_vector2s32.h:31