4c63a1eada
Update sample effects to use that (and remove the need for the hacky workaround "random -> frame" affector I was using). Current perf on my workstation, 6k particles updating: native: 0.67 ms interp: 0.97 ms Change-Id: I3a2168c210d7431ffffe2b87ab6adade69f1dce7 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214190 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
41 lines
1.6 KiB
JSON
41 lines
1.6 KiB
JSON
{
|
|
"MaxCount": 6000,
|
|
"Duration": 5,
|
|
"Rate": 2000,
|
|
"Life": {
|
|
"Input": {
|
|
"Source": "Age",
|
|
"TileMode": "Repeat",
|
|
"Left": 0,
|
|
"Right": 1
|
|
},
|
|
"XValues": [],
|
|
"Segments": [
|
|
{
|
|
"Type": "Constant",
|
|
"Ranged": true,
|
|
"Bidirectional": false,
|
|
"A0": 2,
|
|
"A1": 4
|
|
}
|
|
]
|
|
},
|
|
"Drawable": {
|
|
"Type": "SkCircleDrawable",
|
|
"Radius": 2
|
|
},
|
|
"Spawn": [
|
|
{
|
|
"Type": "SkInterpreterAffector",
|
|
"Enabled": true,
|
|
"Code": "// float rand;\nlayout(ctype=float) in uniform float dt;\nlayout(ctype=float) in uniform float effectAge;\n\nvoid main(in float age,\n in float invLifetime,\n inout float2 pos,\n inout float2 dir,\n inout float scale,\n inout float2 vel,\n inout float spin,\n inout float4 color) {\n vel.x = 50 + (30 * rand);\n vel.y = (rand * 20) - 10;\n}\n"
|
|
}
|
|
],
|
|
"Update": [
|
|
{
|
|
"Type": "SkInterpreterAffector",
|
|
"Enabled": true,
|
|
"Code": "// float rand;\nlayout(ctype=float) in uniform float dt;\nlayout(ctype=float) in uniform float effectAge;\n\nvoid main(in float age,\n in float invLifetime,\n inout float2 pos,\n inout float2 dir,\n inout float scale,\n inout float2 vel,\n inout float spin,\n inout float4 color) {\n color.r = age;\n color.g = 1 - age;\n\n float s1 = 0.5 + (1.5 * age);\n float s2 = 1.0 + (-0.75 * age);\n scale = s1 + (s2 - s1) * rand;\n\n vel.y += 20.0 * dt;\n}\n"
|
|
}
|
|
]
|
|
} |