feat: migrate to glam whenever relevant + migrate testbed to kiss3d instead of bevy + release v0.32.0 (#909)
* feat: migrate to glam whenever relevant + migrate testbed to kiss3d instead of bevy * chore: update changelog * Fix warnings and tests * Release v0.32.0
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rapier3d-meshloader"
|
||||
version = "0.12.0"
|
||||
version = "0.13.0"
|
||||
authors = ["Sébastien Crozet <sebcrozet@dimforge.com>"]
|
||||
description = "STL file loader for the 3D rapier physics engine."
|
||||
documentation = "https://docs.rs/rapier3d-meshloader"
|
||||
@@ -29,4 +29,4 @@ thiserror = "2"
|
||||
profiling = "1.0"
|
||||
mesh-loader = "0.1.12"
|
||||
|
||||
rapier3d = { version = "0.31.0", path = "../rapier3d" }
|
||||
rapier3d = { version = "0.32.0", path = "../rapier3d" }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use mesh_loader::Mesh;
|
||||
use rapier3d::geometry::{MeshConverter, SharedShape};
|
||||
use rapier3d::math::{Isometry, Point, Real, Vector};
|
||||
use rapier3d::math::{Pose, Vector};
|
||||
use rapier3d::prelude::MeshConverterError;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -11,8 +11,8 @@ use std::path::Path;
|
||||
pub struct LoadedShape {
|
||||
/// The shape loaded from the file and converted by the [`MeshConverter`].
|
||||
pub shape: SharedShape,
|
||||
/// The shape’s pose.
|
||||
pub pose: Isometry<Real>,
|
||||
/// The shape's pose.
|
||||
pub pose: Pose,
|
||||
/// The raw mesh read from the file without any modification.
|
||||
pub raw_mesh: Mesh,
|
||||
}
|
||||
@@ -41,7 +41,7 @@ pub enum MeshLoaderError {
|
||||
pub fn load_from_path(
|
||||
path: impl AsRef<Path>,
|
||||
converter: &MeshConverter,
|
||||
scale: Vector<Real>,
|
||||
scale: Vector,
|
||||
) -> Result<Vec<Result<LoadedShape, MeshConverterError>>, MeshLoaderError> {
|
||||
let loader = mesh_loader::Loader::default();
|
||||
let mut colliders = vec![];
|
||||
@@ -71,16 +71,13 @@ pub fn load_from_path(
|
||||
pub fn load_from_raw_mesh(
|
||||
raw_mesh: &Mesh,
|
||||
converter: &MeshConverter,
|
||||
scale: Vector<Real>,
|
||||
) -> Result<(SharedShape, Isometry<Real>), MeshConverterError> {
|
||||
let mut vertices: Vec<_> = raw_mesh
|
||||
scale: Vector,
|
||||
) -> Result<(SharedShape, Pose), MeshConverterError> {
|
||||
let vertices: Vec<_> = raw_mesh
|
||||
.vertices
|
||||
.iter()
|
||||
.map(|xyz| Point::new(xyz[0], xyz[1], xyz[2]))
|
||||
.map(|xyz| Vector::new(xyz[0], xyz[1], xyz[2]) * scale)
|
||||
.collect();
|
||||
vertices
|
||||
.iter_mut()
|
||||
.for_each(|pt| pt.coords.component_mul_assign(&scale));
|
||||
let indices: Vec<_> = raw_mesh.faces.clone();
|
||||
converter.convert(vertices, indices)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user