ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

gfx_tinygl.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GRIM_GFX_TINYGL_H
00024 #define GRIM_GFX_TINYGL_H
00025 
00026 #include "engines/grim/gfx_base.h"
00027 
00028 #include "graphics/tinygl/zgl.h"
00029 
00030 namespace Grim {
00031 
00032 class ModelNode;
00033 class Mesh;
00034 class MeshFace;
00035 class BlitImage;
00036 
00037 class GfxTinyGL : public GfxBase {
00038 public:
00039     GfxTinyGL();
00040     virtual ~GfxTinyGL();
00041 
00042     byte *setupScreen(int screenW, int screenH, bool fullscreen) override;
00043 
00044     const char *getVideoDeviceName() override;
00045 
00046     void setupCameraFrustum(float fov, float nclip, float fclip) override;
00047     void positionCamera(const Math::Vector3d &pos, const Math::Vector3d &interest, float roll) override;
00048     void positionCamera(const Math::Vector3d &pos, const Math::Matrix4 &rot) override;
00049 
00050     Math::Matrix4 getModelView() override;
00051     Math::Matrix4 getProjection() override;
00052 
00053     void clearScreen() override;
00054     void clearDepthBuffer() override;
00055     void flipBuffer() override;
00056 
00057     bool isHardwareAccelerated() override;
00058     bool supportsShaders() override;
00059 
00060     void getScreenBoundingBox(const Mesh *model, int *x1, int *y1, int *x2, int *y2) override;
00061     void getScreenBoundingBox(const EMIModel *model, int *x1, int *y1, int *x2, int *y2) override;
00062     void getActorScreenBBox(const Actor *actor, Common::Point &p1, Common::Point &p2) override;
00063 
00064     void startActorDraw(const Actor *actor) override;
00065     void finishActorDraw() override;
00066     void setShadow(Shadow *shadow) override;
00067     void drawShadowPlanes() override;
00068     void setShadowMode() override;
00069     void clearShadowMode() override;
00070     void setShadowColor(byte r, byte g, byte b) override;
00071     void getShadowColor(byte *r, byte *g, byte *b) override;
00072 
00073     void set3DMode() override;
00074 
00075     void translateViewpointStart() override;
00076     void translateViewpoint(const Math::Vector3d &vec) override;
00077     void rotateViewpoint(const Math::Angle &angle, const Math::Vector3d &axis) override;
00078     void rotateViewpoint(const Math::Matrix4 &matrix) override;
00079     void translateViewpointFinish() override;
00080 
00081     void drawEMIModelFace(const EMIModel *model, const EMIMeshFace *face) override;
00082     void drawModelFace(const Mesh *mesh, const MeshFace *face) override;
00083     void drawSprite(const Sprite *sprite) override;
00084 
00085     void enableLights() override;
00086     void disableLights() override;
00087     void setupLight(Light *light, int lightId) override;
00088     void turnOffLight(int lightId) override;
00089 
00090     void createTexture(Texture *texture, const uint8 *data, const CMap *cmap, bool clamp) override;
00091     void selectTexture(const Texture *texture) override;
00092     void destroyTexture(Texture *texture) override;
00093 
00094     void createBitmap(BitmapData *bitmap) override;
00095     void drawBitmap(const Bitmap *bitmap, int x, int y, uint32 layer) override;
00096     void destroyBitmap(BitmapData *bitmap) override;
00097 
00098     void createFont(Font *font) override;
00099     void destroyFont(Font *font) override;
00100 
00101     void drawTextObject(const TextObject *text) override;
00102     void createTextObject(TextObject *text) override;
00103     void destroyTextObject(TextObject *text) override;
00104 
00105     void dimScreen() override;
00106     void dimRegion(int x, int y, int w, int h, float level) override;
00107     void irisAroundRegion(int x1, int y1, int x2, int y2) override;
00108 
00109     Bitmap *getScreenshot(int w, int h, bool useStored) override;
00110     void storeDisplay() override;
00111     void copyStoredToDisplay() override;
00112 
00113     void drawEmergString(int x, int y, const char *text, const Color &fgColor) override;
00114     void loadEmergFont() override;
00115 
00116     void drawRectangle(const PrimitiveObject *primitive) override;
00117     void drawLine(const PrimitiveObject *primitive) override;
00118     void drawPolygon(const PrimitiveObject *primitive) override;
00119     void drawDimPlane() override;
00120 
00121     void prepareMovieFrame(Graphics::Surface *frame) override;
00122     void drawMovieFrame(int offsetX, int offsetY) override;
00123     void releaseMovieFrame() override;
00124 
00125     void setBlendMode(bool additive) override;
00126 
00127 protected:
00128     void createSpecialtyTextureFromScreen(uint id, uint8 *data, int x, int y, int width, int height);
00129 
00130 private:
00131     TinyGL::FrameBuffer *_zb;
00132     Graphics::PixelFormat _pixelFormat;
00133     Graphics::BlitImage *_emergFont[96];
00134     Graphics::BlitImage *_smushImage;
00135     Graphics::PixelBuffer _storedDisplay;
00136     float _alpha;
00137     const Actor *_currentActor;
00138     TGLenum _depthFunc;
00139 
00140     void readPixels(int x, int y, int width, int height, uint8 *buffer);
00141 };
00142 
00143 } // end of namespace Grim
00144 
00145 #endif


Generated on Sat Oct 12 2019 05:00:49 for ResidualVM by doxygen 1.7.1
curved edge   curved edge