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

control_shaders.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 "common/scummsys.h"
00024 
00025 #if defined(USE_GLES2) || defined(USE_OPENGL_SHADERS)
00026 
00027 namespace OpenGL {
00028 namespace BuiltinShaders {
00029 
00030 const char *controlVertex =
00031     "#version 100\n"
00032     "attribute vec2 position;\n"
00033     "attribute vec2 texcoord;\n"
00034     "uniform vec2 offsetXY;\n"
00035     "uniform vec2 sizeWH;\n"
00036     "uniform vec4 clip;\n"
00037     "uniform bool flipY;\n"
00038     "varying vec2 Texcoord;\n"
00039     "void main() {\n"
00040         "Texcoord = clip.xy + texcoord * (clip.zw - clip.xy);\n"
00041         "vec2 pos = offsetXY + position * sizeWH;\n"
00042         "pos.x = pos.x * 2.0 - 1.0;\n"
00043         "pos.y = pos.y * 2.0 - 1.0;\n"
00044         "if (flipY)\n"
00045             "pos.y *= -1.0;\n"
00046         "gl_Position = vec4(pos, 0.0, 1.0);\n"
00047     "}\n";
00048 
00049 const char *controlFragment =
00050     "#version 100\n"
00051     "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
00052         "precision highp float;\n"
00053     "#else\n"
00054         "precision mediump float;\n"
00055     "#endif\n"
00056     "varying vec2 Texcoord;\n"
00057     "uniform sampler2D tex;\n"
00058     "void main() {\n"
00059         "gl_FragColor = texture2D(tex, Texcoord);\n"
00060     "}\n";
00061 
00062 }
00063 } // End of namespace OpenGL
00064 
00065 #endif


Generated on Sat May 25 2019 05:00:42 for ResidualVM by doxygen 1.7.1
curved edge   curved edge