ScummVM API documentation
base_surface_opengl3d.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 WINTERMUTE_BASE_SURFACE_OPENGL3D_H
23 #define WINTERMUTE_BASE_SURFACE_OPENGL3D_H
24 
25 #include "engines/wintermute/base/gfx/base_surface.h"
26 
27 #if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
28 
29 #include "graphics/opengl/system_headers.h"
30 
31 namespace Wintermute {
32 
33 class BaseGame;
34 class BaseRenderer3D;
35 
36 class BaseSurfaceOpenGL3D : public BaseSurface {
37 public:
38  BaseSurfaceOpenGL3D(BaseGame* game, BaseRenderer3D* renderer);
39  ~BaseSurfaceOpenGL3D();
40 
41  bool invalidate() override;
42 
43  bool displayTransRotate(int x, int y, float rotate, int32 hotspotX, int32 hotspotY, Common::Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
44  bool displayTransZoom(int x, int y, Common::Rect32 rect, float zoomX, float zoomY, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
45  bool displayTrans(int x, int y, Common::Rect32 rect, uint32 alpha = 0xFFFFFFFF, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false, int offsetX = 0, int offsetY = 0) override;
46  bool display(int x, int y, Common::Rect32 rect, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL, bool mirrorX = false, bool mirrorY = false) override;
47  bool displayTiled(int x, int y, Common::Rect32 rect, int numTimesX, int numTimesY) override;
48  bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) override;
49  bool create(int width, int height) override;
50  bool setAlphaImage(const Common::String &filename) override;
51  bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override;
52  bool putPixel(int x, int y, byte r, byte g, byte b, byte a) override;
53  bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = nullptr) const override;
54  bool startPixelOp() override;
55  bool endPixelOp() override;
56  bool isTransparentAtLite(int x, int y) const override;
57 
58  void setTexture();
59 
60  GLuint getTextureName() {
61  return _tex;
62  }
63 
64  uint getGLTextureWidth() const {
65  return _texWidth;
66  }
67 
68  uint getGLTextureHeight() const {
69  return _texHeight;
70  }
71 
72 private:
73  GLuint _tex;
74  BaseRenderer3D *_renderer;
75  Graphics::Surface *_imageData;
76  Graphics::Surface *_maskData;
77  uint _texWidth;
78  uint _texHeight;
79  bool _pixelOpReady;
80  bool _surfaceModified;
81 
82  void writeAlpha(Graphics::Surface *surface, const Graphics::Surface *mask);
83 };
84 
85 } // End of namespace Wintermute
86 
87 #endif // defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
88 
89 #endif
Definition: rect.h:526
Definition: str.h:59
Definition: surface.h:67
Definition: achievements_tables.h:27