bevy/crates
Nicola Papale c8167c1276
Add CubicCurve::segment_count + iter_samples adjustment (#8711)
## Objective

- Provide a way to use `CubicCurve` non-iter methods
- Accept a `FnMut` over a `fn` pointer on `iter_samples`
- Improve `build_*_cubic_100_points` benchmark by -45% (this means they
are twice as fast)

### Solution

Previously, the only way to iterate over an evenly spaced set of points
on a `CubicCurve` was to use one of the `iter_*` methods.

The return value of those methods were bound by `&self` lifetime, making
them unusable in certain contexts.

Furthermore, other `CubicCurve` methods (`position`, `velocity`,
`acceleration`) required normalizing `t` over the `CubicCurve`'s
internal segment count.

There were no way to access this segment count, making those methods
pretty much unusable.

The newly added `segment_count` allows accessing the segment count.

`iter_samples` used to accept a `fn`, a function pointer. This is
surprising and contrary to the rust stdlib APIs, which accept `Fn`
traits for `Iterator` combinators.

`iter_samples` now accepts a `FnMut`.

I don't trust a bit the bevy benchmark suit, but according to it, this
doubles (-45%) the performance on the `build_pos_cubic_100_points` and
`build_accel_cubic_100_points` benchmarks.

---

## Changelog

- Added the `CubicCurve::segments` method to access the underlying
segments of a cubic curve
- Allow closures as `CubicCurve::iter_samples` `sample_function`
argument.
2023-05-31 14:57:37 +00:00
..
bevy_a11y Suppress the clippy::type_complexity lint (#8313) 2023-04-06 21:27:36 +00:00
bevy_animation Fixed several missing links in docs. (#8117) 2023-04-23 17:28:36 +00:00
bevy_app fix warning: variable does not need to be mutable (#8688) 2023-05-27 20:50:40 +00:00
bevy_asset update ahash and hashbrown (#8623) 2023-05-23 02:17:07 +00:00
bevy_audio Ability to set a Global Volume (#7706) 2023-04-10 14:08:43 +00:00
bevy_core Add Reflect and FromReflect for AssetPath (#8531) 2023-05-08 19:19:19 +00:00
bevy_core_pipeline Apply codebase changes in preparation for StandardMaterial transmission (#8704) 2023-05-30 14:21:53 +00:00
bevy_derive bevy_derive: Add #[deref] attribute (#8552) 2023-05-16 18:29:09 +00:00
bevy_diagnostic Update sysinfo requirement from 0.28.1 to 0.29.0 (#8650) 2023-05-22 18:11:33 +00:00
bevy_dylib Suppress the clippy::type_complexity lint (#8313) 2023-04-06 21:27:36 +00:00
bevy_dynamic_plugin Update libloading requirement from 0.7 to 0.8 (#8649) 2023-05-22 20:04:15 +00:00
bevy_ecs Document query errors (#8692) 2023-05-30 14:41:14 +00:00
bevy_ecs_compile_fail_tests Fix 1.69 CI clippy lints (#8450) 2023-04-20 16:51:21 +00:00
bevy_encase_derive update syn, encase, glam and hexasphere (#8573) 2023-05-16 01:24:17 +00:00
bevy_gilrs Add gamepad rumble support to bevy_input (#8398) 2023-04-24 15:28:53 +00:00
bevy_gizmos Webgpu support (#8336) 2023-05-04 22:07:57 +00:00
bevy_gltf Add support for custom glTF vertex attributes. (#5370) 2023-04-24 14:20:13 +00:00
bevy_hierarchy Expose sorting methods in Children (#8522) 2023-05-01 15:57:25 +00:00
bevy_input Fix typos in gamepad AxisSettings (#8542) 2023-05-04 23:23:45 +00:00
bevy_internal Add support for pnm textures (#8601) 2023-05-16 23:51:47 +00:00
bevy_log Hide naga info logs & Derive PartialEq on Timer and Stopwatch (#8664) 2023-05-24 15:16:15 +00:00
bevy_macro_utils update syn, encase, glam and hexasphere (#8573) 2023-05-16 01:24:17 +00:00
bevy_macros_compile_fail_tests bevy_derive: Add #[deref] attribute (#8552) 2023-05-16 18:29:09 +00:00
bevy_math Add CubicCurve::segment_count + iter_samples adjustment (#8711) 2023-05-31 14:57:37 +00:00
bevy_mikktspace update syn, encase, glam and hexasphere (#8573) 2023-05-16 01:24:17 +00:00
bevy_pbr Apply codebase changes in preparation for StandardMaterial transmission (#8704) 2023-05-30 14:21:53 +00:00
bevy_ptr Fixed several missing links in docs. (#8117) 2023-04-23 17:28:36 +00:00
bevy_reflect bevy_reflect: Allow #[reflect(default)] on enum variant fields (#8514) 2023-05-29 15:29:29 +00:00
bevy_reflect_compile_fail_tests Fix 1.69 CI clippy lints (#8450) 2023-04-20 16:51:21 +00:00
bevy_render Apply codebase changes in preparation for StandardMaterial transmission (#8704) 2023-05-30 14:21:53 +00:00
bevy_scene Rename map_entities and map_specific_entities (#7570) 2023-05-01 21:40:19 +00:00
bevy_sprite Make Material2d pipeline systems public (#8642) 2023-05-23 02:16:39 +00:00
bevy_tasks Fixed several missing links in docs. (#8117) 2023-04-23 17:28:36 +00:00
bevy_text Remove unused field in FontAtlasSet (#8639) 2023-05-19 18:55:12 +00:00
bevy_time Hide naga info logs & Derive PartialEq on Timer and Stopwatch (#8664) 2023-05-24 15:16:15 +00:00
bevy_transform Fix look_to variable naming (#8627) 2023-05-23 02:17:33 +00:00
bevy_ui Move bevy_ui accessibility systems to PostUpdate. (#8653) 2023-05-23 23:50:48 +00:00
bevy_utils Allow missing docs on wasm implementation of BoxedFuture (#8674) 2023-05-26 00:29:26 +00:00
bevy_window Correct RequestRedraw documentation (#8640) 2023-05-23 02:16:56 +00:00
bevy_winit Move bevy_ui accessibility systems to PostUpdate. (#8653) 2023-05-23 23:50:48 +00:00