-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu_animate.vert
32 lines (25 loc) · 1.15 KB
/
menu_animate.vert
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
///////////////////////////////////////////////////////
//*-------------------------------------------------*//
//| Part of Project One (https://www.maus-games.at) |//
//*-------------------------------------------------*//
//| Copyright (c) 2010 Martin Mauersics |//
//| Released under the zlib License |//
//*-------------------------------------------------*//
///////////////////////////////////////////////////////
#include "engine/data_transform_2d.glsl"
// shader uniforms
uniform mediump vec4 u_v4Scale; //
// shader output
varying vec3 v_v3AnimCoord; //
void VertexMain()
{
// transform position
gl_Position = coreObject2DPosition();
// calculate basic texture coordinates (with alpha-value as fixed modifier)
vec2 v2NewTexCoord = a_v2LowTexCoord * u_v2TexSize - vec2(u_v4Color.a, 0.0);
// animate final texture coordinates into 3 different directions
v_av2TexCoord[0] = v2NewTexCoord * u_v4Scale.zw - vec2(0.0, u_v2TexOffset.y);
v_v3AnimCoord = vec3(v2NewTexCoord.x + u_v2TexOffset.x,
v2NewTexCoord.x - u_v2TexOffset.x,
v2NewTexCoord.y);
}