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
35namespace Tetraedge {
36
37class Te3DTexture : public TeResource {
38public:
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 bool hasAlpha() const { return _hasAlpha; }
49
50 bool load(const TetraedgeFSNode &path);
51 virtual bool load(const TeImage &img) = 0;
52 // The original passes a GL enum param, but it's only ever GL_INVALID or GL_ALPHA.
53 // Simplify to avoid leaking gl types.
54 static TeIntrusivePtr<Te3DTexture> load2(const TetraedgeFSNode &node, bool alphaOnly);
55
56 static TeVector2s32 optimisedSize(const TeVector2s32 &size);
57
58 virtual bool unload() = 0;
59 virtual void update(const TeImage &img, uint xoff, uint yoff) = 0;
60
61 virtual void writeTo(Graphics::Surface &surf) = 0;
62
63 uint width() const { return _width; }
64 uint height() const { return _height; }
65 void setLoadAlphaOnly() { _alphaOnly = true; }
66
67 static Te3DTexture *makeInstance();
68
69
70protected:
71 uint _width;
72 uint _height;
73 bool _createdTexture;
74 bool _loaded;
75 TeMatrix4x4 _matrix;
76
77 bool _hasAlpha;
78 bool _alphaOnly;
79
80 uint _texWidth;
81 uint _texHeight;
82 uint _leftBorder;
83 uint _btmBorder;
84 uint _rightBorder;
85 uint _topBorder;
86 bool _flipY;
87
88};
89
90} // end namespace Tetraedge
91
92#endif // TETRAEDGE_TE_TE_3D_TEXTURE_H
Definition: te_3d_texture.h:37
Definition: te_image.h:42
Definition: te_intrusive_ptr.h:31
Definition: te_matrix4x4.h:37
Definition: te_resource.h:31
Definition: te_vector2s32.h:31
Definition: tetraedge.h:65
Definition: surface.h:67