All Projects → bitshifter → Glam Rs

bitshifter / Glam Rs

Licence: other
A simple and fast linear algebra library for games and graphics

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to Glam Rs

Questdb
An open source SQL database designed to process time series data, faster
Stars: ✭ 7,544 (+1758.13%)
Mutual labels:  simd
Fastbase64
SIMD-accelerated base64 codecs
Stars: ✭ 309 (-23.89%)
Mutual labels:  simd
Visionaray
A C++-based, cross platform ray tracing library
Stars: ✭ 342 (-15.76%)
Mutual labels:  simd
Graphene
A thin layer of graphic data types
Stars: ✭ 268 (-33.99%)
Mutual labels:  simd
Simdcompressionandintersection
A C++ library to compress and intersect sorted lists of integers using SIMD instructions
Stars: ✭ 289 (-28.82%)
Mutual labels:  simd
Datafuse
Datafuse is a free Cloud-Native Analytics DBMS(Inspired by ClickHouse) implemented in Rust
Stars: ✭ 327 (-19.46%)
Mutual labels:  simd
highway-rs
Native Rust port of Google's HighwayHash, which makes use of SIMD instructions for a fast and strong hash function
Stars: ✭ 57 (-85.96%)
Mutual labels:  simd
Seqan
SeqAn's official repository.
Stars: ✭ 386 (-4.93%)
Mutual labels:  simd
Highway
Performance-portable, length-agnostic SIMD with runtime dispatch
Stars: ✭ 301 (-25.86%)
Mutual labels:  simd
Mango
mango fun framework
Stars: ✭ 343 (-15.52%)
Mutual labels:  simd
Std Simd
std::experimental::simd for GCC [ISO/IEC TS 19570:2018]
Stars: ✭ 275 (-32.27%)
Mutual labels:  simd
Tsimd
Fundamental C++ SIMD types for Intel CPUs (sse, avx, avx2, avx512)
Stars: ✭ 290 (-28.57%)
Mutual labels:  simd
Loopvectorization.jl
Macro(s) for vectorizing loops.
Stars: ✭ 325 (-19.95%)
Mutual labels:  simd
Bitmagic
BitMagic Library
Stars: ✭ 263 (-35.22%)
Mutual labels:  simd
Sleef
SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
Stars: ✭ 353 (-13.05%)
Mutual labels:  simd
simdutf
Unicode routines (UTF8, UTF16): billions of characters per second.
Stars: ✭ 108 (-73.4%)
Mutual labels:  simd
Sse2neon
A translator from Intel SSE intrinsics to Arm/Aarch64 NEON implementation
Stars: ✭ 316 (-22.17%)
Mutual labels:  simd
Stdarch
Rust's standard library vendor-specific APIs and run-time feature detection
Stars: ✭ 399 (-1.72%)
Mutual labels:  simd
Rtm
Realtime Math
Stars: ✭ 373 (-8.13%)
Mutual labels:  simd
Simdcomp
A simple C library for compressing lists of integers using binary packing
Stars: ✭ 331 (-18.47%)
Mutual labels:  simd

glam

Build Status Coverage Status Latest Version docs

A simple and fast 3D math library for games and graphics.

Development status

glam is in beta stage. Base functionality has been implemented and the look and feel of the API has solidified.

Features

  • f32 types
    • vectors: Vec2, Vec3, Vec3A and Vec4
    • square matrices: Mat2, Mat3 and Mat4
    • a quaternion type: Quat
  • f64 types
    • vectors: DVec2, DVec3 and DVec4
    • square matrices: DMat2, DMat3 and DMat4
    • a quaternion type: DQuat
  • i32 types
    • vectors: IVec2, IVec3 and IVec4
  • u32 types
    • vectors: UVec2, UVec3 and UVec4
  • bool types
    • vectors: BVec2, BVec3 and BVec4

SIMD

The Vec3A, Vec4 and Quat types use SSE2 on x86/x86_64 architectures. Mat2, Mat3 and Mat4 also use SSE2 for some functionality. Not everything has a SIMD implementation yet.

Note that this does result in some wasted space in the case of Vec3A as the SIMD vector type is 16 bytes large and 16 byte aligned.

glam outperforms similar Rust libraries for common operations as tested by the mathbench project.

no_std support

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.13.0", 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.13.0", default-features = false }

Optional features

  • bytemuck - for casting into slices of bytes
  • libm - required to compile with no_std
  • mint - for interoperating with other 3D math libraries
  • num-traits - required to compile no_std, will be included when enabling the libm feature
  • rand - implementations of Distribution trait for all glam types. This is primarily used for unit testing
  • serde - implementations of Serialize and Deserialize for all glam types. Note that serialization should work between builds of glam with and without SIMD enabled

Feature gates

  • scalar-math - compiles with SIMD support disabled
  • debug-glam-assert - adds assertions in debug builds which check the validity of parameters passed to glam to help catch runtime errors
  • glam-assert - adds validation assertions to all builds

Minimum Supported Version of Rust (MSVR)

The minimum supported version of Rust for glam is 1.36.0.

Conventions

Column vectors

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.

Column-major order

Matrices are stored in column major format. Each column vector is stored in contiguous memory.

Co-ordinate system

glam is co-ordinate system agnostic and intends to support both right handed and left handed conventions.

Design Philosophy

The design of this library is guided by a desire for simplicity and good performance.

  • No generics and minimal traits in the public API for simplicity of usage
  • All dependencies are optional (e.g. mint, rand and serde)
  • Follows the Rust API Guidelines where possible
  • Aiming for 100% test coverage
  • Common functionality is benchmarked using Criterion.rs

Future work

  • Experiment with a using a 4x3 matrix as a 3D transform type that can be more efficient than Mat4 for certain operations like inverse and multiplies
  • wasm support

Inspirations

There were many inspirations for the interface and internals of glam from the Rust and C++ worlds. In particular:

License

Licensed under either of

at your option.

Contribution

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.

Thank you to all of the glam contributors!

Support

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.

The Game Development in Rust Discord and Bevy Engine Discord servers can are also good places to ask for help with glam.

Attribution

glam contains code ported from the following C++ libraries:

  • DirectXMath - MIT License - Copyright (c) 2011-2020 Microsoft Corp
  • Realtime Math - MIT License - Copyright (c) 2018 Nicholas Frechette
  • GLM - MIT License - Copyright (c) 2005 - G-Truc Creation

See ATTRIBUTION.md for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].