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

surfacerenderer.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 AUTHORS
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 GRAPHICS_OPENGL_SURFACE_RENDERER_H
00024 #define GRAPHICS_OPENGL_SURFACE_RENDERER_H
00025 
00026 #include "math/rect2d.h"
00027 
00028 #include "graphics/opengl/system_headers.h"
00029 
00030 namespace OpenGL {
00031 
00032 class Shader;
00033 class Texture;
00034 
00038 class SurfaceRenderer {
00039 public:
00040     SurfaceRenderer();
00041     virtual ~SurfaceRenderer();
00042 
00046     virtual void prepareState() = 0;
00047 
00056     virtual void render(const Texture *tex, const Math::Rect2d &dest) = 0;
00057 
00061     virtual void restorePreviousState() = 0;
00062 
00068     void setFlipY(bool flipY);
00069 
00073     void enableAlphaBlending(bool enable);
00074 
00075 protected:
00076     bool _flipY;
00077     bool _alphaBlending;
00078 };
00079 
00080 #ifndef USE_GLES2
00081 
00082 class FixedSurfaceRenderer : public SurfaceRenderer {
00083 public:
00084     virtual ~FixedSurfaceRenderer();
00085 
00086     // SurfaceRenderer API
00087     void prepareState() override;
00088     void render(const Texture *tex, const Math::Rect2d &dest) override;
00089     void restorePreviousState() override;
00090 };
00091 
00092 #endif
00093 
00094 #if defined(USE_OPENGL_SHADERS) || defined(USE_GLES2)
00095 
00096 class ShaderSurfaceRenderer : public SurfaceRenderer {
00097 public:
00098     ShaderSurfaceRenderer();
00099     virtual ~ShaderSurfaceRenderer();
00100 
00101     // SurfaceRenderer API
00102     void prepareState() override;
00103     void render(const Texture *tex, const Math::Rect2d &dest) override;
00104     void restorePreviousState() override;
00105 
00106 private:
00107     Shader *_boxShader;
00108     GLuint _boxVerticesVBO;
00109 };
00110 
00111 #endif
00112 
00113 SurfaceRenderer *createBestSurfaceRenderer();
00114 
00115 } // End of namespace OpenGL
00116 
00117 #endif // GRAPHICS_OPENGL_SURFACE_RENDERER_H


Generated on Sat Dec 14 2019 05:00:43 for ResidualVM by doxygen 1.7.1
curved edge   curved edge