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 OpenGL {
35 class Texture;
36 }
37 
38 namespace Playground3d {
39 
40 class ShaderRenderer : public Renderer {
41 public:
42  ShaderRenderer(OSystem *_system);
43  virtual ~ShaderRenderer();
44 
45  void init() override;
46  void deinit() override;
47 
48  void clear(const Math::Vector4d &clearColor) override;
49  void loadTextureRGBA(Graphics::Surface *texture) override;
50  void loadTextureRGB(Graphics::Surface *texture) override;
51  void loadTextureRGB565(Graphics::Surface *texture) override;
52  void loadTextureRGBA5551(Graphics::Surface *texture) override;
53  void loadTextureRGBA4444(Graphics::Surface *texture) override;
54 
55  void setupViewport(int x, int y, int width, int height) override;
56  void drawCube(const Math::Vector3d &pos, const Math::Vector3d &roll) override;
57  void drawPolyOffsetTest(const Math::Vector3d &pos, const Math::Vector3d &roll) override;
58  void dimRegionInOut(float fade) override;
59  void drawInViewport() override;
60  void drawRgbaTexture() override;
61 
62  void enableFog(const Math::Vector4d &fogColor) override;
63  void disableFog() override;
64 
65  void enableScissor(int x, int y, int width, int height) override;
66  void disableScissor() override;
67 
68 private:
69  OpenGL::Shader *_cubeShader;
70  OpenGL::Shader *_offsetShader;
71  OpenGL::Shader *_fadeShader;
72  OpenGL::Shader *_viewportShader;
73  OpenGL::Shader *_bitmapShader;
74 
75  GLuint _cubeVBO;
76  GLuint _offsetVBO;
77  GLuint _fadeVBO;
78  GLuint _viewportVBO;
79  GLuint _bitmapVBO;
80  GLuint _bitmapTexVBO;
81 
82  Common::Rect _currentViewport;
83  Math::Vector2d _pos;
85 };
86 
87 } // End of namespace Playground3d
88 
89 #endif // PLAYGROUND3D_GFX_OPENGL_SHADERS_H
Definition: gfx.h:35
Definition: surface.h:67
Definition: rect.h:524
Definition: shader.h:56
Definition: gfx.h:48
Definition: renderbuffer.h:27
Definition: texture.h:48
Definition: gfx_opengl_shaders.h:40
T MAX(T a, T b)
Definition: util.h:64
Definition: system.h:163