File: ParticleSimple.vert

package info (click to toggle)
psychtoolbox-3 3.0.9%2Bsvn2579.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 63,408 kB
  • sloc: ansic: 73,310; cpp: 11,139; objc: 3,129; sh: 1,669; python: 382; php: 272; makefile: 172; java: 113
file content (33 lines) | stat: -rw-r--r-- 750 bytes parent folder | download | duplicates (2)
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
33
//
// Vertex shader for a particle fountain.
//
// Original Author: Philip Rideout
// Modified by: Mario Kleiner
//
// Derived from example code which is
// Copyright (c) 2002-2006 3Dlabs Inc. Ltd.
//
// See 3Dlabs-License.txt for license information
//

uniform float Time;
uniform float LifeTime;
uniform float Acceleration;
uniform vec3  StartPosition;

void main(void)
{
	vec4 vertex = vec4(1.0);
    vertex.xyz  = StartPosition;

	float t = max(Time - gl_Vertex.w, 0.0);
	t = mod(t, LifeTime);

	vec3 velocity = gl_Vertex.xyz;

	vertex.xyz += velocity * t;
	vertex.y   -= Acceleration * t * t;

	gl_FrontColor = vec4(gl_Color.rgb, 1.0 - (t / LifeTime));
	gl_Position   = gl_ModelViewProjectionMatrix * vertex;
}