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
|
|
|
|
2009-05-24 19:13:58 +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 {
|
|
|
|
|
2011-07-22 22:09:49 +02:00
|
|
|
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();
|
|
|
|
|
2011-05-19 20:19:28 +08:00
|
|
|
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();
|
|
|
|
|
2011-07-22 22:09:49 +02:00
|
|
|
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,
|
2012-04-13 19:45:33 +02:00
|
|
|
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);
|
2011-04-24 15:41:40 +02:00
|
|
|
void getShadowColor(byte *r, byte *g, byte *b);
|
2009-05-05 11:34:43 +00:00
|
|
|
|
|
|
|
void set3DMode();
|
|
|
|
|
2011-12-12 18:57:17 +01:00
|
|
|
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
|
|
|
|
2011-12-30 12:53:49 +01:00
|
|
|
void drawEMIModelFace(const EMIModel* model, const EMIMeshFace* face);
|
2011-07-22 22:09:49 +02:00
|
|
|
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
|
|
|
|
2011-07-13 14:09:32 +03: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);
|
2011-10-18 18:01:52 +02:00
|
|
|
void turnOffLight(int lightId);
|
2009-05-05 11:34:43 +00:00
|
|
|
|
2011-07-28 22:21:16 +02: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
|
|
|
|
2011-05-09 19:20:47 +02:00
|
|
|
void createBitmap(BitmapData *bitmap);
|
2012-02-02 09:34:53 -08:00
|
|
|
void drawBitmap(const Bitmap *bitmap, int x, int y);
|
2011-05-09 19:20:47 +02:00
|
|
|
void destroyBitmap(BitmapData *bitmap);
|
2009-05-05 11:34:43 +00:00
|
|
|
|
2011-05-22 20:43:28 -07:00
|
|
|
void createFont(Font *font);
|
2011-05-23 14:26:44 -07:00
|
|
|
void destroyFont(Font *font);
|
2011-05-23 22:00:53 -07:00
|
|
|
|
|
|
|
void createTextObject(TextObject *text);
|
2011-05-23 16:19:47 -07:00
|
|
|
void drawTextObject(TextObject *text);
|
2011-05-23 22:00:53 -07:00
|
|
|
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);
|
|
|
|
|
2011-10-01 02:51:55 +02:00
|
|
|
void prepareMovieFrame(Graphics::Surface* frame);
|
2011-08-14 18:35:49 +02:00
|
|
|
void drawMovieFrame(int offsetX, int offsetY);
|
|
|
|
void releaseMovieFrame();
|
2009-05-05 11:34:43 +00:00
|
|
|
|
2012-04-12 17:53:03 -07: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;
|
2011-05-19 20:19:28 +08:00
|
|
|
bool _useDepthShader;
|
|
|
|
GLuint _fragmentProgram;
|
2012-03-07 16:12:14 +01:00
|
|
|
bool _useDimShader;
|
|
|
|
GLuint _dimFragProgram;
|
2012-04-08 15:03:37 +02:00
|
|
|
GLint _maxLights;
|
2012-04-13 19:45:33 +02:00
|
|
|
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
|
2009-05-25 21:04:50 +00:00
|
|
|
|
|
|
|
#endif
|