2013-11-06 18:17:18 -05:00
|
|
|
// 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.
|
2011-11-30 11:56:04 -05:00
|
|
|
|
|
|
|
|
|
|
|
uniform sampler2D tex_layout;
|
|
|
|
uniform sampler2D tex_detail0;
|
|
|
|
uniform sampler2D tex_detail1;
|
2011-11-30 14:34:37 -05:00
|
|
|
uniform sampler2D tex_detail2;
|
|
|
|
uniform sampler2D tex_detail3;
|
2011-12-03 15:09:08 -05:00
|
|
|
uniform sampler2D tex_detail4;
|
2011-12-17 19:48:35 -05:00
|
|
|
varying vec3 normal;
|
|
|
|
varying vec3 lightdir2;
|
2011-12-20 11:58:12 -05:00
|
|
|
varying vec4 vertex_color;
|
2011-11-30 11:56:04 -05:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2013-03-17 20:21:28 -04:00
|
|
|
vec4 splatting = texture2D(tex_layout, gl_TexCoord[1].st);
|
|
|
|
vec4 detail0 = texture2D(tex_detail0, gl_TexCoord[0].st);
|
|
|
|
vec4 detail1 = texture2D(tex_detail1, gl_TexCoord[0].st);
|
|
|
|
vec4 detail2 = texture2D(tex_detail2, gl_TexCoord[0].st);
|
|
|
|
vec4 detail3 = texture2D(tex_detail3, gl_TexCoord[0].st);
|
|
|
|
vec4 detail4 = texture2D(tex_detail4, gl_TexCoord[0].st);
|
2013-06-18 10:35:29 -04:00
|
|
|
|
2011-12-19 20:47:40 -05:00
|
|
|
gl_FragColor = (splatting.r * detail0 +
|
|
|
|
splatting.g * detail1 +
|
|
|
|
splatting.b * detail2 +
|
|
|
|
(1.0 - splatting.r - splatting.g - splatting.b) * detail3 +
|
|
|
|
(1.0 - splatting.a) * detail4)
|
2011-12-20 11:58:12 -05:00
|
|
|
* min(1.0, 0.2 + dot(lightdir2, normal)) * vertex_color; // 0.2 is the ambient light.
|
2011-11-30 11:56:04 -05:00
|
|
|
}
|