ea485e5285
This enforces an even stricter version of the rules from GLSL ES 1.0 Appendix A, Section 5. Essentially, indices (to arrays, vectors, matrices) must be made of literals, loop indices, and expressions made of those two. Bug: skia:10837 Bug: skia:11096 Change-Id: I437a5ed64da58e24d5991ddbde68859f5214e98b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354665 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: John Stiles <johnstiles@google.com>
40 lines
1.2 KiB
JSON
40 lines
1.2 KiB
JSON
{
|
|
"MaxCount": 200,
|
|
"Drawable": {
|
|
"Type": "SkCircleDrawable",
|
|
"Radius": 8
|
|
},
|
|
"EffectCode": [
|
|
"void effectSpawn(inout Effect effect) {",
|
|
" effect.lifetime = 2;",
|
|
"}",
|
|
"",
|
|
"void effectUpdate(inout Effect effect) {",
|
|
" if (effect.age < 0.25 || effect.age > 0.75) { effect.rate = 0; }",
|
|
" else { effect.rate = 200; }",
|
|
"}",
|
|
""
|
|
],
|
|
"Code": [
|
|
"void spawn(inout Particle p) {",
|
|
" int idx = int(rand(p.seed) * 4);",
|
|
" p.color.rgb = (idx == 0) ? float3(0.87, 0.24, 0.11)",
|
|
" : (idx == 1) ? float3(1.00, 0.90, 0.20)",
|
|
" : (idx == 2) ? float3(0.44, 0.73, 0.24)",
|
|
" : float3(0.38, 0.54, 0.95);",
|
|
"",
|
|
" p.lifetime = (1 - effect.age) * effect.lifetime;",
|
|
" p.scale = mix(0.6, 1, rand(p.seed));",
|
|
"}",
|
|
"",
|
|
"void update(inout Particle p) {",
|
|
" p.color.a = 1 - p.age;",
|
|
"",
|
|
" float a = radians(rand(p.seed) * 360);",
|
|
" float invAge = 1 - p.age;",
|
|
" p.vel = float2(cos(a), sin(a)) * mix(250, 550, rand(p.seed)) * invAge * invAge;",
|
|
"}",
|
|
""
|
|
],
|
|
"Bindings": []
|
|
} |