skia2/resources/particles/mouse_track.json
Brian Osman 5b43113e75 Interpreter: Reflect all uniform variables in ByteCode
Gives enough information to locate variables by name (using the same
scheme as glGetUniformLocation), and provide hints about type and size.

Bug: skia:9513
Change-Id: I9444f1042471967a79c9f05167dcdb78eca41bad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244502
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-10-16 15:35:48 +00:00

36 lines
843 B
JSON

{
"MaxCount": 2000,
"Drawable": {
"Type": "SkCircleDrawable",
"Radius": 4
},
"EffectCode": [
"uniform float2 mouse_pos;",
"",
"void effectSpawn(inout Effect effect) {",
" effect.rate = 500;",
"}",
"",
"void effectUpdate(inout Effect effect) {",
" effect.pos = mouse_pos;",
"}",
""
],
"Code": [
"void spawn(inout Particle p) {",
" p.lifetime = 2 + rand;",
" p.vel.y = (20 * rand) - 10;",
"}",
"",
"void update(inout Particle p) {",
" p.color.r = p.age;",
" p.color.g = 1 - p.age;",
" float s1 = 0.5 + (1.5 * p.age);",
" float s2 = 1.0 + (-0.75 * p.age);",
" p.scale = (s1 + (s2 - s1) * rand) * 0.5;",
" p.vel.y += 20.0 * dt;",
"}",
""
],
"Bindings": []
}