stk-code_catmod/data/shaders/skybox.frag
vincentlj 42c16b32cb OGL32CTX: Replace deprecated "varying" by in/out semantic and make them explicit.
gl_Texcoord[]/gl_Color should be explocitly passed as in/out.
Compilers can pack varyings if the architecture does benefit from it (for instance intel mesa driver) but on the other hand they usually don't change size of varying even if there is only a single component used.
So storing vec2 into vec4 may waste performances.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14974 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2014-01-09 00:17:28 +00:00

70 lines
1.9 KiB
GLSL

// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2013 the SuperTuxKart team
//
// 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 3
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#version 130
uniform sampler2D tex;
uniform sampler2D glow_tex;
uniform float transparency;
uniform vec3 sun_pos;
in vec2 uv_anim;
in vec2 uv;
in vec2 uv_cl;
in vec3 vertex;
in vec2 uv_fast;
void main()
{
vec2 uv_temp = uv;
vec3 V = normalize(vertex);
vec3 L = normalize(vec3(sun_pos));
vec3 col = texture2D(tex, vec2((L.y + 1.0) / 2.0, V.y)).xyz;
float vl = clamp(dot(V, L), 0., 1.);
float paint = texture2D(tex, uv_temp * 3).a;
uv_temp += 20;
//float paint2 = texture2D(tex, uv_temp * 5).a;
float paint2 = texture2D(tex, uv * 5.).a;
// Get the general cloud mask
float hello = texture2D(glow_tex, (uv_cl + paint2 * 0.07) *2.).g;
float cld_mask = texture2D(glow_tex, (uv_anim + hello * 0.007 )).r;
vec2 fast = vec2(-uv_fast.x, uv_fast.y);// + (hello * 0.007);
float cld_fast = texture2D(glow_tex, fast ).r;
cld_mask = (cld_mask * hello * 0.5);
cld_fast = (cld_fast * hello );
col = cld_mask + col*(1. - cld_mask);
col = cld_fast + col*(1. - cld_fast);
gl_FragColor = vec4( vec3(col * paint * paint2), 1.0);
//gl_FragColor = vec4(vec3(ou), 1.0);
}