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.
|
|
|
|
*
|
2012-12-19 23:15:43 +01: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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-04-05 18:18:42 +02:00
|
|
|
*
|
2012-12-19 23:15:43 +01: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
|
2012-12-19 23:15:43 +01:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-04-05 18:18:42 +02:00
|
|
|
*
|
2012-12-19 23:15:43 +01: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
|
|
|
|
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-06-08 00:03:05 +02:00
|
|
|
void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float roll);
|
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);
|
2013-12-10 15:52:33 +01:00
|
|
|
void getBoundingBoxPos(const EMIModel *model, int *x1, int *y1, int *x2, int *y2);
|
2009-05-05 11:34:43 +00:00
|
|
|
|
2013-12-04 14:26:44 +01:00
|
|
|
void startActorDraw(const Actor *actor);
|
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
|
|
|
|
2013-07-09 21:12:55 +02:00
|
|
|
void drawEMIModelFace(const EMIModel *model, const EMIMeshFace *face);
|
2012-12-27 19:08:46 +01:00
|
|
|
void drawModelFace(const Mesh *mesh, const MeshFace *face);
|
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);
|
EMI: Draw background layers at intervals
Previously, we split the background layers into everything
before SO 15 and after, and drew like that. However, this caused
the pink ship in shi.setb to not be drawn.
This patch draws the layers of the background at intervals of ten.
So if a set has six layers, layer 5 is the background and 4,3,2,1,0
are rendered at sortorder 40,30,20,10,0.
2013-06-29 14:36:17 +02:00
|
|
|
void drawBitmap(const Bitmap *bitmap, int x, int y, uint32 layer);
|
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);
|
2012-05-05 18:08:47 -07:00
|
|
|
void drawTextObject(const 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();
|
|
|
|
|
2012-05-05 18:03:04 -07:00
|
|
|
void drawRectangle(const PrimitiveObject *primitive);
|
|
|
|
void drawLine(const PrimitiveObject *primitive);
|
|
|
|
void drawPolygon(const PrimitiveObject *primitive);
|
2009-05-05 11:34:43 +00:00
|
|
|
|
2013-07-09 21:12: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;
|
2013-12-04 14:26:44 +01:00
|
|
|
const Actor *_currentActor;
|
2014-05-01 12:34:23 +02:00
|
|
|
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
|
2009-05-25 21:04:50 +00:00
|
|
|
|
|
|
|
#endif
|