2008-08-07 12:54:16 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
2011-01-09 20:20:36 +00:00
|
|
|
Copyright (C) 2008, 2011 Martin Gräßlin <kde@martin-graesslin.com>
|
2008-08-07 12:54:16 +00:00
|
|
|
|
|
|
|
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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2011-01-09 20:20:36 +00:00
|
|
|
uniform mat4 projection;
|
|
|
|
uniform mat4 modelview;
|
|
|
|
uniform mat4 screenTransformation;
|
|
|
|
uniform mat4 windowTransformation;
|
2008-08-07 12:54:16 +00:00
|
|
|
uniform float width;
|
|
|
|
uniform float height;
|
|
|
|
uniform float cubeAngle;
|
2011-01-09 20:20:36 +00:00
|
|
|
uniform vec2 u_offset;
|
2009-02-19 11:50:00 +00:00
|
|
|
uniform float timeLine;
|
2011-04-29 12:12:48 +00:00
|
|
|
uniform float textureWidth;
|
|
|
|
uniform float textureHeight;
|
2008-08-07 12:54:16 +00:00
|
|
|
|
2011-01-09 20:20:36 +00:00
|
|
|
attribute vec4 vertex;
|
|
|
|
attribute vec2 texCoord;
|
|
|
|
|
|
|
|
varying vec2 varyingTexCoords;
|
|
|
|
|
2008-08-07 12:54:16 +00:00
|
|
|
void main()
|
|
|
|
{
|
2011-04-29 12:12:48 +00:00
|
|
|
varyingTexCoords = texCoord / vec2(textureWidth, textureHeight);
|
2011-01-09 20:20:36 +00:00
|
|
|
vec4 transformedVertex = vertex;
|
|
|
|
transformedVertex.x = transformedVertex.x - width;
|
|
|
|
transformedVertex.y = transformedVertex.y - height;
|
|
|
|
transformedVertex.xy = transformedVertex.xy + u_offset;
|
|
|
|
float radian = radians(cubeAngle);
|
|
|
|
float radius = (width)/cos(radian);
|
|
|
|
float zenithAngle = acos(transformedVertex.y/radius);
|
|
|
|
float azimuthAngle = asin(transformedVertex.x/radius);
|
|
|
|
transformedVertex.z = radius * sin( zenithAngle ) * cos( azimuthAngle ) - radius*cos( radians( 90.0 - cubeAngle ) );
|
|
|
|
transformedVertex.x = radius * sin( zenithAngle ) * sin( azimuthAngle );
|
|
|
|
|
|
|
|
transformedVertex.xy += vec2( width - u_offset.x, height - u_offset.y );
|
|
|
|
|
|
|
|
vec3 diff = (vertex.xyz - transformedVertex.xyz)*timeLine;
|
|
|
|
transformedVertex.xyz += diff;
|
|
|
|
|
2011-03-06 08:10:21 +00:00
|
|
|
gl_Position = projection*(modelview*screenTransformation*windowTransformation)*transformedVertex;
|
2008-08-07 12:54:16 +00:00
|
|
|
}
|