Remove use of do-while loops from particle examples
This was unnecessary (closed-form unit-disc picking is simpler), and these loops don't meet the strict ES2 standards that we'll be applying to the interpreter soon. Bug: skia:11095 Change-Id: Ic2617c2807fe49d57ff8e4d57d70b9ed1f015916 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348895 Reviewed-by: Kevin Lubick <kjlubick@google.com> Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
a8c32104f2
commit
2ae02492a7
@ -48,12 +48,9 @@
|
||||
],
|
||||
"Code": [
|
||||
"float2 circle(inout float seed) {",
|
||||
" float2 xy;",
|
||||
" do {",
|
||||
" xy.x = 2 * rand(seed) - 1;",
|
||||
" xy.y = 2 * rand(seed) - 1;",
|
||||
" } while (dot(xy, xy) > 1);",
|
||||
" return xy;",
|
||||
" float r = sqrt(rand(seed));",
|
||||
" float a = rand(seed) * 6.283185;",
|
||||
" return r * float2(sin(a), cos(a));",
|
||||
"}",
|
||||
"",
|
||||
"void spawn(inout Particle p) {",
|
||||
|
@ -15,13 +15,9 @@
|
||||
],
|
||||
"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);",
|
||||
" float r = sqrt(rand(seed));",
|
||||
" float a = rand(seed) * 6.283185;",
|
||||
" return r * float2(sin(a), cos(a));",
|
||||
"}",
|
||||
"",
|
||||
"void spawn(inout Particle p) {",
|
||||
|
@ -12,13 +12,9 @@
|
||||
],
|
||||
"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);",
|
||||
" float r = sqrt(rand(seed));",
|
||||
" float a = rand(seed) * 6.283185;",
|
||||
" return r * float2(sin(a), cos(a));",
|
||||
"}",
|
||||
"",
|
||||
"void spawn(inout Particle p) {",
|
||||
|
@ -65,7 +65,7 @@ Samples
|
||||
<figure>
|
||||
<canvas id=raincloud width=400 height=400></canvas>
|
||||
<figcaption>
|
||||
<a href="https://particles.skia.org/cbf9d596fd0966b888aa6c2df5b8d695"
|
||||
<a href="https://particles.skia.org/df5346ce2ab11a0f24e44143bded84d1"
|
||||
target=_blank rel=noopener>Raincloud</a>
|
||||
</figcaption>
|
||||
</figure>
|
||||
@ -431,12 +431,9 @@ const raincloud = {
|
||||
],
|
||||
"Code": [
|
||||
"float2 circle(inout float seed) {",
|
||||
" float2 xy;",
|
||||
" do {",
|
||||
" xy.x = 2 * rand(seed) - 1;",
|
||||
" xy.y = 2 * rand(seed) - 1;",
|
||||
" } while (dot(xy, xy) > 1);",
|
||||
" return xy;",
|
||||
" float r = sqrt(rand(seed));",
|
||||
" float a = rand(seed) * 6.283185;",
|
||||
" return r * float2(sin(a), cos(a));",
|
||||
"}",
|
||||
"",
|
||||
"void spawn(inout Particle p) {",
|
||||
|
Loading…
Reference in New Issue
Block a user