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 0 | 0 | 0 |
| 0.8.5 | 0 | 0 | 0 | 0 | 0 |
| 0.8.4 | 0 | 0 | 0 | 0 | 0 |
| 0.8.3 | 0 | 0 | 0 | 0 | 0 |
| 0.8.2 | 0 | 0 | 0 | 0 | 0 |
| 0.8.1 | 0 | 0 | 0 | 0 | 0 |
| 0.8.0 | 0 | 0 | 0 | 0 | 0 |
| 0.7.2 | 0 | 0 | 0 | 0 | 0 |
| 0.7.1 | 0 | 0 | 0 | 0 | 0 |
| 0.7.0 | 0 | 0 | 0 | 0 | 0 |
| 0.6.1 | 0 | 0 | 0 | 0 | 0 |
| 0.6.0 | 0 | 0 | 0 | 0 | 0 |
| 0.5.2 | 0 | 0 | 0 | 0 | 0 |
| 0.5.1 | 0 | 0 | 0 | 0 | 0 |
| 0.5.0 | 0 | 0 | 0 | 0 | 0 |
| 0.4.2 | 0 | 0 | 0 | 0 | 0 |
| 0.4.1 | 0 | 0 | 0 | 0 | 0 |
| 0.4.0 | 0 | 0 | 0 | 0 | 0 |
0.32.1 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
Apache-2.0 - Apache License 2.0A simple and fast 3D math library for games and graphics.
f32 types
Vec2, Vec3, Vec3A and Vec4
Mat2, Mat3, Mat3A and Mat4
Quat
Affine2, Affine3 and Affine3A
f64 types
DVec2, DVec3 and DVec4
DMat2, DMat3 and DMat4
DQuat
DAffine2 and DAffine3
i8 types
I8Vec2, I8Vec3 and I8Vec4
u8 types
U8Vec2, U8Vec3 and U8Vec4
i16 types
I16Vec2, I16Vec3 and I16Vec4
u16 types
U16Vec2, U16Vec3 and U16Vec4
i32 types
IVec2, IVec3 and IVec4
u32 types
UVec2, UVec3 and UVec4
i64 types
I64Vec2, I64Vec3 and I64Vec4
u64 types
U64Vec2, U64Vec3 and U64Vec4
isize types
ISizeVec2, ISizeVec3 and ISizeVec4
usize types
USizeVec2, USizeVec3 and USizeVec4
bool types
BVec2, BVec3 and BVec4
The Vec3A, Vec4, Quat, Mat2, Mat3A, Mat4, Affine2 and Affine3A
types use 128-bit wide SIMD vector types for storage on x86, x86_64 and
wasm32/wasm64 architectures. As a result, these types are all 16 byte aligned and
depending on the size of the type or the type's members, they may contain
internal padding. This results in some wasted space in the cases of Vec3A,
Mat3A, Affine2 and Affine3A. However, the use of SIMD generally results
in better performance than scalar math.
glam outperforms similar Rust libraries for common operations as tested by the
mathbench project.
SIMD is supported on x86, x86_64, wasm32 and wasm64 targets.
SSE2 is enabled by default on x86_64 targets.SSE2 on x86 targets add -C target-feature=+sse2 to
RUSTCFLAGS.NEON is enabled by default on aarch64 targets.NEON on aarch64 targets add -C target-feature=+neon to
RUSTFLAGS.simd128 on wasm32 or wasm64 targets add -C target-feature=+simd128 to
RUSTFLAGS.core-simd
feature. This requires the nightly compiler as it is still unstable in Rust.Note that SIMD on wasm32/wasm64 passes tests but has not been benchmarked,
performance may or may not be better than scalar math.
no_std support can be enabled by compiling with --no-default-features to
disable std support and --features libm for math functions that are only
defined in std. For example:
[dependencies]
glam = { version = "0.32.1", default-features = false, features = ["libm"] }To support both std and no_std builds in project, you can use the following
in your Cargo.toml:
[features]
default = ["std"]
std = ["glam/std"]
libm = ["glam/libm"]
[dependencies]
glam = { version = "0.32.1", default-features = false }Alternatively, you can use the nostd-libm feature. This will always include a
libm dependency, but allows the user to still override it with std if they
prefer. This will allow your crate to compile with default features disabled,
instead of forcing the user to enable either std or libm.
[features]
default = ["std"]
std = ["glam/std"]
libm = ["glam/libm"]
[dependencies]
glam = { version = "0.32.1", default-features = false, features = ["nostd-libm"] }approx - traits and macros for approximate float comparisonsarbitrary - arbitrary trait implementations for glam types.bytemuck - for casting into slices of bytesencase - encase trait implementations for glam types.libm - uses libm math functions instead of std
mint - for interoperating with other 3D math librariesrand - implementations of Distribution trait for all glam types.rkyv - implementations of Archive, Serialize and Deserialize for all
glam types. Note that serialization is not interoperable with and without
the scalar-math feature. It should work between all other builds of glam.
Endian conversion is currently not supportedbytecheck - to perform archive validation when using the rkyv featureserde - implementations of Serialize and Deserialize for all glam
types. Note that serialization should work between builds of glam with and
without SIMD enabledspeedy - implementations of speedy's Readable and Writable for all
glam types.zerocopy - implementations of zerocopy traits for safe transmutes.std - the default feature, has no dependencies.nostd-libm - uses libm math functions if std is not availablescalar-math - compiles with SIMD support disableddebug-glam-assert - adds assertions in debug builds which check the validity
of parameters passed to glam to help catch runtime errorsglam-assert - adds validation assertions to all buildscuda - forces glam types to match expected cuda alignment
fast-math - By default, glam attempts to provide bit-for-bit identical
results on all platforms. Using this feature will enable platform specific
optimizations that may not be identical to other platforms. Intermediate
libraries should not use this feature and defer the decision to the final
binary build.core-simd - enables SIMD support via the portable simd module. This is an
unstable feature which requires a nightly Rust toolchain and std support.The minimum supported version of Rust for glam is 1.68.2.
glam interprets vectors as column matrices (also known as "column vectors")
meaning when transforming a vector with a matrix the matrix goes on the left,
e.g. v' = Mv. DirectX uses row vectors, OpenGL uses column vectors. There
are pros and cons to both.
Matrices are stored in column major format. Each column vector is stored in contiguous memory.
glam is co-ordinate system agnostic and intends to support both right-handed
and left-handed conventions.
The design of this library is guided by a desire for simplicity and good performance.
mint, rand and serde)See ARCHITECTURE.md for details on glam's internals.
There were many inspirations for the interface and internals of glam from the Rust and C++ worlds. In particular:
Vec3A
implementationglam is a play on the name of the popular C++ library GLM
Licensed under either of
at your option.
Contributions in any form (issues, pull requests, etc.) to this project must adhere to Rust's Code of Conduct.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
If you are interested in contributing or have a request or suggestion start a discussion on GitHub. See CONTRIBUTING.md for more information for contributors.
Most code in glam is generated, see the codegen README for details.
Thank you to all of the glam contributors!
The Game Development in Rust Discord and Bevy Engine Discord servers are
not official support channels but can be good places to ask for help with
glam.
glam contains code ported from the following C++ libraries:
See ATTRIBUTION.md for details.