-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironment_under.vert
32 lines (25 loc) · 1.19 KB
/
environment_under.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_3d.glsl"
// constant values
const float c_v1MapResolution = 0.42; // normal map resolution
// shader uniforms
uniform float u_v1Time; // current animation value
uniform float u_v1Offset; // current y-position offset
void VertexMain()
{
// transform position (with reduced depth)
gl_Position = coreObject3DPositionLow();
gl_Position.z -= 0.4 * gl_Position.w;
// calculate current mapping base
vec2 v2MapCoord = vec2(a_v2LowTexCoord.x * c_v1MapResolution,
a_v2LowTexCoord.y * c_v1MapResolution + u_v1Offset);
// transform texture coordinates with different animation properties
v_av2TexCoord[0] = (v2MapCoord + u_v1Time * vec2(0.5, -0.5)) * 1.0;
}