ScummVM API documentation
gfx_opengl.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 FREESCAPE_GFX_OPENGL_H
23#define FREESCAPE_GFX_OPENGL_H
24
25#include "graphics/opengl/system_headers.h"
26#include "math/vector3d.h"
27#include "math/vector2d.h"
28
29#include "freescape/gfx.h"
30
31#ifdef USE_OPENGL_GAME
32
33namespace Freescape {
34
35class OpenGLRenderer : public Renderer {
36public:
37 OpenGLRenderer(int screenW, int screenH, Common::RenderMode renderMode, bool authenticGraphics);
38 virtual ~OpenGLRenderer();
39
40 struct Vertex {
41 GLfloat x;
42 GLfloat y;
43 GLfloat z;
44 };
45
46 void copyToVertexArray(uint idx, const Math::Vector3d &src) {
47 assert(idx < kVertexArraySize);
48 _verts[idx].x = src.x();
49 _verts[idx].y = src.y();
50 _verts[idx].z = src.z();
51 }
52
53 Vertex *_verts;
54
55 struct Coord {
56 GLfloat x;
57 GLfloat y;
58 };
59
60 Coord *_coords;
61
62 void copyToCoordArray(uint idx, const Math::Vector2d &src) {
63 assert(idx < kCoordsArraySize);
64 _coords[idx].x = src.getValue(0);
65 _coords[idx].y = src.getValue(1);
66 }
67
68 virtual void init() override;
69 virtual void clear(uint8 r, uint8 g, uint8 b, bool ignoreViewport = false) override;
70 virtual void clearDepthBuffer(bool ignoreViewport = false) override;
71 virtual void setViewport(const Common::Rect &rect) override;
72 virtual Common::Point nativeResolution() override;
73 virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float rollAngle = 0.0) override;
74 virtual void updateProjectionMatrix(float fov, float aspectRatio, float nearClipPlane, float farClipPlane) override;
75
76 virtual void useColor(uint8 r, uint8 g, uint8 b) override;
77 virtual void polygonOffset(bool enabled) override;
78 virtual void setStippleData(byte *data) override;
79 virtual void useStipple(bool enabled) override;
80 virtual void enableCulling(bool enabled) override;
81
82 virtual void setStereoEye(StereoEye eye) override;
83
84 Texture *createTexture(const Graphics::Surface *surface, bool is3D = false) override;
85 void freeTexture(Texture *texture) override;
86 virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture) override;
87
88 virtual void renderSensorShoot(byte color, const Math::Vector3d sensor, const Math::Vector3d player, const Common::Rect &viewPort) override;
89 virtual void renderPlayerShootBall(byte color, const Common::Point &position, int frame, const Common::Rect &viewPort) override;
90 virtual void renderPlayerShootRay(byte color, const Common::Point &position, const Common::Rect &viewPort) override;
91 virtual void renderCrossair(const Common::Point &crossairPosition) override;
92
93 virtual void renderFace(const Common::Array<Math::Vector3d> &vertices) override;
94
95 virtual void flipBuffer() override;
96 virtual void drawFloor(uint8 color) override;
97 virtual void fillViewportStippled(uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2, byte *stipple) override;
98 void drawCelestialBody(Math::Vector3d position, float radius, uint8 color) override;
99 void drawSkybox(Texture *texture, Math::Vector3d camera) override;
100 void drawThunder(Texture *texture, Math::Vector3d camera, float size) override;
101
102 virtual Graphics::Surface *getScreenshot() override;
103};
104
105} // End of namespace Freescape
106
107#endif
108
109#endif // FREESCAPE_GFX_OPENGL_H
RenderMode
Definition: rendermode.h:48
Definition: area.h:36
Definition: rect.h:144
Definition: rect.h:536
Definition: surface.h:67
Definition: display_client.h:53