• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{
2   "MaxCount": 32,
3   "Duration": 1,
4   "Rate": 8,
5   "Drawable": {
6      "Type": "SkImageDrawable",
7      "Path": "resources/images/explosion_sprites.png",
8      "Columns": 4,
9      "Rows": 4
10   },
11   "Code": [
12      "// float rand; Every read returns a random float [0 .. 1)",
13      "layout(ctype=float) in uniform float dt;",
14      "layout(ctype=float) in uniform float effectAge;",
15      "",
16      "struct Particle {",
17      "  float  age;",
18      "  float  lifetime;",
19      "  float2 pos;",
20      "  float2 dir;",
21      "  float  scale;",
22      "  float2 vel;",
23      "  float  spin;",
24      "  float4 color;",
25      "  float  frame;",
26      "};",
27      "",
28      "float2 circle() {",
29      "  float x;",
30      "  float y;",
31      "  do {",
32      "    x = rand * 2 - 1;",
33      "    y = rand * 2 - 1;",
34      "  } while (x*x + y*y > 1);",
35      "  return float2(x, y);",
36      "}",
37      "",
38      "void spawn(inout Particle p) {",
39      "  p.lifetime = 1.0 + rand * 2.0;",
40      "  p.pos = circle() * 60;",
41      "  p.vel = p.pos / 3;",
42      "}",
43      "",
44      "void update(inout Particle p) {",
45      "  p.frame = p.age;",
46      "}",
47      ""
48   ],
49   "Bindings": []
50}