mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Update glam
, encase
and hexasphere
(#11082)
Update to `glam` 0.25, `encase` 0.7 and `hexasphere` to 10.0 ## Changelog Added the `FloatExt` trait to the `bevy_math` prelude which adds `lerp`, `inverse_lerp` and `remap` methods to the `f32` and `f64` types.
This commit is contained in:
parent
c0f8338697
commit
ec14e946b8
9 changed files with 15 additions and 16 deletions
|
@ -7,7 +7,7 @@ publish = false
|
|||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[dev-dependencies]
|
||||
glam = "0.24.1"
|
||||
glam = "0.25"
|
||||
rand = "0.8"
|
||||
rand_chacha = "0.3"
|
||||
criterion = { version = "0.3", features = ["html_reports"] }
|
||||
|
|
|
@ -10,7 +10,7 @@ use bevy_asset::{Asset, AssetApp, Assets, Handle};
|
|||
use bevy_core::Name;
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_hierarchy::{Children, Parent};
|
||||
use bevy_math::{Quat, Vec3};
|
||||
use bevy_math::{FloatExt, Quat, Vec3};
|
||||
use bevy_reflect::Reflect;
|
||||
use bevy_render::mesh::morph::MorphWeights;
|
||||
use bevy_time::Time;
|
||||
|
@ -593,7 +593,7 @@ fn run_animation_player(
|
|||
fn lerp_morph_weights(weights: &mut [f32], keyframe: impl Iterator<Item = f32>, key_lerp: f32) {
|
||||
let zipped = weights.iter_mut().zip(keyframe);
|
||||
for (morph_weight, keyframe) in zipped {
|
||||
*morph_weight += (keyframe - *morph_weight) * key_lerp;
|
||||
*morph_weight = morph_weight.lerp(keyframe, key_lerp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -721,7 +721,7 @@ fn apply_animation(
|
|||
};
|
||||
let ts_start = curve.keyframe_timestamps[step_start];
|
||||
let ts_end = curve.keyframe_timestamps[step_start + 1];
|
||||
let lerp = (animation.seek_time - ts_start) / (ts_end - ts_start);
|
||||
let lerp = f32::inverse_lerp(ts_start, ts_end, animation.seek_time);
|
||||
|
||||
apply_keyframe(
|
||||
curve,
|
||||
|
@ -844,7 +844,7 @@ fn apply_keyframe(
|
|||
let result = morph_start
|
||||
.iter()
|
||||
.zip(morph_end)
|
||||
.map(|(a, b)| *a + lerp * (*b - *a));
|
||||
.map(|(a, b)| a.lerp(*b, lerp));
|
||||
lerp_morph_weights(morphs.weights_mut(), result, weight);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
|
|||
keywords = ["bevy"]
|
||||
|
||||
[dependencies]
|
||||
glam = { version = "0.24.1", features = ["bytemuck"] }
|
||||
glam = { version = "0.25", features = ["bytemuck"] }
|
||||
serde = { version = "1", features = ["derive"], optional = true }
|
||||
|
||||
[features]
|
||||
|
|
|
@ -26,8 +26,8 @@ pub mod prelude {
|
|||
CubicBSpline, CubicBezier, CubicCardinalSpline, CubicGenerator, CubicHermite,
|
||||
CubicSegment,
|
||||
},
|
||||
primitives, BVec2, BVec3, BVec4, EulerRot, IRect, IVec2, IVec3, IVec4, Mat2, Mat3, Mat4,
|
||||
Quat, Ray2d, Ray3d, Rect, URect, UVec2, UVec3, UVec4, Vec2, Vec2Swizzles, Vec3,
|
||||
primitives, BVec2, BVec3, BVec4, EulerRot, FloatExt, IRect, IVec2, IVec3, IVec4, Mat2,
|
||||
Mat3, Mat4, Quat, Ray2d, Ray3d, Rect, URect, UVec2, UVec3, UVec4, Vec2, Vec2Swizzles, Vec3,
|
||||
Vec3Swizzles, Vec4, Vec4Swizzles,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ license = "Zlib AND (MIT OR Apache-2.0)"
|
|||
keywords = ["bevy", "3D", "graphics", "algorithm", "tangent"]
|
||||
|
||||
[dependencies]
|
||||
glam = "0.24.1"
|
||||
glam = "0.25"
|
||||
|
||||
[[example]]
|
||||
name = "generate"
|
||||
|
|
|
@ -32,7 +32,7 @@ downcast-rs = "1.2"
|
|||
thiserror = "1.0"
|
||||
serde = "1"
|
||||
|
||||
glam = { version = "0.24.1", features = ["serde"], optional = true }
|
||||
glam = { version = "0.25", features = ["serde"], optional = true }
|
||||
smol_str = { version = "0.2.0", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -77,7 +77,7 @@ downcast-rs = "1.2.0"
|
|||
thread_local = "1.1"
|
||||
thiserror = "1.0"
|
||||
futures-lite = "2.0.1"
|
||||
hexasphere = "9.0"
|
||||
hexasphere = "10.0"
|
||||
ddsfile = { version = "0.5.0", optional = true }
|
||||
ktx2 = { version = "0.3.0", optional = true }
|
||||
# For ktx2 supercompression
|
||||
|
@ -85,7 +85,7 @@ flate2 = { version = "1.0.22", optional = true }
|
|||
ruzstd = { version = "0.4.0", optional = true }
|
||||
# For transcoding of UASTC/ETC1S universal formats, and for .basis file support
|
||||
basis-universal = { version = "0.3.0", optional = true }
|
||||
encase = { version = "0.6.1", features = ["glam"] }
|
||||
encase = { version = "0.7", features = ["glam"] }
|
||||
# For wgpu profiling using tracing. Use `RUST_LOG=info` to also capture the wgpu spans.
|
||||
profiling = { version = "1", features = [
|
||||
"profile-with-tracing",
|
||||
|
|
|
@ -99,8 +99,7 @@ fn update_parallax_depth_scale(
|
|||
let mut text = text.single_mut();
|
||||
for (_, mat) in materials.iter_mut() {
|
||||
let current_depth = mat.parallax_depth_scale;
|
||||
let new_depth =
|
||||
current_depth * (1.0 - DEPTH_CHANGE_RATE) + (target_depth.0 * DEPTH_CHANGE_RATE);
|
||||
let new_depth = current_depth.lerp(target_depth.0, DEPTH_CHANGE_RATE);
|
||||
mat.parallax_depth_scale = new_depth;
|
||||
text.sections[0].value = format!("Parallax depth scale: {new_depth:.5}\n");
|
||||
if (new_depth - current_depth).abs() <= 0.000000001 {
|
||||
|
|
|
@ -113,8 +113,8 @@ impl TargetScale {
|
|||
|
||||
fn current_scale(&self) -> f32 {
|
||||
let completion = self.target_time.fraction();
|
||||
let multiplier = ease_in_expo(completion);
|
||||
self.start_scale + (self.target_scale - self.start_scale) * multiplier
|
||||
let t = ease_in_expo(completion);
|
||||
self.start_scale.lerp(self.target_scale, t)
|
||||
}
|
||||
|
||||
fn tick(&mut self, delta: Duration) -> &Self {
|
||||
|
|
Loading…
Reference in a new issue