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 GFX_OPENGL_SHADERS_H_
23#define GFX_OPENGL_SHADERS_H_
24
25#include "common/rect.h"
26
27#include "math/rect2d.h"
28
29#include "graphics/opengl/shader.h"
30
31#include "engines/myst3/gfx.h"
32
33namespace Myst3 {
34
35class ShaderRenderer : public Renderer {
36public:
37 ShaderRenderer(OSystem *_system);
38 virtual ~ShaderRenderer();
39
40 void init() override;
41
42 void clear() override;
43 void selectTargetWindow(Window *window, bool is3D, bool scaled) override;
44
45 Texture *createTexture3D(const Graphics::Surface *surface) override;
46
47 void drawRect2D(const Common::Rect &rect, uint8 a, uint8 r, uint8 g, uint8 b) override;
48 virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture,
49 float transparency = -1.0, bool additiveBlending = false) override;
50 virtual void drawTexturedRect3D(const Math::Vector3d &topLeft, const Math::Vector3d &bottomLeft,
51 const Math::Vector3d &topRight, const Math::Vector3d &bottomRight,
52 Texture *texture) override;
53
54 void drawCube(Texture **textures) override;
55 void draw2DText(const Common::String &text, const Common::Point &position) override;
56
57 Graphics::Surface *getScreenshot() override;
58 Texture *copyScreenshotToTexture() override;
59
60private:
61 void setupQuadEBO();
62 Math::Vector2d scaled(float x, float y) const;
63
64 OpenGL::Shader *_boxShader;
65 OpenGL::Shader *_cubeShader;
66 OpenGL::Shader *_rect3dShader;
67 OpenGL::Shader *_textShader;
68
69 GLuint _boxVBO;
70 GLuint _cubeVBO;
71 GLuint _rect3dVBO;
72 GLuint _textVBO;
73 GLuint _quadEBO;
74
75 Common::Rect _currentViewport;
76
77 Common::String _prevText;
78 Common::Point _prevTextPosition;
79};
80
81} // End of namespace Myst3
82
83#endif
Definition: str.h:59
Definition: gfx.h:107
Definition: gfx_opengl_shaders.h:35
void selectTargetWindow(Window *window, bool is3D, bool scaled) override
Definition: gfx.h:93
Definition: gfx.h:65
Definition: system.h:166
Definition: shader.h:56
Definition: rect.h:144
Definition: rect.h:536
Definition: surface.h:67