[Impeller] add support for superellipse.#54562
[Impeller] add support for superellipse.#54562auto-submit[bot] merged 11 commits intoflutter:mainfrom
Conversation
|
|
||
| Point center_; | ||
| // 4 is a rectellipse | ||
| int degree_; |
There was a problem hiding this comment.
This needs to be a scalar. Thats how you'd get stuff like astroids in https://en.wikipedia.org/wiki/Superellipse
chinmaygarde
left a comment
There was a problem hiding this comment.
Awesome. We can work with this. Have some nits and the todos already mentioned. But we can land and keep tinkering on this.
| // quadrants. | ||
| std::vector<Point> points; | ||
| points.reserve(41); | ||
| for (int i = 0; i < 41; i++) { |
There was a problem hiding this comment.
Nit: I prefer <= 40 in a case like this where 40 is an inclusive target as opposed to for loops < count which are an exclusive target.
| Scalar n = degree_; | ||
|
|
||
| // TODO(jonahwilliams): determine parameter values based on scaling factor. | ||
| Scalar step = kPi / 80; |
There was a problem hiding this comment.
Putting this part in the Tessellator would allow it to leverage the "GetTrigsForDivisions" caching.
There was a problem hiding this comment.
I'm going to leave this out for now so its stays separate before we decide how to ship it, but I agree it should eventually live in the tessellator.
There was a problem hiding this comment.
Good call if it isolates it until we figure out its future. It will matter a little for benchmarks, but not for testing its usefulness.
|
For folks trying to run the playground: Build engine. et build -c host_debug_unopt_arm64Run test. ./out/host_debug_unopt_arm64/impeller_unittests --gtest_filter="*DrawSuperEllipse/Metal" --timeout=0 --enable_playgroundSuperellipse.mov |
| Scalar x = a * pow(abs(cos(t)), 2 / n); | ||
| Scalar y = b * pow(abs(sin(t)), 2 / n); | ||
| points.emplace_back(x, y); | ||
| } |
There was a problem hiding this comment.
Nit: final points are always computed from points[i] * radius, so just bake radius into the point here.
| geometry.reserve(1 + 4 * points.size()); | ||
| geometry.push_back(center_); | ||
| for (auto i = 0u; i < points.size(); i++) { | ||
| geometry.push_back(center_ + ((reflection[0] * points[i]) * radius_)); |
There was a problem hiding this comment.
Does OOO matter for these equations? ((ref * pt) * rad) vs (ref * (pt * rad)) vs just (ref * pt * rad)?
There was a problem hiding this comment.
(Relates to my comment above about just multiplying by radius in the points array...)
|
If this is just for testing, can the new Entity/Geometry classes be just inlined in the test file for now? They're pretty small. |
|
I think its OK as it is ... and I really don't want to update the license script again 😢 |
flutter/engine@65fd6ca...68938ab 2024-08-15 jonahwilliams@google.com [Impeller] add support for superellipse. (flutter/engine#54562) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
) flutter/engine@65fd6ca...68938ab 2024-08-15 jonahwilliams@google.com [Impeller] add support for superellipse. (flutter/engine#54562) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
) flutter/engine@65fd6ca...68938ab 2024-08-15 jonahwilliams@google.com [Impeller] add support for superellipse. (flutter/engine#54562) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This is an entity testing only implementation of a superellipse. rectellipse is a special case where degree = 4.
Part of flutter/flutter#139321