2022-08-13 11:16:55 +02:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2021-04-24 13:32:05 -03:00
|
|
|
*
|
2022-08-13 11:16:55 +02:00
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
2021-04-24 13:32:05 -03:00
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2022-08-13 11:16:55 +02:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2021-04-24 13:32:05 -03:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2022-08-13 11:16:55 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2021-04-24 13:32:05 -03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-10-31 09:10:07 +01:00
|
|
|
#ifndef FREESCAPE_GFX_TINYGL_H
|
|
|
|
#define FREESCAPE_GFX_TINYGL_H
|
2021-04-24 13:32:05 -03:00
|
|
|
|
|
|
|
#include "math/vector3d.h"
|
|
|
|
|
2022-11-01 13:44:21 +01:00
|
|
|
#include "freescape/gfx.h"
|
2021-04-24 13:32:05 -03:00
|
|
|
|
|
|
|
namespace Freescape {
|
|
|
|
|
|
|
|
class TinyGLRenderer : public Renderer {
|
|
|
|
public:
|
2022-11-06 19:51:46 +01:00
|
|
|
TinyGLRenderer(int screenW, int screenH, Common::RenderMode renderMode);
|
2021-04-24 13:32:05 -03:00
|
|
|
virtual ~TinyGLRenderer();
|
|
|
|
|
2022-11-04 10:13:46 +01:00
|
|
|
struct Vertex {
|
|
|
|
TGLfloat x;
|
|
|
|
TGLfloat y;
|
|
|
|
TGLfloat z;
|
|
|
|
};
|
|
|
|
|
|
|
|
void copyToVertexArray(uint idx, const Math::Vector3d &src) {
|
2022-11-06 21:41:55 +01:00
|
|
|
assert(idx < kVertexArraySize);
|
2022-11-04 10:13:46 +01:00
|
|
|
_verts[idx].x = src.x(); _verts[idx].y = src.y(); _verts[idx].z = src.z();
|
|
|
|
}
|
|
|
|
|
|
|
|
Vertex *_verts;
|
|
|
|
|
2021-04-24 13:32:05 -03:00
|
|
|
virtual void init() override;
|
2023-07-11 22:57:50 +02:00
|
|
|
virtual void clear(uint8 r, uint8 g, uint8 b, bool ignoreViewport = false) override;
|
2022-07-15 21:19:36 +02:00
|
|
|
virtual void setViewport(const Common::Rect &rect) override;
|
2021-10-10 17:51:06 +02:00
|
|
|
virtual void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest) override;
|
|
|
|
virtual void updateProjectionMatrix(float fov, float nearClipPlane, float farClipPlane) override;
|
2021-04-24 13:32:05 -03:00
|
|
|
|
2022-11-04 18:47:16 +01:00
|
|
|
virtual void useColor(uint8 r, uint8 g, uint8 b) override;
|
|
|
|
virtual void polygonOffset(bool enabled) override;
|
|
|
|
|
2021-04-24 13:32:05 -03:00
|
|
|
Texture *createTexture(const Graphics::Surface *surface) override;
|
|
|
|
void freeTexture(Texture *texture) override;
|
2022-07-04 20:28:45 +02:00
|
|
|
virtual void drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect, Texture *texture) override;
|
2021-10-23 21:49:50 +02:00
|
|
|
|
2022-11-26 22:53:47 +01:00
|
|
|
virtual void renderSensorShoot(byte color, const Math::Vector3d sensor, const Math::Vector3d player, const Common::Rect viewPort) override;
|
2023-11-15 09:37:06 +01:00
|
|
|
virtual void renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewPort) override;
|
|
|
|
virtual void renderPlayerShootRay(byte color, const Common::Point position, const Common::Rect viewPort) override;
|
2023-08-06 10:36:22 +02:00
|
|
|
virtual void renderCrossair(const Common::Point crossairPosition) override;
|
|
|
|
|
2022-10-26 21:57:23 +02:00
|
|
|
virtual void renderFace(const Common::Array<Math::Vector3d> &vertices) override;
|
2021-10-23 21:49:50 +02:00
|
|
|
|
2021-04-24 13:32:05 -03:00
|
|
|
virtual void flipBuffer() override;
|
2021-10-11 18:05:28 +02:00
|
|
|
virtual void drawFloor(uint8 color) override;
|
2022-11-29 22:04:08 +01:00
|
|
|
virtual Graphics::Surface *getScreenshot() override;
|
2021-04-24 13:32:05 -03:00
|
|
|
};
|
|
|
|
|
2022-07-02 17:59:03 +02:00
|
|
|
} // End of namespace Freescape
|
2021-04-24 13:32:05 -03:00
|
|
|
|
2022-10-31 09:10:07 +01:00
|
|
|
#endif // FREESCAPE_GFX_TINYGL_H
|