From 9560969ea8cf2e6f1d97210f819fe8df550af494 Mon Sep 17 00:00:00 2001 From: yinsimei Date: Mon, 10 Jul 2017 00:47:15 +0200 Subject: SLUDGE: remove shader-related files --- engines/sludge/color.frag | 7 -- engines/sludge/color.vert | 13 --- engines/sludge/fixScaleSprite.frag | 29 ------ engines/sludge/fixScaleSprite.vert | 25 ------ engines/sludge/module.mk | 1 - engines/sludge/movie.cpp | 1 - engines/sludge/scale.frag | 60 ------------- engines/sludge/scale.vert | 25 ------ engines/sludge/scale_noaa.frag | 31 ------- engines/sludge/shaders.cpp | 178 ------------------------------------- engines/sludge/shaders.h | 33 ------- engines/sludge/sprites.cpp | 1 - engines/sludge/texture.frag | 22 ----- engines/sludge/texture.vert | 16 ---- engines/sludge/yuv.frag | 25 ------ engines/sludge/yuv.vert | 12 --- 16 files changed, 479 deletions(-) delete mode 100644 engines/sludge/color.frag delete mode 100644 engines/sludge/color.vert delete mode 100644 engines/sludge/fixScaleSprite.frag delete mode 100644 engines/sludge/fixScaleSprite.vert delete mode 100644 engines/sludge/scale.frag delete mode 100644 engines/sludge/scale.vert delete mode 100644 engines/sludge/scale_noaa.frag delete mode 100644 engines/sludge/shaders.cpp delete mode 100644 engines/sludge/shaders.h delete mode 100644 engines/sludge/texture.frag delete mode 100644 engines/sludge/texture.vert delete mode 100644 engines/sludge/yuv.frag delete mode 100644 engines/sludge/yuv.vert (limited to 'engines/sludge') diff --git a/engines/sludge/color.frag b/engines/sludge/color.frag deleted file mode 100644 index 1f3e45aec0..0000000000 --- a/engines/sludge/color.frag +++ /dev/null @@ -1,7 +0,0 @@ -varying vec4 color; - -void main(void) -{ - gl_FragColor = color; -} - diff --git a/engines/sludge/color.vert b/engines/sludge/color.vert deleted file mode 100644 index 819d377b05..0000000000 --- a/engines/sludge/color.vert +++ /dev/null @@ -1,13 +0,0 @@ -attribute vec4 myVertex; - -uniform mat4 myPMVMatrix; -uniform vec4 myColor; - -varying vec4 color; - -void main(void) -{ - gl_Position = myPMVMatrix * myVertex; - color = myColor; -} - diff --git a/engines/sludge/fixScaleSprite.frag b/engines/sludge/fixScaleSprite.frag deleted file mode 100644 index ed9f6cfaf8..0000000000 --- a/engines/sludge/fixScaleSprite.frag +++ /dev/null @@ -1,29 +0,0 @@ -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform sampler2D tex2; -uniform bool useLightTexture; - -varying vec2 varCoord0; -varying vec2 varCoord1; -varying vec2 varCoord2; - -varying vec4 color; -varying vec4 secondaryColor; - -void main() -{ - vec4 texture = texture2D (tex0, varCoord0); - vec4 texture2 = texture2D (tex2, varCoord2); - vec3 col; - if (useLightTexture) { - vec4 texture1 = texture2D (tex1, varCoord1); - col = texture1.rgb * texture.rgb; - } else { - col = color.rgb * texture.rgb; - } - col += vec3(secondaryColor); - vec4 color = vec4 (col, color.a * texture.a); - col = mix (texture2.rgb, color.rgb, color.a); - gl_FragColor = vec4 (col, max(texture.a, texture2.a)); -} - diff --git a/engines/sludge/fixScaleSprite.vert b/engines/sludge/fixScaleSprite.vert deleted file mode 100644 index d9f4e5177a..0000000000 --- a/engines/sludge/fixScaleSprite.vert +++ /dev/null @@ -1,25 +0,0 @@ -attribute vec4 myVertex; -attribute vec2 myUV0; -attribute vec2 myUV1; -attribute vec2 myUV2; - -uniform mat4 myPMVMatrix; -uniform vec4 myColor; -uniform vec4 mySecondaryColor; - -varying vec2 varCoord0; -varying vec2 varCoord1; -varying vec2 varCoord2; - -varying vec4 color; -varying vec4 secondaryColor; - -void main() { - varCoord0 = myUV0.st; - varCoord1 = myUV1.st; - varCoord2 = myUV2.st; - gl_Position = myPMVMatrix * myVertex; - - color = myColor; - secondaryColor = mySecondaryColor; -} diff --git a/engines/sludge/module.mk b/engines/sludge/module.mk index afe1d88b8b..2e321ea415 100644 --- a/engines/sludge/module.mk +++ b/engines/sludge/module.mk @@ -42,7 +42,6 @@ MODULE_OBJS := \ utf8.o \ variable.o \ zbuffer.o \ -# shaders.o \ # libwebm/mkvparser.o \ # libwebm/mkvreader.o \ diff --git a/engines/sludge/movie.cpp b/engines/sludge/movie.cpp index dc49cc46f8..df9031bab7 100644 --- a/engines/sludge/movie.cpp +++ b/engines/sludge/movie.cpp @@ -43,7 +43,6 @@ #include "sludge/timing.h" #include "sludge/graphics.h" #include "sludge/movie.h" -#include "sludge/shaders.h" #include "sludge/sound.h" namespace Sludge { diff --git a/engines/sludge/scale.frag b/engines/sludge/scale.frag deleted file mode 100644 index 13558714ee..0000000000 --- a/engines/sludge/scale.frag +++ /dev/null @@ -1,60 +0,0 @@ -/* - Inspired by a shader by guest(r) - guest.r@gmail.com - that was found at - http://www.razyboard.com/system/morethread-smart-texture-mag-filter-for-ogl2-and-dosbox-pete_bernert-266904-5689051-0.html -*/ - -uniform sampler2D Texture; -uniform sampler2D lightTexture; -uniform bool antialias; -uniform bool useLightTexture; -uniform float scale; - -varying vec2 varCoord0; -varying vec2 varCoord1; - -varying vec4 color; -varying vec4 secondaryColor; - -void main() -{ - vec4 c11 = texture2D(Texture, varCoord0.xy); - - if (antialias) { - vec2 fw = fwidth(varCoord0.xy)*scale; - - vec2 sd1 = vec2( fw.x,fw.y); - vec2 sd2 = vec2(-fw.x,fw.y); - - vec4 s00 = texture2D(Texture, varCoord0.xy-sd1); - vec4 s20 = texture2D(Texture, varCoord0.xy-sd2); - vec4 s22 = texture2D(Texture, varCoord0.xy+sd1); - vec4 s02 = texture2D(Texture, varCoord0.xy+sd2); - - vec4 dt = vec4(1.0,1.0,1.0,1.0); - - float m1=dot(abs(s00-s22),dt)+0.0001; - float m2=dot(abs(s02-s20),dt)+0.0001; - - vec4 temp1 = m2*(s00 + s22) + m1*(s02 + s20); - - // gl_FragColor = (temp1/(m1+m2)) * 0.5; - c11 = c11*0.333333 + (temp1/(m1+m2)) * 0.333333; - } - /* - else { - gl_FragColor = c11; - }*/ - - //if (gl_FragColor.a<0.001) discard; - - vec3 col; - if (useLightTexture) { - vec4 texture1 = texture2D (lightTexture, varCoord1.xy); - col = texture1.rgb * c11.rgb; - } else { - col = color.rgb * c11.rgb; - } - col += vec3(secondaryColor); - gl_FragColor = vec4 (col, color.a * c11.a); -} - diff --git a/engines/sludge/scale.vert b/engines/sludge/scale.vert deleted file mode 100644 index ff6aa05660..0000000000 --- a/engines/sludge/scale.vert +++ /dev/null @@ -1,25 +0,0 @@ -attribute vec4 myVertex; -attribute vec2 myUV0; -attribute vec2 myUV1; - -uniform mat4 myPMVMatrix; -uniform vec4 myColor; -uniform vec4 mySecondaryColor; - -varying vec2 varCoord0; -varying vec2 varCoord1; - -varying vec4 color; -varying vec4 secondaryColor; - -void main() -{ - gl_Position = myPMVMatrix * myVertex; - varCoord0 = myUV0.st; - - // Light - varCoord1 = myUV1.st; - - color = myColor; - secondaryColor = mySecondaryColor; -} diff --git a/engines/sludge/scale_noaa.frag b/engines/sludge/scale_noaa.frag deleted file mode 100644 index bf7aad7adf..0000000000 --- a/engines/sludge/scale_noaa.frag +++ /dev/null @@ -1,31 +0,0 @@ -uniform sampler2D Texture; -uniform sampler2D lightTexture; -uniform bool antialias; -uniform bool useLightTexture; -uniform float scale; - -varying vec2 varCoord0; -varying vec2 varCoord1; - -varying vec4 color; -varying vec4 secondaryColor; - -void main() -{ - vec4 c11 = texture2D(Texture, varCoord0.xy); - - //gl_FragColor = c11; - - //if (gl_FragColor.a<0.001) discard; - - vec3 col; - if (useLightTexture) { - vec4 texture1 = texture2D (lightTexture, varCoord1.xy); - col = texture1.rgb * c11.rgb; - } else { - col = color.rgb * c11.rgb; - } - col += vec3(secondaryColor); - gl_FragColor = vec4 (col, color.a * c11.a); -} - diff --git a/engines/sludge/shaders.cpp b/engines/sludge/shaders.cpp deleted file mode 100644 index 69c3f99159..0000000000 --- a/engines/sludge/shaders.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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. - * - */ - -#include "sludge/allfiles.h" -#include "sludge/debug.h" -#include "sludge/stringy.h" -#include "sludge/shaders.h" -#include "sludge/graphics.h" - -namespace Sludge { - -extern char *bundleFolder; - -//Function from: http://www.evl.uic.edu/aej/594/code/ogl.cpp -//Read in a textfile (GLSL program) -// we need to pass it as a string to the GLSL driver -char *shaderFileRead(const char *name) { - Common::File fd; - char *content = NULL; - char *fn = joinStrings(bundleFolder, name); - - int count = 0; - - if (fn != NULL) { - if (fd.open(fn)) { - - fd.seek(0, SEEK_END); - count = fd.pos(); - fd.seek(0); - - if (count > 0) { - content = (char *)malloc(sizeof(char) * (count + 1)); - count = fd.read(content, sizeof(char) * count); - content[count] = '\0'; - } - fd.close(); - } - } - delete fn; - return content; -} - -#if 0 -static void -printShaderInfoLog(GLuint shader) { - GLint infologLength = 0; - GLint charsWritten = 0; - char *infoLog; - -#if 0 - printOpenGLError(); // Check for OpenGL errors - glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infologLength); - printOpenGLError(); // Check for OpenGL errors -#endif - - if (infologLength > 0) { - infoLog = new char [infologLength]; - if (infoLog == NULL) { - debugOut("ERROR: Could not allocate InfoLog buffer"); - return; - } -#if 0 - glGetShaderInfoLog(shader, infologLength, &charsWritten, infoLog); - debugOut("Shader InfoLog:\n%s\n\n", infoLog); -#endif - delete[] infoLog; - } - printOpenGLError(); // Check for OpenGL errors -} - -/* Print out the information log for a program object */ -static void -printProgramInfoLog(GLuint program) { - GLint infologLength = 0; - GLint charsWritten = 0; - char *infoLog; -#if 0 - printOpenGLError(); // Check for OpenGL errors - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infologLength); - printOpenGLError(); // Check for OpenGL errors -#endif - if (infologLength > 0) { - infoLog = new char [infologLength]; - if (infoLog == NULL) { - debugOut("ERROR: Could not allocate InfoLog buffer"); - return; - } -#if 0 - glGetProgramInfoLog(program, infologLength, &charsWritten, infoLog); - debugOut("Program InfoLog:\n%s\n\n", infoLog); -#endif - delete[] infoLog; - } - printOpenGLError(); // Check for OpenGL errors -} -#endif - -int buildShaders(const char *vertexShader, const char *fragmentShader) { -#if 0 - GLuint VS, FS, prog; - GLint vertCompiled, fragCompiled; - GLint linked; - - // Create Shader Objects - VS = glCreateShader(GL_VERTEX_SHADER); - FS = glCreateShader(GL_FRAGMENT_SHADER); - - // Load source code strings into shaders - glShaderSource(VS, 1, &vertexShader, NULL); - glShaderSource(FS, 1, &fragmentShader, NULL); -#endif - debugOut("Compiling vertex shader... \n"); -#if 0 - // Compile vertex shader and print log - glCompileShader(VS); - printOpenGLError(); - glGetShaderiv(VS, GL_COMPILE_STATUS, &vertCompiled); - printShaderInfoLog(VS); -#endif - debugOut("\nCompiling fragment shader... \n"); -#if 0 - // Compile fragment shader and print log - glCompileShader(FS); - printOpenGLError(); - glGetShaderiv(FS, GL_COMPILE_STATUS, &fragCompiled); - printShaderInfoLog(FS); - - if (!vertCompiled || !fragCompiled) - return 0; -#endif - debugOut("\nShaders compiled. \n"); - -#if 0 - // Create a program object and attach the two compiled shaders - prog = glCreateProgram(); - glAttachShader(prog, VS); - glAttachShader(prog, FS); - - // Clean up - glDeleteShader(VS); - glDeleteShader(FS); - - // Link the program and print log - glLinkProgram(prog); - printOpenGLError(); - glGetProgramiv(prog, GL_LINK_STATUS, &linked); - printProgramInfoLog(prog); - - if (!linked) - return 0; - - debugOut("Shader program linked. \n"); - - return prog; -#endif - return 0; //TODO: false value -} - -} // End of namespace Sludge diff --git a/engines/sludge/shaders.h b/engines/sludge/shaders.h deleted file mode 100644 index fe31e196cf..0000000000 --- a/engines/sludge/shaders.h +++ /dev/null @@ -1,33 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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. - * - */ -#ifndef SLUDGE_SHADERS_H -#define SLUDGE_SHADERS_H - -namespace Sludge { - -char *shaderFileRead(const char *fn); -int buildShaders(const char *vertexShader, const char *fragmentShader); - -} // End of namespace Sludge - -#endif - diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp index 6d51b8fd83..a89d37d8c8 100644 --- a/engines/sludge/sprites.cpp +++ b/engines/sludge/sprites.cpp @@ -35,7 +35,6 @@ #include "sludge/debug.h" #include "sludge/graphics.h" #include "sludge/imgloader.h" -#include "sludge/shaders.h" #include "sludge/sludge.h" namespace Sludge { diff --git a/engines/sludge/texture.frag b/engines/sludge/texture.frag deleted file mode 100644 index 3de427ba8d..0000000000 --- a/engines/sludge/texture.frag +++ /dev/null @@ -1,22 +0,0 @@ -uniform sampler2D sampler2d; -uniform bool zBuffer; -uniform float zBufferLayer; -uniform bool modulateColor; - -varying vec2 varCoord; -varying vec4 color; - -void main(void) -{ - vec4 col = texture2D(sampler2d, varCoord); - if (zBuffer && col.a < 0.0625*zBufferLayer-0.03) - { - discard; - } - if (modulateColor) - { - col = col * color; - } - gl_FragColor = col; -} - diff --git a/engines/sludge/texture.vert b/engines/sludge/texture.vert deleted file mode 100644 index 40099af68f..0000000000 --- a/engines/sludge/texture.vert +++ /dev/null @@ -1,16 +0,0 @@ -attribute vec4 myVertex; -attribute vec2 myUV0; - -uniform mat4 myPMVMatrix; -uniform vec4 myColor; - -varying vec2 varCoord; -varying vec4 color; - -void main(void) -{ - gl_Position = myPMVMatrix * myVertex; - varCoord = myUV0.st; - color = myColor; -} - diff --git a/engines/sludge/yuv.frag b/engines/sludge/yuv.frag deleted file mode 100644 index 42db4fe098..0000000000 --- a/engines/sludge/yuv.frag +++ /dev/null @@ -1,25 +0,0 @@ -uniform sampler2D Ytex; -uniform sampler2D Utex; -uniform sampler2D Vtex; - -varying vec2 varCoord; - -void main() -{ - float y, u, v, r, g, b; - - y=texture2D(Ytex, varCoord).a; - u=texture2D(Utex, varCoord).a; - v=texture2D(Vtex, varCoord).a; - - y=1.1643*(y-0.0625); - u=u-0.5; - v=v-0.5; - - r=y+1.5958*v; - g=y-0.39173*u-0.81290*v; - b=y+2.017*u; - - gl_FragColor=vec4(r,g,b,1.0); -} - diff --git a/engines/sludge/yuv.vert b/engines/sludge/yuv.vert deleted file mode 100644 index 28613b6c90..0000000000 --- a/engines/sludge/yuv.vert +++ /dev/null @@ -1,12 +0,0 @@ -attribute vec4 myVertex; -attribute vec2 myUV0; - -uniform mat4 myPMVMatrix; - -varying vec2 varCoord; - -void main() -{ - gl_Position = myPMVMatrix * myVertex; - varCoord = myUV0.st; -} -- cgit v1.2.3