Skip to content

N15: glam updates #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 4, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions content/posts/newsletter-015/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,50 @@ 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]`.

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

<!-- Up to 10 links to interesting issues -->
Expand Down