Skip to content

Commit 2a642af

Browse files
bitshifterCameron Hartozkriff
authored
N15: glam updates (#332)
* Added some details on recent glam changes. * Reduced code sample * N15: glam: Style&fmt tweaks * N15: glam: fmt fix Co-authored-by: Cameron Hart <[email protected]> Co-authored-by: Andrey Lesnikov <[email protected]>
1 parent 8e9ed1a commit 2a642af

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

content/posts/newsletter-015/index.md

+40
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,46 @@ or follow [@sajattack] on Twitter.
361361
[Discord]: https://discord.gg/tvGzD4GqvF
362362
[@sajattack]: https://twitter.com/sajattack
363363

364+
### [glam] v0.10.0
365+
366+
[glam] is a simple and fast linear algebra crate for games and graphics.
367+
368+
This month v0.10.0 was released.
369+
There were a lot of additions in this update and a small breaking change.
370+
371+
- The return type of `Vec4::truncate()` was changed from `Vec3A` to `Vec3` which
372+
is a breaking change and thus the version jumped from 0.9 to 0.10.
373+
- Vector swizzle functions similar to those found in [GLSL] were added. Swizzle
374+
functions allow a vectors elements to be reordered. The result can be a vector
375+
of a different size to the input. Swizzles are implemented with SIMD
376+
instructions where possible, e.g. for the `Vec4` type.
377+
378+
```rust
379+
let v = vec4(1.0, 2.0, 3.0, 4.0);
380+
381+
// Reverse elements of `v`.
382+
// If SIMD is supported this will use a vector shuffle.
383+
let wzyx = v.wzyx();
384+
385+
let yzw = v.yzw(); // Swizzle the yzw elements of `v` into a `Vec3`
386+
let xy = v.xy(); // You can swizzle from a `Vec4` to a `Vec2`
387+
let yyxx = xy.yyxx(); // And back again
388+
```
389+
390+
- [no_std] support was added, using [libm] for math functions that are not
391+
implemented in `core`.
392+
- Optional support for the [bytemuck] crate was added, this allows appropriate
393+
glam types to be cast into `&[u8]`.
394+
395+
For a full list of changes see the [glam changelog].
396+
397+
[glam]: https://github.com/bitshifter/glam-rs
398+
[GLSL]: https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)#Swizzling
399+
[no_std]: https://rust-embedded.github.io/book/intro/no-std.html
400+
[libm]: https://github.com/rust-lang/libm
401+
[bytemuck]: https://docs.rs/bytemuck
402+
[glam changelog]: https://github.com/bitshifter/glam-rs/blob/master/CHANGELOG.md
403+
364404
### [This Month in Mun][mun-october]
365405

366406
[![Mun logo](mun-logo.png)][Mun]

0 commit comments

Comments
 (0)