scummvm/engines/grim/gfx_opengl.h

153 lines
4.8 KiB
C
Raw Normal View History

2012-01-06 23:29:45 +01:00
/* ResidualVM - A 3D game interpreter
2009-05-05 11:34:43 +00:00
*
2012-01-06 23:29:45 +01:00
* ResidualVM 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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
2009-05-07 19:06:31 +00:00
#ifdef USE_OPENGL
2009-05-05 11:34:43 +00:00
2011-05-21 18:08:12 +02:00
#if defined (SDL_BACKEND) && !defined(__amigaos4__)
2009-05-05 11:34:43 +00:00
#include <SDL_opengl.h>
2011-06-09 11:17:15 +02:00
#undef ARRAYSIZE
2009-05-07 19:06:31 +00:00
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
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();
byte *setupScreen(int screenW, int screenH, bool fullscreen) override;
2009-05-05 11:34:43 +00:00
const char *getVideoDeviceName() override;
2009-05-05 11:34:43 +00:00
void setupCamera(float fov, float nclip, float fclip, float roll) override;
void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float roll) 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;
2009-05-05 11:34:43 +00:00
void getBoundingBoxPos(const Mesh *model, int *x1, int *y1, int *x2, int *y2) override;
void getBoundingBoxPos(const EMIModel *model, int *x1, int *y1, int *x2, int *y2) 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;
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 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 createMaterial(Texture *material, const char *data, const CMap *cmap, bool clamp) override;
void selectMaterial(const Texture *material) override;
void destroyMaterial(Texture *material) 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) 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;
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 createSpecialtyTextures() override;
2009-05-05 11:34:43 +00:00
protected:
2011-05-13 14:11:04 -07:00
void drawDepthBitmap(int x, int y, int w, int h, 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;
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