From 7509014ed6aa80547141fc35f27249cd7dab81fe Mon Sep 17 00:00:00 2001 From: Cameron Hart Date: Tue, 3 Nov 2020 21:47:24 +1300 Subject: [PATCH 1/4] Added some details on recent glam changes. --- content/posts/newsletter-015/index.md | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/content/posts/newsletter-015/index.md b/content/posts/newsletter-015/index.md index 26959718c..e85b285b2 100644 --- a/content/posts/newsletter-015/index.md +++ b/content/posts/newsletter-015/index.md @@ -91,6 +91,56 @@ For main feature reports and dev blogs follow [@pGLOWrpg] on Twitter. ## Library & Tooling Updates +### [glam] + +[glam] 0.10.0 was released. There were a lot of additions in this update and a +small breaking change. + +The return type of `Vec4::truncate()` was changed from `Vec3A` to `Vec3` which +is a breaking change and thus the version jumped from 0.9 to 0.10. + +Vector swizzle functions similar to those found in [GLSL] were added. Swizzle +functions allow a vectors elements to be reordered. The result can be a vector +of a different size to the input. Swizzles are implemented with SIMD +instructions where possible, e.g. for the `Vec4` type. + +```rust +use glam::*; + +let v = Vec4::new(1.0, 2.0, 3.0, 4.0); + +// Reverse elements of `v`, if SIMD is supported this will use a vector shuffle. +let wzyx = v.wzyx(); +assert_eq!(Vec4::new(4.0, 3.0, 2.0, 1.0), wzyx); + +// Swizzle the yzw elements of `v` into a `Vec3` +let yzw = v.yzw(); +assert_eq!(Vec3::new(2.0, 3.0, 4.0), yzw); + +// You can swizzle from a `Vec4` to a `Vec2` +let xy = v.xy(); +assert_eq!(Vec2::new(1.0, 2.0), xy); + +// And back again +let yyxx = xy.yyxx(); +assert_eq!(Vec4::new(2.0, 2.0, 1.0, 1.0), yyxx); +``` + +[no_std] support was added, using [libm] for math functions that are not +implemented in `core`. + +Optional support for the [bytemuck] crate was added, this allows appropriate +glam types to be cast into `&[u8]`. + +For a full list of changes see the [glam changelog]. + +[glam]: https://github.com/bitshifter/glam-rs +[GLSL]: https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)#Swizzling +[no_std]: https://rust-embedded.github.io/book/intro/no-std.html +[libm]: https://github.com/rust-lang/libm +[bytemuck]: https://docs.rs/bytemuck +[glam changelog]: https://github.com/bitshifter/glam-rs/blob/master/CHANGELOG.md + ## Popular Workgroup Issues in Github From 397e0252b4247d9a1019cabe5ed4b2e38f79cb3c Mon Sep 17 00:00:00 2001 From: Cameron Hart Date: Tue, 3 Nov 2020 21:50:54 +1300 Subject: [PATCH 2/4] Reduced code sample --- content/posts/newsletter-015/index.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/content/posts/newsletter-015/index.md b/content/posts/newsletter-015/index.md index e85b285b2..7fe28e671 100644 --- a/content/posts/newsletter-015/index.md +++ b/content/posts/newsletter-015/index.md @@ -105,25 +105,19 @@ of a different size to the input. Swizzles are implemented with SIMD instructions where possible, e.g. for the `Vec4` type. ```rust -use glam::*; - -let v = Vec4::new(1.0, 2.0, 3.0, 4.0); +let v = vec4(1.0, 2.0, 3.0, 4.0); // Reverse elements of `v`, if SIMD is supported this will use a vector shuffle. let wzyx = v.wzyx(); -assert_eq!(Vec4::new(4.0, 3.0, 2.0, 1.0), wzyx); // Swizzle the yzw elements of `v` into a `Vec3` let yzw = v.yzw(); -assert_eq!(Vec3::new(2.0, 3.0, 4.0), yzw); // You can swizzle from a `Vec4` to a `Vec2` let xy = v.xy(); -assert_eq!(Vec2::new(1.0, 2.0), xy); // And back again let yyxx = xy.yyxx(); -assert_eq!(Vec4::new(2.0, 2.0, 1.0, 1.0), yyxx); ``` [no_std] support was added, using [libm] for math functions that are not From 16db04a5ad874004b7bb81b59915700638ac2ef9 Mon Sep 17 00:00:00 2001 From: Andrey Lesnikov Date: Wed, 4 Nov 2020 10:14:48 +0300 Subject: [PATCH 3/4] N15: glam: Style&fmt tweaks --- content/posts/newsletter-015/index.md | 63 ++++++++++++--------------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/content/posts/newsletter-015/index.md b/content/posts/newsletter-015/index.md index 7fe28e671..03a55eb49 100644 --- a/content/posts/newsletter-015/index.md +++ b/content/posts/newsletter-015/index.md @@ -91,40 +91,35 @@ For main feature reports and dev blogs follow [@pGLOWrpg] on Twitter. ## Library & Tooling Updates -### [glam] - -[glam] 0.10.0 was released. There were a lot of additions in this update and a -small breaking change. - -The return type of `Vec4::truncate()` was changed from `Vec3A` to `Vec3` which -is a breaking change and thus the version jumped from 0.9 to 0.10. - -Vector swizzle functions similar to those found in [GLSL] were added. Swizzle -functions allow a vectors elements to be reordered. The result can be a vector -of a different size to the input. Swizzles are implemented with SIMD -instructions where possible, e.g. for the `Vec4` type. - -```rust -let v = vec4(1.0, 2.0, 3.0, 4.0); - -// Reverse elements of `v`, if SIMD is supported this will use a vector shuffle. -let wzyx = v.wzyx(); - -// Swizzle the yzw elements of `v` into a `Vec3` -let yzw = v.yzw(); - -// You can swizzle from a `Vec4` to a `Vec2` -let xy = v.xy(); - -// And back again -let yyxx = xy.yyxx(); -``` - -[no_std] support was added, using [libm] for math functions that are not -implemented in `core`. - -Optional support for the [bytemuck] crate was added, this allows appropriate -glam types to be cast into `&[u8]`. +### [glam] v0.10.0 + +[glam] is a simple and fast linear algebra crate for games and graphics. + +This month v0.10.0 was released. +There were a lot of additions in this update and a small breaking change. + +- The return type of `Vec4::truncate()` was changed from `Vec3A` to `Vec3` which + is a breaking change and thus the version jumped from 0.9 to 0.10. +- Vector swizzle functions similar to those found in [GLSL] were added. Swizzle + functions allow a vectors elements to be reordered. The result can be a vector + of a different size to the input. Swizzles are implemented with SIMD + instructions where possible, e.g. for the `Vec4` type. + + ```rust + let v = vec4(1.0, 2.0, 3.0, 4.0); + + // Reverse elements of `v`. + // If SIMD is supported this will use a vector shuffle. + let wzyx = v.wzyx(); + + let yzw = v.yzw(); // Swizzle the yzw elements of `v` into a `Vec3` + let xy = v.xy(); // You can swizzle from a `Vec4` to a `Vec2` + let yyxx = xy.yyxx(); // And back again + ``` +- [no_std] support was added, using [libm] for math functions that are not + implemented in `core`. +- Optional support for the [bytemuck] crate was added, this allows appropriate + glam types to be cast into `&[u8]`. For a full list of changes see the [glam changelog]. From 324dba77b400074193d820533b52adc147ef2157 Mon Sep 17 00:00:00 2001 From: Andrey Lesnikov Date: Wed, 4 Nov 2020 10:15:17 +0300 Subject: [PATCH 4/4] N15: glam: fmt fix --- content/posts/newsletter-015/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/posts/newsletter-015/index.md b/content/posts/newsletter-015/index.md index 03a55eb49..97c853036 100644 --- a/content/posts/newsletter-015/index.md +++ b/content/posts/newsletter-015/index.md @@ -116,6 +116,7 @@ There were a lot of additions in this update and a small breaking change. let xy = v.xy(); // You can swizzle from a `Vec4` to a `Vec2` let yyxx = xy.yyxx(); // And back again ``` + - [no_std] support was added, using [libm] for math functions that are not implemented in `core`. - Optional support for the [bytemuck] crate was added, this allows appropriate