ScummVM API documentation
gfx_tinygl.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 PLAYGROUND3D_GFX_TINYGL_H
23 #define PLAYGROUND3D_GFX_TINYGL_H
24 
25 #include "common/rect.h"
26 #include "common/system.h"
27 
28 #include "math/vector3d.h"
29 
30 #include "graphics/tinygl/tinygl.h"
31 
32 #include "engines/playground3d/gfx.h"
33 
34 namespace Playground3d {
35 
36 class TinyGLRenderer : public Renderer {
37 public:
38  TinyGLRenderer(OSystem *_system);
39  virtual ~TinyGLRenderer();
40 
41  void init() override;
42  void deinit() override;
43 
44  void clear(const Math::Vector4d &clearColor) override;
45  void loadTextureRGB(Graphics::Surface *texture) override;
46  void loadTextureRGBA(Graphics::Surface *texture) override;
47  void loadTextureRGB565(Graphics::Surface *texture) override;
48  void loadTextureRGBA5551(Graphics::Surface *texture) override;
49  void loadTextureRGBA4444(Graphics::Surface *texture) override;
50 
51  void setupViewport(int x, int y, int width, int height) override;
52  void drawCube(const Math::Vector3d &pos, const Math::Vector3d &roll) override;
53  void drawPolyOffsetTest(const Math::Vector3d &pos, const Math::Vector3d &roll) override;
54  void dimRegionInOut(float fade) override;
55  void drawInViewport() override;
56  void drawRgbaTexture() override;
57 
58  void enableFog(const Math::Vector4d &fogColor) override;
59 
60  void flipBuffer() override;
61 
62 private:
63  TinyGL::ContextHandle *_context;
64  Math::Vector3d _pos;
65  TGLuint _textureRgbaId[5];
66  TGLuint _textureRgbId[5];
67  TGLuint _textureRgb565Id[2];
68  TGLuint _textureRgba5551Id[2];
69  TGLuint _textureRgba4444Id[2];
70  TinyGL::BlitImage *_blitImageRgba;
71  TinyGL::BlitImage *_blitImageRgb;
72  TinyGL::BlitImage *_blitImageRgb565;
73  TinyGL::BlitImage *_blitImageRgba5551;
74  TinyGL::BlitImage *_blitImageRgba4444;
75 
76  void drawFace(uint face);
77 };
78 
79 } // End of namespace Playground3d
80 
81 #endif // PLAYGROUND3D_GFX_TINYGL_H
Definition: gfx.h:35
Definition: surface.h:67
Definition: gfx.h:37
Definition: system.h:161
Definition: gfx_tinygl.h:36