e11c43804b
uint (and bitwise operations) aren't supported by our minimum spec, and they're going to be removed from public SkSL. For now, convert the random generator to a good-enough chaotic sequence of high-frequency sine waves. If/when the interpreter (and particles) are converted to the newer skvm backend, it will be straightforward to support custom intrinsics that emit skvm instructions directly into the builder, and re-introduce a better integer-based PRNG, without requiring SkSL language support. Bug: skia:11093 Change-Id: I885b15a51a9e5c12b4274b5938d8deb77219d41b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347036 Reviewed-by: John Stiles <johnstiles@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
40 lines
896 B
JSON
40 lines
896 B
JSON
{
|
|
"MaxCount": 32,
|
|
"Drawable": {
|
|
"Type": "SkImageDrawable",
|
|
"Path": "images",
|
|
"Name": "explosion_sprites.png",
|
|
"Columns": 4,
|
|
"Rows": 4
|
|
},
|
|
"EffectCode": [
|
|
"void effectSpawn(inout Effect effect) {",
|
|
" effect.rate = 8;",
|
|
"}",
|
|
""
|
|
],
|
|
"Code": [
|
|
"float2 circle(inout float seed) {",
|
|
" float x;",
|
|
" float y;",
|
|
" do {",
|
|
" x = rand(seed) * 2 - 1;",
|
|
" y = rand(seed) * 2 - 1;",
|
|
" } while (x*x + y*y > 1);",
|
|
" return float2(x, y);",
|
|
"}",
|
|
"",
|
|
"void spawn(inout Particle p) {",
|
|
" p.lifetime = 1.0 + rand(p.seed) * 2.0;",
|
|
" float2 ofs = circle(p.seed) * 60;",
|
|
" p.pos += ofs;",
|
|
" p.vel = ofs / 3;",
|
|
"}",
|
|
"",
|
|
"void update(inout Particle p) {",
|
|
" p.frame = p.age;",
|
|
"}",
|
|
""
|
|
],
|
|
"Bindings": []
|
|
} |