scummvm/engines/grim/gfx_opengl.h

148 lines
4.2 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 library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
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);
void initExtensions();
2009-05-05 11:34:43 +00:00
2009-05-07 19:06:31 +00:00
const char *getVideoDeviceName();
2009-05-05 11:34:43 +00:00
void setupCamera(float fov, float nclip, float fclip, float roll);
2012-02-04 18:07:24 -08:00
void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest);
2009-05-05 11:34:43 +00:00
2009-05-09 17:47:28 +00:00
void clearScreen();
2009-05-05 11:34:43 +00:00
void flipBuffer();
bool isHardwareAccelerated();
void getBoundingBoxPos(const Mesh *model, int *x1, int *y1, int *x2, int *y2);
2009-05-05 11:34:43 +00:00
2012-02-04 18:07:24 -08:00
void startActorDraw(const Math::Vector3d &pos, float scale, const Math::Angle &yaw,
const Math::Angle &pitch, const Math::Angle &roll, const bool inOverworld,
const float alpha);
2009-05-05 11:34:43 +00:00
void finishActorDraw();
void setShadow(Shadow *shadow);
void drawShadowPlanes();
void setShadowMode();
void clearShadowMode();
void setShadowColor(byte r, byte g, byte b);
void getShadowColor(byte *r, byte *g, byte *b);
2009-05-05 11:34:43 +00:00
void set3DMode();
void translateViewpointStart();
void translateViewpoint(const Math::Vector3d &vec);
void rotateViewpoint(const Math::Angle &angle, const Math::Vector3d &axis);
2009-06-08 10:27:20 +00:00
void translateViewpointFinish();
2009-05-05 11:34:43 +00:00
void drawEMIModelFace(const EMIModel* model, const EMIMeshFace* face);
void drawModelFace(const MeshFace *face, float *vertices, float *vertNormals, float *textureVerts);
2011-05-15 16:47:09 +03:00
void drawSprite(const Sprite *sprite);
2009-05-05 11:34:43 +00:00
void enableLights();
2009-05-05 11:34:43 +00:00
void disableLights();
2011-07-23 12:14:33 +02:00
void setupLight(Light *light, int lightId);
void turnOffLight(int lightId);
2009-05-05 11:34:43 +00:00
void createMaterial(Texture *material, const char *data, const CMap *cmap);
void selectMaterial(const Texture *material);
void destroyMaterial(Texture *material);
2009-05-05 11:34:43 +00:00
void createBitmap(BitmapData *bitmap);
void drawBitmap(const Bitmap *bitmap, int x, int y);
void destroyBitmap(BitmapData *bitmap);
2009-05-05 11:34:43 +00:00
2011-05-22 20:43:28 -07:00
void createFont(Font *font);
void destroyFont(Font *font);
void createTextObject(TextObject *text);
void drawTextObject(TextObject *text);
void destroyTextObject(TextObject *text);
2011-05-22 20:43:28 -07:00
2009-05-05 11:34:43 +00:00
Bitmap *getScreenshot(int w, int h);
void storeDisplay();
void copyStoredToDisplay();
void dimScreen();
void dimRegion(int x, int y, int w, int h, float level);
2011-07-29 22:49:08 +02:00
void irisAroundRegion(int x1, int y1, int x2, int y2);
2009-05-05 11:34:43 +00:00
void drawEmergString(int x, int y, const char *text, const Color &fgColor);
void loadEmergFont();
void drawRectangle(PrimitiveObject *primitive);
void drawLine(PrimitiveObject *primitive);
void drawPolygon(PrimitiveObject *primitive);
void prepareMovieFrame(Graphics::Surface* frame);
void drawMovieFrame(int offsetX, int offsetY);
void releaseMovieFrame();
2009-05-05 11:34:43 +00:00
void createSpecialtyTextures();
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);
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;
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