shader2movev.glsl revision e5f2f66f8c802d64ecf869081036ae13d4e9e19c
1varying vec3 varWorldPos;
2varying vec3 varWorldNormal;
3varying vec2 varTex0;
4
5// This is where actual shader code begins
6void main() {
7   vec4 objPos = ATTRIB_position;
8   vec3 oldPos = objPos.xyz;
9   objPos.xyz += 0.1*sin(objPos.xyz*2.0 + UNI_time);
10   objPos.xyz += 0.05*sin(objPos.xyz*4.0 + UNI_time*0.5);
11   objPos.xyz += 0.02*sin(objPos.xyz*7.0 + UNI_time*0.75);
12   vec4 worldPos = UNI_model * objPos;
13   gl_Position = UNI_proj * worldPos;
14
15   mat3 model3 = mat3(UNI_model[0].xyz, UNI_model[1].xyz, UNI_model[2].xyz);
16   vec3 worldNorm = model3 * (ATTRIB_normal + oldPos - objPos.xyz);
17
18   varWorldPos = worldPos.xyz;
19   varWorldNormal = worldNorm;
20   varTex0 = ATTRIB_texture0;
21}
22