1# Changelog 2 3All notable changes to this project will be documented in this file. 4 5The format is based on [Keep a Changelog], and this project adheres to 6[Semantic Versioning]. 7 8## [0.25.0] - 2023-12-19 9 10### Breaking changes 11 12* Changed `Vec4` to always used `BVec4A` as a mask type, regardless if the 13 target architecture has SIMD support in glam. Previously this was inconsistent 14 on different hardware like ARM. This will have a slight performance cost when 15 SIMD is not available. `Vec4` will continue to use `BVec4` as a mask type when 16 the `scalar-math` feature is used. 17 18### Fixed 19 20* Made `Affine2` implement the `bytemuck::AnyBitPattern` trait instead of 21 `bytemuck::Pod` as it contains internal padding due to `Mat2` being 16 byte 22 aligned. 23 24* Updated the `core-simd` implementation to build on latest nightly. 25 26### Added 27 28* Added `to_angle` method to 2D vectors. 29 30* Added `FloatExt` trait which adds `lerp`, `inverse_lerp` and `remap` methods 31 to `f32` and `f64` types. 32 33* Added `i16` and `u16` vector types, `I16Vec2`, `I16Vec3`, `I16Vec4`, 34 `U16Vec2`, `U16Vec3` and `U16Vec4`. 35 36### Changed 37 38* Renamed `Quat::as_f64()` to `Quat::as_dquat()` and `DQuat::as_f32()` to 39 `DQuat::as_quat()` to be consistent with other types. The old methods have 40 been deprecated. 41 42* Added the `#[must_use]` attribute to all pure functions following the 43 guidelines for the Rust standard library. 44 45## [0.24.2] - 2023-09-23 46 47### Fixed 48 49* Fixed singularities in `Quat::to_euler`. 50 51### Added 52 53* Added `div_euclid` and `rem_euclid` to integer vector types. 54 55* Added wrapping and saturating arithmetic operations to integer vector types. 56 57* Added `to_scale_angle_translation` to 2D affine types. 58 59* Added `mul_assign` ops to affine types. 60 61### Changed 62 63* Disable default features on optional `rkyv` dependency. 64 65## [0.24.1] - 2023-06-24 66 67### Added 68 69* Implemented missing `bytemuck`, `mint`, `rand`, `rkyv` and `serde` traits for 70 `i64` and `u64` types. 71 72* Added missing safe `From` conversions from `f32` vectors to `f64` vectors. 73 74* Added `TryFrom` implementations between different vector types. 75 76* Added `test` and `set` methods to `bool` vector types for testing and setting 77 individual mask elements. 78 79* Added `MIN`, `MAX`, `INFINITY` and `NEG_INFINITY` vector constants. 80 81## [0.24.0] - 2023-04-24 82 83### Breaking changes 84 85* Enabling `libm` in a `std` build now overrides the `std` math functions. This 86 is unlikely to break anything but it is a change in behavior. 87 88### Added 89 90* Added `i64` and `u64` vector types; `I64Vec2`, `I64Vec3`, `I64Vec4`, 91 `U64Vec2`, `U64Vec3` and `U64Vec4`. 92 93* Added `length_squared` method on signed and unsigned integer vector types. 94 95* Added `distance_squared` method on signed integer vector types. 96 97* Implemented the `bytemuck` `AnyBitPattern` trait on `Vec3A`, `Mat3A` and 98 `Affine3A`. 99 100### Changed 101 102* Changed quaternion `to_axis_angle` for improved numerical stability. 103 104### Removed 105 106* Removed dependency on `serde_derive` for improved compile times when using 107 `serde`. 108 109## [0.23.0] - 2023-02-22 110 111### Breaking changes 112 113* When the `scalar-math` feature is enabled the vector mask type for `Vec3A` was 114 changed from `BVec3` to `BVec3A`. 115 116### Added 117 118* Added `copysign` method to signed vector types. 119 120## [0.22.0] - 2022-10-24 121 122### Breaking changes 123 124* Added `u32` implementation of `BVec3A` and `BVec4` when SIMD is not available. 125 These are used instead of aliasing to the `bool` implementations. 126 127* Removed `Add`, `Sub`, and scalar `Mul` implementations from affine types as 128 they didn't make sense on these types. 129 130* Removed deprecated `const_*` macros. These have been replaced by `const fn` 131 methods. 132 133### Fixed 134 135* Fixed `neg` and `signum` to consistently handle negative zero across multiple 136 platforms. 137 138* Removed `register_attr` feature usage for SPIR-V targets. 139 140### Added 141 142* Added missing `Serialize`, `Deserialize` and `PartialEq` implementations. 143 144* Added `Sum<Self>` and `Product<Self>` implementations for all vector, matrix 145 and quaternion types. 146 147* Added 4x4 matrix methods `look_to_lh` and `look_to_rh`. These were previously 148 private. 149 150* Added `dot_into_vec` methods to vector which returns the result of the dot 151 product splatted to all vector lanes. 152 153* Added `is_negative_bitmask` to vector types which returns a `u32` of bits for 154 each negative vector lane. 155 156* Added `splat` method and `TRUE` and `FALSE` constants to all `BVec` types. 157 158* Added `from_mat3a` methods to `Affine2`, `Mat2`, `Mat4` and `Quat` types. 159 160### Changed 161 162* Disable `serde` default features. 163 164* Made `to_cols_array`, `to_cols_array_2d`, and `from_diagonal` methods 165 `const fn`. 166 167## [0.21.3] - 2022-08-02 168 169### Fixed 170 171* Fixed `glam_assert` being too restrictive in matrix transform point and 172 transform vector methods. 173 174### Added 175 176* Added experimental `core-simd` feature which enables SIMD support via the 177 unstable `core::simd` module. 178 179### Changed 180 181* Derive from `PartialEq` and `Eq` instead of providing a trait implementation 182 for all non SIMD types. 183 184## [0.21.2] - 2022-06-25 185 186### Fixed 187 188* Restore missing `$crate::` prefix in deprecated `const_*` macros. 189 190* Fixed some performance regressions in affine and matrix determinant and 191 inverses due to lack of inlining. 192 193* Fixed some performance regressions in the SSE2 `Vec3A` to `Vec3` from 194 conversion. 195 196### Added 197 198* Implemented `BitXor` and `BitXorAssign` traits for `bool` vectors. 199 200## [0.21.1] - 2022-06-22 201 202### Fixed 203 204* Fix compilation when FMA support is enabled. 205 206## [0.21.0] - 2022-06-22 207 208### Breaking changes 209 210* Minimum Supported Version of Rust bumped to 1.58.1 to allow `const` pointer 211 dereferences in constant evaluation. 212 213* The `abs_diff_eq` method on `Mat2` and `DMat2` now takes `other` by value 214 instead of reference. This is consistent with the other matrix types. 215 216* The `AsMut` and `Deref` trait implementations on `Quat` and `DQuat` was 217 removed. Quaternion fields are now public. 218 219* The `AsRef` trait implementations were removed from `BVec2`, `BVec3`, 220 `BVec3A`, `BVec4` and `BVec4A`. 221 222### Added 223 224* `NEG_ONE` constant was added to all signed vector types. 225 226* `NEG_X`, `NEG_Y`, `NEG_Z` and `NEG_W` negative axis vectors were added to 227 signed vector types. 228 229* The `rotate` and `from_angle` methods were added to `Vec2` and `DVec2`. 230 `from_angle` returns a 2D vector containing `[angle.cos(), angle.sin()]` that 231 can be used to `rotate` another 2D vector. 232 233* The `from_array` `const` function was added to all vector types. 234 235### Changed 236 237* Source code is now largely generated. This removes most usage of macros 238 internally to improve readability. There should be no change in API or 239 behavior other than what is documented here. 240 241* Many methods have been made `const fn`: 242 * `new`, `splat`, `from_slice`, `to_array` and `extend` on vector types 243 * `from_cols`, `from_cols_array`, `from_cols_array_2d`, `from_cols_slice` on 244 matrix types 245 * `from_xyzw` and `from_array` on quaternion types 246 * `from_cols` on affine types 247 248* The `const` new macros where deprecated. 249 250### Removed 251 252* Deleted deprecated `TransformRT` and `TransformSRT` types. 253 254## [0.20.5] - 2022-04-12 255 256### Fixed 257 258* Fixed a bug in the scalar implementation of 4D vector `max_element` method 259 where the `w` element check was incorrect. 260 261## [0.20.4] - 2022-04-11 262 263### Fixed 264 265* Fixed a bug with quaternion `slerp` with a rotation of tau. 266 267## [0.20.3] - 2022-03-28 268 269### Added 270 271* Added `to_array()` to `Quat` and `DQuat`. 272* Added `mul_add` method to all vector types - note that this will be slower 273 without hardware support enabled. 274* Added the `fast-math` flag which will sacrifice some float determinism for 275 speed. 276 277### Fixed 278 279* Fixed a bug in the `sse2` and `wasm32` implementations of 280 `Mat4::determinant()`. 281 282## [0.20.2] - 2021-12-20 283 284### Fixed 285 286* Fixed SPIR-V build which was broken due to a typo. 287 288## [0.20.1] - 2021-11-23 289 290### Added 291 292* Added the `from_rotation_arc_2d()` method to `Quat` and `DQuat` which will 293 return a rotation between two 2D vectors around the z axis. 294* Added impl of `Neg` operator for matrix types. 295* Added `cuda` feature which forces `glam` types to match cuda's alignment 296 requirements. 297 298### Changed 299 300* The `Quat` and `DQuat` methods `from_rotation_arc()` and 301 `from_rotation_arc_colinear()` are now available in `no_std`. 302* The `Vec3` and `DVec3` methods `any_orthogonal_vector()`, 303 `any_orthonormal_vector()` and `any_orthonormal_pair()` are now available in 304 `no_std`. 305* Added `repr(C)` attribute to affine types. 306 307### Removed 308 309* Removed deprecated `as_f32()`, `as_f64()`, `as_i32()` and `as_u32()` methods. 310 311## [0.20.0] - 2021-11-01 312 313### Breaking changes 314 315* Minimum Supported Version of Rust bumped to 1.52.1 for an update to the `mint` 316 crate. 317 318### Added 319 320* Added implementations for new `IntoMint` trait from the `mint` crate. 321* Added `mint` conversions for `Mat3A`. 322* Added `as_vec3a` cast methods to vector types. 323 324## [0.19.0] - 2021-10-05 325 326### Breaking changes 327 328* Removed truncating vector `From` implementations. Use `.truncate()` or swizzle 329 methods instead. 330 331### Added 332 333* Added `Not`, `Shl`, `Shr`, `BitAnd`, `BitOr` and `BitXor` implementations for 334 all `IVec` and `UVec` vector types. 335* Added `NAN` constant for all types. 336* Documented `glam`'s [architecture](ARCHITECTURE.md). 337 338### Changed 339 340* `Sum` and `Product` traits are now implemented in `no_std` builds. 341 342## [0.18.0] - 2021-08-26 343 344### Breaking changes 345 346* Minimum Supported Version of Rust bumped to 1.51.0 for `wasm-bindgen-test` 347 and `rustdoc` `alias` support. 348 349### Added 350 351* Added `wasm32` SIMD intrinsics support. 352* Added optional support for the `rkyv` serialization crate. 353* Added `Rem` and `RemAssign` implementations for all vector types. 354* Added quaternion `xyz()` method for returning the vector part of the 355 quaternion. 356* Added `From((Scalar, Vector3))` for 4D vector types. 357 358### Changed 359 360* Deprecated `as_f32()`, `as_f64()`, `as_i32()` and `as_u32()` methods in favor 361 of more specific methods such as `as_vec2()`, `as_dvec2()`, `as_ivec2()` and 362 `as_uvec2()` and so on. 363 364## [0.17.3] - 2021-07-18 365 366### Fixed 367 368* Fix alignment unit tests on non x86 platforms. 369 370## [0.17.2] - 2021-07-15 371 372### Fixed 373 374* Fix alignment unit tests on i686 and S390x. 375 376## [0.17.1] - 2021-06-29 377 378### Added 379 380* Added `serde` support for `Affine2`, `DAffine2`, `Affine3A` and `DAffine3`. 381 382## [0.17.0] - 2021-06-26 383 384### Breaking changes 385 386* The addition of `Add` and `Sub` implementations of scalar values for vector 387 types may create ambiguities with existing calls to `add` and `sub`. 388* Removed `From<Mat3>` implementation for `Mat2` and `From<DMat3>` for `DMat2`. 389 These have been replaced by `Mat2::from_mat3()` and `DMat2::from_mat3()`. 390* Removed `From<Mat4>` implementation for `Mat3` and `From<DMat4>` for `DMat3`. 391 These have been replaced by `Mat3::from_mat4()` and `DMat3::from_mat4()`. 392* Removed deprecated `from_slice_unaligned()`, `write_to_slice_unaligned()`, 393 `from_rotation_mat4` and `from_rotation_ypr()` methods. 394 395### Added 396 397* Added `col_mut()` method which returns a mutable reference to a matrix column 398 to all matrix types. 399* Added `AddAssign`, `MulAssign` and `SubAssign` implementations for all matrix 400 types. 401* Added `Add` and `Sub` implementations of scalar values for vector types. 402* Added more `glam_assert!` checks and documented methods where they are used. 403* Added vector projection and rejection methods `project_onto()`, 404 `project_onto_normalized()`, `reject_from()` and `reject_from_normalized()`. 405* Added `Mat2::from_mat3()`, `DMat2::from_mat3()`, `Mat3::from_mat4()`, 406 `DMat3::from_mat4()` which create a smaller matrix from a larger one, 407 discarding a final row and column of the input matrix. 408* Added `Mat3::from_mat2()`, `DMat3::from_mat2()`, `Mat4::from_mat3()` and 409 `DMat4::from_mat3()` which create an affine transform from a smaller linear 410 transform matrix. 411 412### Changed 413 414* Don't support `AsRef` and `AsMut` on SPIR-V targets. Also removed SPIR-V 415 support for some methods that used `as_ref()`, including `hash()`. Not a 416 breaking change as these methods would not have worked anyway. 417 418### Fixed 419 420* Fixed compile time alignment checks failing on i686 targets. 421 422## [0.16.0] - 2021-06-06 423 424### Breaking changes 425 426* `sprirv-std` dependency was removed, rust-gpu depends on glam internally 427 again for now. 428* Added `must_use` attribute to all `inverse()`, `normalize()`, 429 `try_normalize()`, `transpose()` and `conjugate()` methods. 430 431### Added 432 433* Added `fract()` method to float vector types which return a vector containing 434 `self - self.floor()`. 435* Added optional support for the `approx` crate. Note that all glam types 436 implement their own `abs_diff_eq()` method without requiring the `approx` 437 dependency. 438 439## [0.15.2] - 2021-05-20 440 441### Added 442 443* Added `from_cols()` methods to affine types. 444* Added methods for reading and writing affine types from and to arrays and 445 slices, including `from_cols_array()`, `to_cols_array()`, 446 `from_cols_array_2d()`, `to_cols_array_2d()`, `from_cols_slice()` and 447 `write_cols_to_slice()`. 448* Added `core::fmt::Display` trait implementations for affine types. 449* Added `core::ops::Add`, `core::ops::Mul` scalar and `core::ops::Sub` trait 450 implementations for affine types. 451* Added `from_array()` methods to quaternion types. 452 453### Changed 454 455* Renamed vector and quaternion `from_slice_unaligned()` and 456 `write_to_slice_unaligned()` methods to `from_slice()` and 457 `write_to_slice()`. 458* Removed usage of `_mm_rcp_ps` from SSE2 implementation of `Quat::slerp` as 459 this instruction is not deterministic between Intel and AMD chips. 460 461## [0.15.1] - 2021-05-14 462 463### Changed 464 465* Disable `const_assert_eq!` size and alignment checks for SPIR-V targets. 466 467## [0.15.0] - 2021-05-14 468 469### Breaking changes 470 471* Removed `PartialOrd` and `Ord` trait implementations for all `glam` types. 472* Removed deprecated `zero()`, `one()`, `unit_x()`, `unit_y()`, `unit_z()`, 473 `unit_w()`, `identity()` and `Mat2::scale()` methods. 474* Remove problematic `Quat` `From` trait conversions which would allow creating 475 a non-uniform quaternion without necessarily realizing, including from 476 `Vec4`, `(x, y, z, w)` and `[f32; 4]`. 477 478### Added 479 480* Added `EulerRot` enum for specifying Euler rotation order and 481 `Quat::from_euler()`, `Mat3::from_euler()` and `Mat4::from_euler()` which 482 support specifying a rotation order and angles of rotation. 483* Added `Quat::to_euler()` method for extracting Euler angles. 484* Added `Quat::from_vec4()` which is an explicit method for creating a 485 quaternion from a 4D vector. The method does not normalize the resulting 486 quaternion. 487* Added `Mat3A` type which uses `Vec3A` columns. It is 16 byte aligned and 488 contains internal padding but it generally faster than `Mat3` for most 489 operations if SIMD is available. 490* Added 3D affine transform types `Affine3A` and `DAffine3`. These are more 491 efficient than using `Mat4` and `DMat4` respectively when working with 3D 492 affine transforms. 493* Added 2D affine transform types `Affine2` and `DAffine2`. These are more 494 efficient than using `Mat3` and `DMat3` respectively when working with 2D 495 affine transforms. 496* Added `Quat::from_affine3()` to create a quaternion from an affine transform 497 rotation. 498* Added explicit `to_array()` method to vector types to better match the matrix 499 methods. 500 501### Changed 502 503* Deprecated `Quat::from_rotation_ypr()`, `Mat3::from_rotation_ypr()` and 504 `Mat4::from_rotation_ypr()` in favor of new `from_euler()` methods. 505* Deprecated `Quat::from_rotation_mat3()` and `Quat::from_rotation_mat4()` in 506 favor of new `from_mat3` and `from_mat4` methods. 507* Deprecated `TransformSRT` and `TransformRT` which are under the 508 `transform-types` feature. These will be moved to a separate experimental 509 crate. 510* Updated `spirv-std` dependency version to `0.4.0-alpha7`. 511 512## [0.14.0] - 2021-04-09 513 514### Breaking changes 515 516* Minimum Supported Version of Rust bumped to 1.45.0 for the `spirv-std` 517 dependency. 518 519### Added 520 521* Added `AXES[]` constants to all vector types. These are arrays containing the 522 unit vector for each axis. 523* Added quaternion `from_scaled_axis` and `to_scaled_axis` methods. 524 525### Changed 526 527* Updated dependency versions of `bytemuck` to `1.5`, `rand` to `0.8`, 528 `rand_xoshiro` to `0.6` and `spirv-std` to `0.4.0-alpha4`. 529 530## [0.13.1] - 2021-03-24 531 532### Added 533 534* Added vector `clamp()` functions. 535* Added matrix column and row accessor methods, `col()` and `row()`. 536* Added SPIR-V module and dependency on `spirv-std` for the SPIR-V target. 537* Added matrix truncation from 4x4 to 3x3 and 3x3 to 2x2 via `From` impls. 538 539### Changed 540 541* Documentation corrections and improvements. 542 543## [0.13.0] - 2021-03-04 544 545### Breaking Changes 546 547* The behavior of the 4x4 matrix method `transform_point3()` was changed to not 548 perform the perspective divide. This is an optimization for use with affine 549 transforms where perspective correction is not required. The 550 `project_point3()` method was added for transforming points by perspective 551 projections. 552* The 3x3 matrix `from_scale()` method was changed to 553 create a affine transform containing a 2-dimensional non-uniform scale to be 554 consistent with the 4x4 matrix version. The 555 `from_diagonal()` method can be used to create a 3x3 scale matrix. 556* The 3x3 matrix methods `transform_point2_as_vec3a`, 557 `transform_vector2_as_vec3a` and `mul_vec3_as_vec3a` were unintentionally 558 `pub` and are no longer publicly accessible. 559 560### Added 561 562* Added `Vec2::X`, `Vec4::W` etc constants as a shorter versions of `unit_x()` 563 and friends. 564* Added `ONE` constants for vectors. 565* Added `IDENTITY` constants for `Mat2`, `Mat3`, `Mat4` and `Quat`. 566* Added `ZERO` constant for vectors and matrices. 567* Added `clamp_length()`, `clamp_length_max()`, and `clamp_length_min` methods 568 for `f32` and `f64` vector types. 569* Added `try_normalize()` and `normalize_or_zero()` for all real vector types. 570* Added `from_diagonal()` methods to all matrix types for creating diagonal 571 matrices from a vector. 572* Added `angle_between()`, `from_rotation_arc()` and 573 `from_rotation_arc_colinear()` to quaternion types. 574* Added quaternion `inverse()` which assumes the quaternion is already 575 normalized and returns the conjugate. 576* Added `from_translation()` and `from_angle()` methods to 3x3 matrix types. 577* Added `project_point3()` method to 4x4 matrix types. This method is for 578 transforming 3D vectors by perspective projection transforms. 579* Added `Eq` and `Hash` impls for integer vector types. 580 581### Changed 582 583* Deprecated `::unit_x/y/z()`, `::zero()`, `::one()`, `::identity()` functions 584 in favor of constants. 585 586## [0.12.0] - 2021-01-15 587 588### Breaking Changes 589 590* `Vec2Mask`, `Vec3Mask` and `Vec4Mask` have been replaced by `BVec2`, `BVec3`, 591 `BVec3A`, `BVec4` and `BVec4A`. These types are used by some vector methods 592 and are not typically referenced directly. 593 594### Added 595 596* Added `f64` primitive type support 597 * vectors: `DVec2`, `DVec3` and `DVec4` 598 * square matrices: `DMat2`, `DMat3` and `DMat4` 599 * a quaternion type: `DQuat` 600* Added `i32` primitive type support 601 * vectors: `IVec2`, `IVec3` and `IVec4` 602* Added `u32` primitive type support 603 * vectors: `UVec2`, `UVec3` and `UVec4` 604* Added `bool` primitive type support 605 * vectors: `BVec2`, `BVec3` and `BVec4` 606 607### Removed 608 609* `build.rs` has been removed. 610 611## [0.11.3] - 2020-12-29 612 613### Changed 614 615* Made `Vec3` `repr(simd)` for `spirv` targets. 616 617### Added 618 619* Added `From<(Vec2, f32)>` for `Vec3` and `From<(Vec3, f32)` for `Vec4`. 620 621## [0.11.2] - 2020-12-04 622 623### Changed 624 625* Compilation fixes for Rust 1.36.0. 626 627## [0.11.1] - 2020-12-03 628 629### Added 630 631* Added support for the [Rust GPU](https://github.com/EmbarkStudios/rust-gpu) 632 SPIR-V target architecture. 633 634## [0.11.0] - 2020-11-26 635 636### Added 637 638* Added `is_finite` method to all types which returns `true` if, and only if, 639 all contained elements are finite. 640* Added `exp` and `powf` methods for all vector types. 641 642### Changed 643 644* The `is_nan` method now returns a `bool` to match the new `is_finite` method 645 and to be consistent with the same methods on the `f32` and `f64` primitive 646 types. 647* Renamed `is_nan` which returns a vector mask to `is_nan_mask`. 648* Don't use the `cfg` definitions added by `build.rs` for defining structs as 649 `rust-analyzer` is not aware of them. 650 651### Removed 652 653* Removed deprecated accessor methods. 654 655## [0.10.2] - 2020-11-17 656 657### Changed 658 659* Deprecated element accessor members `.x()`, `.x_mut()`, `.set_x()`, etc. on 660 vector and quaternion types. 661* Deprecated column accessor members `.x_axis()`, `.x_axis_mut()`, 662 `.set_x_axis()`, etc. on matrix types. 663 664## [0.10.1] - 2020-11-15 665 666### Added 667 668* Added the `Vec2::perp` method which returns a `Vec2` perpendicular to `self`. 669 670### Changed 671 672* `Vec2` and `Vec3` types were changed to use public named fields for `.x`, 673 `.y`, and `.z` instead of accessors. 674* `Quat`, `Vec3A` and `Vec4` implement `Deref` and `DerefMut` for the new `XYZ` 675 and `XYZW` structs to emulate public named field access. 676* `Mat3` and `Mat4` had their axis members made public instead of needing 677 accessors. 678* `Mat2` implements `Deref` and `DerefMut` for the new `XYAxes` struct to 679 emulate public named field access. 680 681### Removed 682 683* Removed deprecated `length_reciprocal` and `sign` methods. 684 685### Fixed 686 687* Adding `glam` as a `no_std` dependency should now work as expected. 688 689## [0.10.0] - 2020-10-31 690 691### Breaking Changes 692 693* Changed the return type of `Vec4::truncate` from `Vec3A` to `Vec3`. 694 695### Added 696 697* Added `From` implementations to truncate to narrower vector types, e.g. 698 `Vec4` to `Vec3A`, `Vec3` and `Vec2` and from `Vec3A` and `Vec3` to `Vec2`. 699* Added swizzles for `Vec4`, `Vec3A`, `Vec3` and `Vec2`. These can be used to 700 reorder elements in the same type and also to create larger or smaller 701 vectors from the given vectors elements. 702* Added `Quat` operators `Add<Quat>`, `Sub<Quat>`, `Mul<f32>` and `Div<f32`. 703 These are used by other crates for interpolation quaternions along splines. 704 Note that these operations will not return unit length quaternions, thus the 705 results must be normalized before performing other `Quat` operations. 706* Added `Mat4::transform_point3a` and `Mat4::transform_vector3a`. 707* Added `AsRef<[f32; 9]>` and `AsMut<[f32; 9]>` trait implementations to `Mat3`. 708* Added optional `bytemuck` support primarily for casting types to `&[u8]`. 709* Added support for compiling with `no_std` by disabling the default `std` 710 feature and adding the `libm` feature. 711* Added `distance` and `distance_squared` methods to `Vec2`, `Vec3`, `Vec3A` 712 and `Vec4`. 713 714## [0.9.5] - 2020-10-10 715 716### Added 717 718* `glam` uses SSE2 for some types which prevents constructor functions can not 719 be made `const fn`. To work around this limitation the following macro 720 functions have been added to support creating `const` values of `glam` types: 721 `const_mat2`, `const_mat3`, `const_mat4`, `const_quat`, `const_vec2`, 722 `const_vec3`, `const_vec3a` and `const_vec4`. 723* Added `is_nan` methods to `Vec2`, `Vec3`, `Vec3A` and `Vec4` which return a 724 mask. 725 726## Changed 727 728* Renamed the vector `reciprocal` and `length_reciprocal` methods to `recip` 729 and `length_recip` to match the Rust standard library naming. The old methods 730 have been deprecated. 731* Renamed the vector `sign` methods to `signum` match the Rust standard library 732 naming. The new methods now check for `NAN`. The old methods have been 733 deprecated. 734* Added SSE2 optimized implementations of `Mat4::determinant` and 735 `Mat4::inverse`. 736 737### Removed 738 739* Removed deprecated function `Mat4::perspective_glu_rh`. 740 741## [0.9.4] - 2020-08-31 742 743### Fixed 744 745* Fixed `Mat4::transform_point3` to account for homogeneous w coordinate. 746 Previously this would have been incorrect when the resulting homogeneous 747 coordinate was not 1.0, e.g. when transforming by a perspective projection. 748* Fixed `Mat3::transform_point2` to account for homogeneous z coordinate. 749 750## [0.9.3] - 2020-08-11 751 752### Added 753 754* Added `Mat4::perspective_rh`. 755 756## [0.9.2] - 2020-07-09 757 758### Added 759 760* Added `Mat3::mul_vec3a` and `Quat::mul_vec3a`. 761 762### Changed 763 764* Changed `Quat::mul_vec3` to accept and return `Vec3` instead of `Vec3A`. 765 766## [0.9.1] - 2020-07-01 767 768### Added 769 770* Added `Mat3 * Vec3A` implementation. 771* Added `Vec3A` benches. 772 773### Changed 774 775* Some documentation improvements around the new `Vec3A` type. 776 777## [0.9.0] - 2020-06-28 778 779### Added 780 781* `Vec3` has been split into scalar `Vec3` and 16 byte aligned `Vec3A` types. 782 Only the `Vec3A` type currently uses SIMD optimizations. 783* `Vec3Mask` has been split into scalar `Vec3Mask` and 16 byte aligned 784 `Vec3AMask` types. 785* Added `mut` column accessors to all matrix types, e.g. `Mat2::x_axis_mut()`. 786* Added `From` trait implementations for `Vec3AMask` and `Vec4Mask` to `__m128`. 787 788### Changed 789 790* The `Mat3` type is using the scalar `Vec3` type for storage. 791* Simplified `Debug` trait output for `Quat`, `Vec4` and `Vec3A`. 792 793## Removed 794 795* Removed the `packed-vec3` feature flag as it is now redundant. 796 797## [0.8.7] - 2020-04-28 798 799### Added 800 801* Added `Quat::slerp` - note that this uses a `sin` approximation. 802* Added `angle_between` method for `Vec2` and `Vec3`. 803* Implemented `Debug`, `Display`, `PartialEq`, `Eq`, `PartialOrd`, `Ord`, 804 `Hash`, and `AsRef` traits for `Vec2Mask`, `Vec3Mask` and `Vec4Mask`. 805* Added conversion functions from `Vec2Mask`, `Vec3Mask` and `Vec4Mask` to an 806 array of `[u32]`. 807* Added `build.rs` to simplify conditional feature compilation. 808 809### Changed 810 811* Increased test coverage. 812 813### Removed 814 815* Removed `cfg-if` dependency. 816 817## [0.8.6] - 2020-02-18 818 819### Added 820 821* Added the `packed-vec3` feature flag to disable using SIMD types for `Vec3` 822 and `Mat3` types. This avoids wasting some space due to 16 byte alignment at 823 the cost of some performance. 824* Added `x_mut`, `y_mut`, `z_mut`, `w_mut` where appropriate to `Vec2`, `Vec3` 825 and `Vec4`. 826* Added implementation of `core::ops::Index` and `core::ops::IndexMut` for 827 `Vec2`, `Vec3` and `Vec4`. 828 829### Changed 830 831* Merged SSE2 and scalar `Vec3` and `Vec4` implementations into single files 832 using the `cfg-if` crate. 833 834## [0.8.5] - 2020-01-02 835 836### Added 837 838* Added projection functions `Mat4::perspective_lh`, 839 `Mat4::perspective_infinite_lh`, `Mat4::perspective_infinite_reverse_lh`, 840 `Mat4::orthgraphic_lh` and `Mat4::orthographic_rh`. 841* Added `round`, `ceil` and `floor` methods to `Vec2`, `Vec3` and `Vec4`. 842 843## [0.8.4] - 2019-12-17 844 845### Added 846 847* Added `Mat4::to_scale_rotation_translation` for extracting scale, rotation and 848 translation from a 4x4 homogeneous transformation matrix. 849* Added `cargo-deny` GitHub Action. 850 851### Changed 852 853* Renamed `Quat::new` to `Quat::from_xyzw`. 854 855## [0.8.3] - 2019-11-27 856 857### Added 858 859* Added `Mat4::orthographic_rh_gl`. 860 861### Changed 862 863* Renamed `Mat4::perspective_glu_rh` to `Mat4::perspective_rh_gl`. 864* SSE2 optimizations for `Mat2::determinant`, `Mat2::inverse`, 865 `Mat2::transpose`, `Mat3::transpose`, `Quat::conjugate`, `Quat::lerp`, 866 `Quat::mul_vec3`, `Quat::mul_quat` and `Quat::from_rotation_ypr`. 867* Disabled optimizations to `Mat4::transform_point3` and 868 `Mat4::transform_vector3` as they are probably incorrect and need 869 investigating. 870* Added missing `#[repr(C)]` to `Mat2`, `Mat3` and `Mat4`. 871* Benchmarks now store output of functions to better estimate the cost of a 872 function call. 873 874### Removed 875 876* Removed deprecated functions `Mat2::new`, `Mat3::new` and `Mat4::new`. 877 878## [0.8.2] - 2019-11-06 879 880### Changed 881 882* `glam_assert!` is no longer enabled by default in debug builds, it can be 883 enabled in any configuration using the `glam-assert` feature or in debug 884 builds only using the `debug-glam-assert` feature. 885 886### Removed 887 888* `glam_assert!`'s checking `lerp` is bounded between 0.0 and 1.0 and that 889 matrix scales are non-zero have been removed. 890 891## [0.8.1] - 2019-11-03 892 893### Added 894 895* Added `Display` trait implementations for `Mat2`, `Mat3` and `Mat4`. 896 897### Changed 898 899* Disabled `glam`'s SSE2 `sin_cos` implementation - it became less precise for 900 large angle values. 901* Reduced the default epsilon used by the `is_normalized!` macro from 902 `std::f32::EPSILON` to `1e-6`. 903 904## [0.8.0] - 2019-10-14 905 906### Removed 907 908* Removed the `approx` crate dependency. Each `glam` type has an `abs_diff_eq` 909 method added which is used by unit tests for approximate floating point 910 comparisons. 911* Removed the `Angle` type. All angles are now `f32` and are expected to 912 be in radians. 913* Removed the deprecated `Vec2b`, `Vec3b` and `Vec4b` types and the `mask` 914 methods on `Vec2Mask`, `Vec3Mask` and `Vec4Mask`. 915 916### Changed 917 918* The `rand` crate dependency has been removed from default features. This was 919 required for benchmarking but a simple random number generator has been added 920 to the benches `support` module instead. 921* The `From` trait implementation converting between 1D and 2D `f32` arrays and 922 matrix types have been removed. It was ambiguous how array data would map to 923 matrix columns so these have been replaced with explicit methods 924 `from_cols_array` and `from_cols_array_2d`. 925* Matrix `new` methods have been renamed to `from_cols` to be consistent with 926 the other methods that create matrices from data. 927* Renamed `Mat4::perspective_glu` to `Mat4::perspective_glu_rh`. 928 929## [0.7.2] - 2019-09-22 930 931### Fixed 932 933* Fixed incorrect projection matrix methods `Mat4::look_at_lh` 934 and `Mat4::look_at_rh`. 935 936### Added 937 938* Added support for building infinite projection matrices, including both 939 standard and reverse depth `Mat4::perspective_infinite_rh` and 940 `Mat4::perspective_infinite_rh`. 941* Added `Vec2Mask::new`, `Vec3Mask::new` and `Vec4Mask::new` methods. 942* Implemented `std::ops` `BitAnd`, `BitAndAssign`, `BitOr`, `BitOrAssign` 943 and `Not` traits for `Vec2Mask`, `Vec3Mask` and `Vec4Mask`. 944* Added method documentation for `Vec4` and `Vec4Mask` types. 945* Added missing `serde` implementations for `Mat2`, `Mat3` and `Mat4`. 946* Updated `rand` and `criterion` versions. 947 948## [0.7.1] - 2019-07-08 949 950### Fixed 951 952* The SSE2 implementation of `Vec4` `dot` was missing a shuffle, meaning the 953 `dot`, `length`, `length_squared`, `length_reciprocal` and `normalize` 954 methods were sometimes incorrect. 955 956### Added 957 958* Added the `glam_assert` macro which behaves like Rust's `debug_assert` but 959 can be enabled separately to `debug_assert`. This is used to perform 960 asserts on correctness. 961* Added `is_normalized` method to `Vec2`, `Vec3` and `Vec4`. 962 963### Changed 964 965* Replaced usage of `std::mem::uninitialized` with `std::mem::MaybeUninit`. This 966 change requires stable Rust 1.36. 967* Renamed `Vec2b` to `Vec2Mask`, `Vec3b` to `Vec3Mask` and `Vec4b` to 968 `Vec4Mask`. Old names are aliased to the new name and deprecated. 969* Deprecate `VecNMask` `mask` method, use new `bitmask` method instead 970* Made fallback version of `VecNMask` types the same size and alignment as the 971 SIMD versions. 972* Added `Default` support to `VecNMask` types, will add more common traits in 973 the future. 974* Added `#[inline]` to `mat2`, `mat3` and `mat4` functions. 975 976## [0.7.0] - 2019-06-28 977 978### Added 979 980* Added `Mat2` into `[f32; 4]`, `Mat3` into `[f32; 9]` and `Mat4` into 981 `[f32; 16]`. 982 983### Removed 984 985* Removed `impl Mul<&Vec2> for Mat2` and `impl Mul<&Vec3> for Vec3` as these 986 don't exist for any other types. 987 988## [0.6.1] - 2019-06-22 989 990### Changed 991 992* `Mat2` now uses a `Vec4` internally which gives it some performance 993 improvements when SSE2 is available. 994 995## 0.6.0 - 2019-06-13 996 997### Changed 998 999* Switched from row vectors to column vectors 1000* Vectors are now on the right of multiplications with matrices and quaternions. 1001 1002[Keep a Changelog]: https://keepachangelog.com/ 1003[Semantic Versioning]: https://semver.org/spec/v2.0.0.html 1004[Unreleased]: https://github.com/bitshifter/glam-rs/compare/0.25.0...HEAD 1005[0.25.0]: https://github.com/bitshifter/glam-rs/compare/0.24.2...0.25.0 1006[0.24.2]: https://github.com/bitshifter/glam-rs/compare/0.24.1...0.24.2 1007[0.24.1]: https://github.com/bitshifter/glam-rs/compare/0.24.0...0.24.1 1008[0.24.0]: https://github.com/bitshifter/glam-rs/compare/0.23.0...0.24.0 1009[0.23.0]: https://github.com/bitshifter/glam-rs/compare/0.22.0...0.23.0 1010[0.22.0]: https://github.com/bitshifter/glam-rs/compare/0.21.3...0.22.0 1011[0.21.3]: https://github.com/bitshifter/glam-rs/compare/0.21.2...0.21.3 1012[0.21.2]: https://github.com/bitshifter/glam-rs/compare/0.21.1...0.21.2 1013[0.21.1]: https://github.com/bitshifter/glam-rs/compare/0.21.0...0.21.1 1014[0.21.0]: https://github.com/bitshifter/glam-rs/compare/0.20.5...0.21.0 1015[0.20.5]: https://github.com/bitshifter/glam-rs/compare/0.20.4...0.20.5 1016[0.20.4]: https://github.com/bitshifter/glam-rs/compare/0.20.3...0.20.4 1017[0.20.3]: https://github.com/bitshifter/glam-rs/compare/0.20.2...0.20.3 1018[0.20.2]: https://github.com/bitshifter/glam-rs/compare/0.20.1...0.20.2 1019[0.20.1]: https://github.com/bitshifter/glam-rs/compare/0.20.0...0.20.1 1020[0.20.0]: https://github.com/bitshifter/glam-rs/compare/0.19.0...0.20.0 1021[0.19.0]: https://github.com/bitshifter/glam-rs/compare/0.18.0...0.19.0 1022[0.18.0]: https://github.com/bitshifter/glam-rs/compare/0.17.3...0.18.0 1023[0.17.3]: https://github.com/bitshifter/glam-rs/compare/0.17.2...0.17.3 1024[0.17.2]: https://github.com/bitshifter/glam-rs/compare/0.17.1...0.17.2 1025[0.17.1]: https://github.com/bitshifter/glam-rs/compare/0.17.0...0.17.1 1026[0.17.0]: https://github.com/bitshifter/glam-rs/compare/0.16.0...0.17.0 1027[0.16.0]: https://github.com/bitshifter/glam-rs/compare/0.15.2...0.16.0 1028[0.15.2]: https://github.com/bitshifter/glam-rs/compare/0.15.1...0.15.2 1029[0.15.1]: https://github.com/bitshifter/glam-rs/compare/0.15.0...0.15.1 1030[0.15.0]: https://github.com/bitshifter/glam-rs/compare/0.14.0...0.15.0 1031[0.14.0]: https://github.com/bitshifter/glam-rs/compare/0.13.1...0.14.0 1032[0.13.1]: https://github.com/bitshifter/glam-rs/compare/0.13.0...0.13.1 1033[0.13.0]: https://github.com/bitshifter/glam-rs/compare/0.12.0...0.13.0 1034[0.12.0]: https://github.com/bitshifter/glam-rs/compare/0.11.3...0.12.0 1035[0.11.3]: https://github.com/bitshifter/glam-rs/compare/0.11.2...0.11.3 1036[0.11.2]: https://github.com/bitshifter/glam-rs/compare/0.11.1...0.11.2 1037[0.11.1]: https://github.com/bitshifter/glam-rs/compare/0.11.0...0.11.1 1038[0.11.0]: https://github.com/bitshifter/glam-rs/compare/0.10.2...0.11.0 1039[0.10.2]: https://github.com/bitshifter/glam-rs/compare/0.10.1...0.10.2 1040[0.10.1]: https://github.com/bitshifter/glam-rs/compare/0.10.0...0.10.1 1041[0.10.0]: https://github.com/bitshifter/glam-rs/compare/0.9.5...0.10.0 1042[0.9.5]: https://github.com/bitshifter/glam-rs/compare/0.9.4...0.9.5 1043[0.9.4]: https://github.com/bitshifter/glam-rs/compare/0.9.3...0.9.4 1044[0.9.3]: https://github.com/bitshifter/glam-rs/compare/0.9.2...0.9.3 1045[0.9.2]: https://github.com/bitshifter/glam-rs/compare/0.9.1...0.9.2 1046[0.9.1]: https://github.com/bitshifter/glam-rs/compare/0.9.0...0.9.1 1047[0.9.0]: https://github.com/bitshifter/glam-rs/compare/0.8.7...0.9.0 1048[0.8.7]: https://github.com/bitshifter/glam-rs/compare/0.8.6...0.8.7 1049[0.8.6]: https://github.com/bitshifter/glam-rs/compare/0.8.5...0.8.6 1050[0.8.5]: https://github.com/bitshifter/glam-rs/compare/0.8.4...0.8.5 1051[0.8.4]: https://github.com/bitshifter/glam-rs/compare/0.8.3...0.8.4 1052[0.8.3]: https://github.com/bitshifter/glam-rs/compare/0.8.2...0.8.3 1053[0.8.2]: https://github.com/bitshifter/glam-rs/compare/0.8.1...0.8.2 1054[0.8.1]: https://github.com/bitshifter/glam-rs/compare/0.8.0...0.8.1 1055[0.8.0]: https://github.com/bitshifter/glam-rs/compare/0.7.2...0.8.0 1056[0.7.2]: https://github.com/bitshifter/glam-rs/compare/0.7.1...0.7.2 1057[0.7.1]: https://github.com/bitshifter/glam-rs/compare/0.7.0...0.7.1 1058[0.7.0]: https://github.com/bitshifter/glam-rs/compare/0.6.1...0.7.0 1059[0.6.1]: https://github.com/bitshifter/glam-rs/compare/0.6.0...0.6.1 1060