ScummVM API documentation
gfx_opengl_shaders.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_OPENGL_SHADERS_H
23 #define PLAYGROUND3D_GFX_OPENGL_SHADERS_H
24 
25 #include "common/rect.h"
26 
27 #include "math/rect2d.h"
28 
29 #include "graphics/opengl/shader.h"
30 #include "graphics/opengl/system_headers.h"
31 
32 #include "engines/playground3d/gfx.h"
33 
34 namespace Playground3d {
35 
36 class ShaderRenderer : public Renderer {
37 public:
38  ShaderRenderer(OSystem *_system);
39  virtual ~ShaderRenderer();
40 
41  void init() override;
42  void deinit() override;
43 
44  void clear(const Math::Vector4d &clearColor) override;
45  void loadTextureRGBA(Graphics::Surface *texture) override;
46  void loadTextureRGB(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 private:
61  OpenGL::Shader *_cubeShader;
62  OpenGL::Shader *_fadeShader;
63  OpenGL::Shader *_bitmapShader;
64 
65  GLuint _cubeVBO;
66  GLuint _fadeVBO;
67  GLuint _bitmapVBO;
68 
69  Common::Rect _currentViewport;
70  GLuint _textureRgbaId[5];
71  GLuint _textureRgbId[5];
72  GLuint _textureRgb565Id[2];
73  GLuint _textureRgba5551Id[2];
74  GLuint _textureRgba4444Id[2];
75 };
76 
77 } // End of namespace Playground3d
78 
79 #endif // PLAYGROUND3D_GFX_OPENGL_SHADERS_H
Definition: gfx.h:35
Definition: surface.h:67
Definition: rect.h:144
Definition: shader.h:56
Definition: gfx.h:37
Definition: gfx_opengl_shaders.h:36
Definition: system.h:161