/* * Copyright (C) 2011-2013 Gregory hainaut * Copyright (C) 2007-2009 Gabest * * This file was generated by glsl2h.pl script * * 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, 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 GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA. * http://www.gnu.org/copyleft/gpl.html * */ #pragma once #include "stdafx.h" static const char* shadeboost_glsl = "//#version 420 // Keep it for editor detection\n" "\n" "/*\n" "** Contrast, saturation, brightness\n" "** Code of this function is from TGM's shader pack\n" "** http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057\n" "*/\n" "\n" "struct vertex_basic\n" "{\n" " vec4 p;\n" " vec2 t;\n" "};\n" "\n" "#ifdef FRAGMENT_SHADER\n" "\n" "#if __VERSION__ > 140 && !(defined(NO_STRUCT))\n" "layout(location = 0) in vertex_basic PSin;\n" "#define PSin_p (PSin.p)\n" "#define PSin_t (PSin.t)\n" "#else\n" "layout(location = 0) in vec4 p;\n" "layout(location = 1) in vec2 t;\n" "#define PSin_p p\n" "#define PSin_t t\n" "#endif\n" "\n" "layout(location = 0) out vec4 SV_Target0;\n" "\n" "#ifdef DISABLE_GL42\n" "layout(std140) uniform cb12\n" "#else\n" "layout(std140, binding = 12) uniform cb12\n" "#endif\n" "{\n" " vec4 BGColor;\n" "};\n" "\n" "#ifdef DISABLE_GL42\n" "uniform sampler2D TextureSampler;\n" "#else\n" "layout(binding = 0) uniform sampler2D TextureSampler;\n" "#endif\n" "\n" "// For all settings: 1.0 = 100\% 0.5=50\% 1.5 = 150\% \n" "vec4 ContrastSaturationBrightness(vec4 color)\n" "{\n" " const float sat = SB_SATURATION / 50.0;\n" " const float brt = SB_BRIGHTNESS / 50.0;\n" " const float con = SB_CONTRAST / 50.0;\n" " \n" " // Increase or decrease theese values to adjust r, g and b color channels seperately\n" " const float AvgLumR = 0.5;\n" " const float AvgLumG = 0.5;\n" " const float AvgLumB = 0.5;\n" " \n" " const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721);\n" " \n" " vec3 AvgLumin = vec3(AvgLumR, AvgLumG, AvgLumB);\n" " vec3 brtColor = color.rgb * brt;\n" " float dot_intensity = dot(brtColor, LumCoeff);\n" " vec3 intensity = vec3(dot_intensity, dot_intensity, dot_intensity);\n" " vec3 satColor = mix(intensity, brtColor, sat);\n" " vec3 conColor = mix(AvgLumin, satColor, con);\n" "\n" " color.rgb = conColor; \n" " return color;\n" "}\n" "\n" "\n" "void ps_main()\n" "{\n" " vec4 c = texture(TextureSampler, PSin_t);\n" " SV_Target0 = ContrastSaturationBrightness(c);\n" "}\n" "\n" "\n" "#endif\n" ;