scummvm/engines/grim/gfx_opengl.h

156 lines
5.1 KiB
C
Raw Normal View History

2021-12-26 21:19:38 +01:00
/* ScummVM - Graphic Adventure Engine
2009-05-05 11:34:43 +00:00
*
2021-12-26 21:19:38 +01:00
* ScummVM is the legal property of its developers, whose names
2011-04-16 14:12:44 +02:00
* are too numerous to list here. Please refer to the COPYRIGHT
2009-05-05 11:34:43 +00:00
* file distributed with this source distribution.
*
* 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.
2014-04-05 18:18:42 +02:00
*
* This program is distributed in the hope that it will be useful,
2009-05-05 11:34:43 +00:00
* 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.
2014-04-05 18:18:42 +02:00
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2009-05-05 11:34:43 +00:00
*
*/
2009-05-26 09:39:42 +00:00
#ifndef GRIM_GFX_OPENGL_H
#define GRIM_GFX_OPENGL_H
2009-05-05 11:34:43 +00:00
#include "engines/grim/gfx_base.h"
2009-05-05 11:34:43 +00:00
#ifdef USE_OPENGL_GAME
2009-05-05 11:34:43 +00:00
#include "graphics/opengl/system_headers.h"
2009-05-05 11:34:43 +00:00
2009-05-25 06:49:57 +00:00
namespace Grim {
class ModelNode;
class Mesh;
class MeshFace;
2009-05-07 19:06:31 +00:00
class GfxOpenGL : public GfxBase {
2009-05-05 11:34:43 +00:00
public:
2009-05-07 19:06:31 +00:00
GfxOpenGL();
virtual ~GfxOpenGL();
void setupScreen(int screenW, int screenH) override;
2009-05-05 11:34:43 +00:00
const char *getVideoDeviceName() override;
2009-05-05 11:34:43 +00:00
void setupCameraFrustum(float fov, float nclip, float fclip) override;
void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float roll) override;
void positionCamera(const Math::Vector3d &pos, const Math::Matrix4 &rot) override;
Math::Matrix4 getModelView() override;
Math::Matrix4 getProjection() override;
2009-05-05 11:34:43 +00:00
void clearScreen() override;
void clearDepthBuffer() override;
void flipBuffer() override;
2009-05-05 11:34:43 +00:00
bool isHardwareAccelerated() override;
bool supportsShaders() override;
2009-05-05 11:34:43 +00:00
void getScreenBoundingBox(const Mesh *model, int *x1, int *y1, int *x2, int *y2) override;
void getScreenBoundingBox(const EMIModel *model, int *x1, int *y1, int *x2, int *y2) override;
void getActorScreenBBox(const Actor *actor, Common::Point &p1, Common::Point &p2) override;
2009-05-05 11:34:43 +00:00
void startActorDraw(const Actor *actor) override;
void finishActorDraw() override;
void setShadow(Shadow *shadow) override;
void drawShadowPlanes() override;
void setShadowMode() override;
void clearShadowMode() override;
void setShadowColor(byte r, byte g, byte b) override;
void getShadowColor(byte *r, byte *g, byte *b) override;
2009-05-05 11:34:43 +00:00
void set3DMode() override;
2009-05-05 11:34:43 +00:00
void translateViewpointStart() override;
void translateViewpoint(const Math::Vector3d &vec) override;
void rotateViewpoint(const Math::Angle &angle, const Math::Vector3d &axis) override;
2014-06-25 17:15:41 +03:00
void rotateViewpoint(const Math::Matrix4 &rot) override;
void translateViewpointFinish() override;
2009-05-05 11:34:43 +00:00
void drawEMIModelFace(const EMIModel *model, const EMIMeshFace *face) override;
void drawModelFace(const Mesh *mesh, const MeshFace *face) override;
void drawSprite(const Sprite *sprite) override;
2009-05-05 11:34:43 +00:00
void drawOverlay(const Overlay *overlay) override;
void enableLights() override;
void disableLights() override;
void setupLight(Light *light, int lightId) override;
void turnOffLight(int lightId) override;
2009-05-05 11:34:43 +00:00
void createTexture(Texture *texture, const uint8 *data, const CMap *cmap, bool clamp) override;
void selectTexture(const Texture *texture) override;
void destroyTexture(Texture *texture) override;
2009-05-05 11:34:43 +00:00
void createBitmap(BitmapData *bitmap) override;
void drawBitmap(const Bitmap *bitmap, int x, int y, uint32 layer) override;
void destroyBitmap(BitmapData *bitmap) override;
2009-05-05 11:34:43 +00:00
void createFont(Font *font) override;
void destroyFont(Font *font) override;
void createTextObject(TextObject *text) override;
void drawTextObject(const TextObject *text) override;
void destroyTextObject(TextObject *text) override;
2011-05-22 20:43:28 -07:00
Bitmap *getScreenshot(int w, int h, bool useStored) override;
void storeDisplay() override;
void copyStoredToDisplay() override;
void dimScreen() override;
void dimRegion(int x, int y, int w, int h, float level) override;
void irisAroundRegion(int x1, int y1, int x2, int y2) override;
2009-05-05 11:34:43 +00:00
void drawEmergString(int x, int y, const char *text, const Color &fgColor) override;
void loadEmergFont() override;
2009-05-05 11:34:43 +00:00
void drawRectangle(const PrimitiveObject *primitive) override;
void drawLine(const PrimitiveObject *primitive) override;
void drawPolygon(const PrimitiveObject *primitive) override;
void drawDimPlane() override;
2009-05-05 11:34:43 +00:00
void prepareMovieFrame(Graphics::Surface *frame) override;
void drawMovieFrame(int offsetX, int offsetY) override;
void releaseMovieFrame() override;
2009-05-05 11:34:43 +00:00
void setBlendMode(bool additive) override;
2009-05-05 11:34:43 +00:00
protected:
void createSpecialtyTextureFromScreen(uint id, uint8 *data, int x, int y, int width, int height) override;
void drawDepthBitmap(int x, int y, int w, int h, const char *data);
void initExtensions();
2009-05-05 11:34:43 +00:00
private:
GLuint _emergFont;
int _smushNumTex;
GLuint *_smushTexIds;
int _smushWidth;
int _smushHeight;
byte *_storedDisplay;
bool _useDepthShader;
GLuint _fragmentProgram;
bool _useDimShader;
GLuint _dimFragProgram;
GLint _maxLights;
float _alpha;
const Actor *_currentActor;
GLenum _depthFunc;
void readPixels(int x, int y, int width, int height, uint8 *buffer);
2009-05-05 11:34:43 +00:00
};
2009-05-25 06:49:57 +00:00
} // end of namespace Grim
2009-05-07 19:06:31 +00:00
#endif
#endif