feature/imgui-sdl
points-test
Last change
on this file since db06984 was db06984, checked in by Dmitry Portnoy <dmp1488@…>, 6 years ago |
Create a particle system that will later be used to render exploding asteroids
|
-
Property mode
set to
100644
|
File size:
537 bytes
|
Line | |
---|
1 | #version 410 core
|
---|
2 |
|
---|
3 | uniform float elapsed_system_time;
|
---|
4 |
|
---|
5 | layout (location = 0) in vec3 v_i; // initial velocity
|
---|
6 | layout (location = 1) in float start_time;
|
---|
7 |
|
---|
8 | out float opacity;
|
---|
9 |
|
---|
10 | void main() {
|
---|
11 | float t = elapsed_system_time - start_time;
|
---|
12 | t = mod(t, 3.0); // allow time to loop around so particle emitter keeps going
|
---|
13 |
|
---|
14 | vec3 p = vec3(0.0, 0.0, 0.0);
|
---|
15 | vec3 a = vec3(0.0, -1.0, 0.0); // gravity
|
---|
16 | p += v_i * t + 0.5 * a * t * t;
|
---|
17 |
|
---|
18 | opacity = 1.0 - (t / 3.0);
|
---|
19 |
|
---|
20 | gl_Position = vec4(p, 1.0);
|
---|
21 | gl_PointSize = 15.0; // size in pixels
|
---|
22 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.