nannou-org / nannou

A Creative Coding Framework for Rust.
https://nannou.cc/
6.04k stars 305 forks source link

Abstract the `nannou::draw` module into the new `bevy_nannou_draw` crate #955

Open mitchmindtree opened 10 months ago

mitchmindtree commented 10 months ago

See the Rough Plan section of this comment for some context.

In general, the idea is to enable using nannou's Draw abstraction (i.e. draw.circle(), etc) into a bevy plugin so that it can be included conveniently in any bevy application with ease.

The bevy_nannou_draw crate was added in #951.

Note: Depends on #954. A step in #953.

tychedelia commented 9 months ago

One immediately annoying thing is that our Draw instance isn't Send + Sync due to the internal use of Rc<RefCell>>. Nannou has non-send resources, but we'll probably want to use Draw as a component per-camera view to make it easier to query and access.

tychedelia commented 9 months ago

One extremely annoying thing about bevy assets is that they load asynchronously, which makes sense for enforcing state transitions in a game, but is almost never what we want. Worst case, this leads to polluting a lot of our logic with "this texture might be ready or not", when we'd probably be happy just blocking rendering entirely until the user loads their assets up front. Like all things here, maybe there's some benefits for more advanced use cases, but a bit of friction. For loading something like an image, this should almost always be basically instant, but I'm a bit conflicted about whether it's better to (a). engineer our own wrapper that enforces blocking (see solutions here https://github.com/bevyengine/bevy/issues/1701) or (b). guard against missing textures in our code and deal with a bit of flicker, unsure what this actually looks like in practice.