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

renderer.cpp

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 #include "graphics/renderer.h"
00024 
00025 #include "common/translation.h"
00026 
00027 namespace Graphics {
00028 
00029 static const RendererTypeDescription rendererTypes[] = {
00030 #if defined(USE_OPENGL) && !defined(USE_GLES2)
00031     { "opengl", _s("OpenGL"), kRendererTypeOpenGL },
00032 #endif
00033 #if defined(USE_OPENGL_SHADERS) || defined(USE_GLES2)
00034     { "opengl_shaders", _s("OpenGL with shaders"), kRendererTypeOpenGLShaders },
00035 #endif
00036     { "software", "Software", kRendererTypeTinyGL },
00037     { 0, 0, kRendererTypeDefault }
00038 };
00039 
00040 const RendererTypeDescription *listRendererTypes() {
00041     return rendererTypes;
00042 }
00043 
00044 RendererType parseRendererTypeCode(const Common::String &code) {
00045     const RendererTypeDescription *rt = listRendererTypes();
00046     while (rt->code) {
00047         if (rt->code == code) {
00048             return rt->id;
00049         }
00050         rt++;
00051     }
00052 
00053     return kRendererTypeDefault;
00054 }
00055 
00056 Common::String getRendererTypeCode(RendererType type) {
00057     const RendererTypeDescription *rt = listRendererTypes();
00058     while (rt->code) {
00059         if (rt->id == type) {
00060             return rt->code;
00061         }
00062         rt++;
00063     }
00064 
00065     return "";
00066 }
00067 
00068 RendererType getBestMatchingAvailableRendererType(RendererType desired) {
00069     if (desired == kRendererTypeDefault) {
00070         desired = kRendererTypeOpenGL;
00071     }
00072 
00073 #if !defined(USE_OPENGL_SHADERS) && !defined(USE_GLES2)
00074     if (desired == kRendererTypeOpenGLShaders) {
00075         desired = kRendererTypeOpenGL;
00076     }
00077 #endif
00078 
00079 #if (!defined(USE_OPENGL) && defined(USE_OPENGL_SHADERS)) || defined(USE_GLES2)
00080     if (desired == kRendererTypeOpenGL) {
00081         desired = kRendererTypeOpenGLShaders;
00082     }
00083 #endif
00084 
00085 #if !defined(USE_OPENGL) && !defined(USE_GLES2) && !defined(USE_OPENGL_SHADERS)
00086     if (desired == kRendererTypeOpenGL || desired == kRendererTypeOpenGLShaders) {
00087         desired = kRendererTypeTinyGL;
00088     }
00089 #endif
00090 
00091     return desired;
00092 }
00093 
00094 } // End of namespace Graphics


Generated on Sat Feb 16 2019 05:01:02 for ResidualVM by doxygen 1.7.1
curved edge   curved edge