2008-08-07 12:54:16 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
2020-08-02 22:10:35 +00:00
|
|
|
SPDX-FileCopyrightText: 2008, 2011 Martin Gräßlin <kde@martin-graesslin.com>
|
2008-08-07 12:54:16 +00:00
|
|
|
|
2020-08-02 22:10:35 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
2008-08-07 12:54:16 +00:00
|
|
|
*********************************************************************/
|
2013-05-21 08:18:00 +00:00
|
|
|
#version 140
|
2015-12-01 11:11:02 +00:00
|
|
|
uniform mat4 modelViewProjectionMatrix;
|
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;
|
2008-08-07 12:54:16 +00:00
|
|
|
|
2015-12-01 11:11:02 +00:00
|
|
|
in vec4 position;
|
|
|
|
in vec4 texcoord;
|
2011-01-09 20:20:36 +00:00
|
|
|
|
2015-12-01 11:11:02 +00:00
|
|
|
out vec2 texcoord0;
|
2011-01-09 20:20:36 +00:00
|
|
|
|
2008-08-07 12:54:16 +00:00
|
|
|
void main()
|
|
|
|
{
|
2015-12-01 11:11:02 +00:00
|
|
|
texcoord0 = texcoord.st;
|
|
|
|
vec4 transformedVertex = position;
|
2011-01-09 20:20:36 +00:00
|
|
|
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 );
|
|
|
|
|
2015-12-01 11:11:02 +00:00
|
|
|
vec3 diff = (position.xyz - transformedVertex.xyz)*timeLine;
|
2011-01-09 20:20:36 +00:00
|
|
|
transformedVertex.xyz += diff;
|
|
|
|
|
2015-12-01 11:11:02 +00:00
|
|
|
gl_Position = modelViewProjectionMatrix*transformedVertex;
|
2008-08-07 12:54:16 +00:00
|
|
|
}
|