Debian Codegraph @

debian/missing-sources/glam-0.17.3/README.md

raw symbols SCIP
1 # glam
2
3 [![Build Status]][github-ci] [![Coverage Status]][coveralls.io]
4 [![Latest Version]][crates.io] [![docs]][docs.rs]
5 [![Minimum Supported Rust Version]][Rust 1.45]
6
7 A simple and fast 3D math library for games and graphics.
8
9 ## Development status
10
11 `glam` is in beta stage. Base functionality has been implemented and the look
12 and feel of the API has solidified.
13
14 ## Features
15
16 * `f32` types
17 * vectors: `Vec2`, `Vec3`, `Vec3A` and `Vec4`
18 * square matrices: `Mat2`, `Mat3`, `Mat3A` and `Mat4`
19 * a quaternion type: `Quat`
20 * affine transformation types: `Affine2` and `Affine3A`
21 * `f64` types
22 * vectors: `DVec2`, `DVec3` and `DVec4`
23 * square matrices: `DMat2`, `DMat3` and `DMat4`
24 * a quaternion type: `DQuat`
25 * affine transformation types: `DAffine2` and `DAffine3`
26 * `i32` types
27 * vectors: `IVec2`, `IVec3` and `IVec4`
28 * `u32` types
29 * vectors: `UVec2`, `UVec3` and `UVec4`
30 * `bool` types
31 * vectors: `BVec2`, `BVec3` and `BVec4`
32
33 ### SIMD
34
35 The `Vec3A`, `Vec4`, `Quat`, `Mat2`, `Mat3A`, `Mat4`, `Affine2` and `Affine3A`
36 types use 128-bit wide SIMD vector types for storage on x86/x86_64
37 architectures. As a result, these types are all 16 byte aligned and depending
38 on the size of the type or the type's members, they may contain internal
39 padding. This results in some wasted space in the cases of `Vec3A`, `Mat3A`,
40 `Affine2` and `Affine3A`. However the use of SIMD generally results in better
41 performance than scalar math.
42
43 `glam` outperforms similar Rust libraries for common operations as tested by the
44 [`mathbench`][mathbench] project.
45
46 [mathbench]: https://github.com/bitshifter/mathbench-rs
47
48 ### `no_std` support
49
50 `no_std` support can be enabled by compiling with `--no-default-features` to
51 disable `std` support and `--features libm` for math functions that are only
52 defined in `std`. For example:
53
54 ```toml
55 [dependencies]
56 glam = { version = "0.17.0", default-features = false, features = ["libm"] }
57 ```
58
59 To support both `std` and `no_std` builds in project, you can use the following
60 in your `Cargo.toml`:
61
62 ```toml
63 [features]
64 default = ["std"]
65
66 std = ["glam/std"]
67 libm = ["glam/libm"]
68
69 [dependencies]
70 glam = { version = "0.17.0", default-features = false }
71 ```
72
73 ### Optional features
74
75 * [`approx`] - traits and macros for approximate float comparisons
76 * [`bytemuck`] - for casting into slices of bytes
77 * [`libm`] - required to compile with `no_std`
78 * [`mint`] - for interoperating with other 3D math libraries
79 * [`num-traits`] - required to compile `no_std`, will be included when enabling
80 the `libm` feature
81 * [`rand`] - implementations of `Distribution` trait for all `glam` types.
82 * [`serde`] - implementations of `Serialize` and `Deserialize` for all `glam`
83 types. Note that serialization should work between builds of `glam` with and
84 without SIMD enabled
85
86 [`approx`]: https://docs.rs/approx
87 [`bytemuck`]: https://docs.rs/bytemuck
88 [`libm`]: https://github.com/rust-lang/libm
89 [`mint`]: https://github.com/kvark/mint
90 [`num-traits`]: https://github.com/rust-num/num-traits
91 [`rand`]: https://github.com/rust-random/rand
92 [`serde`]: https://serde.rs
93
94 ### Feature gates
95
96 * `scalar-math` - compiles with SIMD support disabled
97 * `debug-glam-assert` - adds assertions in debug builds which check the validity
98 of parameters passed to `glam` to help catch runtime errors
99 * `glam-assert` - adds validation assertions to all builds
100
101 ### Minimum Supported Rust Version (MSRV)
102
103 The minimum supported version of Rust for `glam` is `1.45.0`.
104
105 ## Conventions
106
107 ### Column vectors
108
109 `glam` interprets vectors as column matrices (also known as "column vectors")
110 meaning when transforming a vector with a matrix the matrix goes on the left,
111 e.g. `v' = Mv`. DirectX uses row vectors, OpenGL uses column vectors. There
112 are pros and cons to both.
113
114 ### Column-major order
115
116 Matrices are stored in column major format. Each column vector is stored in
117 contiguous memory.
118
119 ### Co-ordinate system
120
121 `glam` is co-ordinate system agnostic and intends to support both right handed
122 and left handed conventions.
123
124 ## Design Philosophy
125
126 The design of this library is guided by a desire for simplicity and good
127 performance.
128
129 * No generics and minimal traits in the public API for simplicity of usage
130 * All dependencies are optional (e.g. `mint`, `rand` and `serde`)
131 * Follows the [Rust API Guidelines] where possible
132 * Aiming for 100% test [coverage]
133 * Common functionality is benchmarked using [Criterion.rs]
134
135 [Rust API Guidelines]: https://rust-lang-nursery.github.io/api-guidelines/
136 [coverage]: coveralls.io
137 [Criterion.rs]: https://bheisler.github.io/criterion.rs/book/index.html
138
139 ## Inspirations
140
141 There were many inspirations for the interface and internals of glam from the
142 Rust and C++ worlds. In particular:
143
144 * [How to write a maths library in 2016] inspired the initial `Vec3A`
145 implementation
146 * [Realtime Math] - header only C++11 with SSE and NEON SIMD intrinsic support
147 * [DirectXMath] - header only SIMD C++ linear algebra library for use in games
148 and graphics apps
149 * `glam` is a play on the name of the popular C++ library [GLM]
150
151 [How to write a maths library in 2016]: http://www.codersnotes.com/notes/maths-lib-2016/
152 [Realtime Math]: https://github.com/nfrechette/rtm
153 [DirectXMath]: https://docs.microsoft.com/en-us/windows/desktop/dxmath/directxmath-portal
154 [GLM]: https://glm.g-truc.net
155
156 ## License
157
158 Licensed under either of
159
160 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE)
161 or http://www.apache.org/licenses/LICENSE-2.0)
162 * MIT license ([LICENSE-MIT](LICENSE-MIT)
163 or http://opensource.org/licenses/MIT)
164
165 at your option.
166
167 ## Contribution
168
169 Contributions in any form (issues, pull requests, etc.) to this project must
170 adhere to Rust's [Code of Conduct].
171
172 Unless you explicitly state otherwise, any contribution intentionally submitted
173 for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
174 dual licensed as above, without any additional terms or conditions.
175
176 Thank you to all of the `glam` [contributors]!
177
178 [Code of Conduct]: https://www.rust-lang.org/en-US/conduct.html
179 [contributors]: https://github.com/bitshifter/glam-rs/graphs/contributors
180
181 ## Support
182
183 If you are interested in contributing or have a request or suggestion
184 [start a discussion] on github. See [CONTRIBUTING.md] for more information for
185 contributors.
186
187 The [Game Development in Rust Discord] and [Bevy Engine Discord] servers can are
188 also good places to ask for help with `glam`.
189
190 [start a discussion]: https://github.com/bitshifter/glam-rs/discussions
191 [CONTRIBUTING.md]: CONTRIBUTING.md
192 [Game Development in Rust Discord]: https://discord.gg/yNtPTb2
193 [Bevy Engine Discord]: https://discord.gg/gMUk5Ph
194
195 ## Attribution
196
197 `glam` contains code ported from the following C++ libraries:
198
199 * [DirectXMath] - MIT License - Copyright (c) 2011-2020 Microsoft Corp
200 * [Realtime Math] - MIT License - Copyright (c) 2018 Nicholas Frechette
201 * [GLM] - MIT License - Copyright (c) 2005 - G-Truc Creation
202
203 See [ATTRIBUTION.md] for details.
204
205 [ATTRIBUTION.md]: ATTRIBUTION.md
206
207 [Build Status]: https://github.com/bitshifter/glam-rs/actions/workflows/ci.yml/badge.svg
208 [github-ci]: https://github.com/bitshifter/glam-rs/actions/workflows/ci.yml
209 [Coverage Status]: https://coveralls.io/repos/github/bitshifter/glam-rs/badge.svg?branch=master
210 [coveralls.io]: https://coveralls.io/github/bitshifter/glam-rs?branch=master
211 [Latest Version]: https://img.shields.io/crates/v/glam.svg
212 [crates.io]: https://crates.io/crates/glam/
213 [docs]: https://docs.rs/glam/badge.svg
214 [docs.rs]: https://docs.rs/glam/
215 [Minimum Supported Rust Version]: https://img.shields.io/badge/Rust-1.45.0-blue?color=fc8d62&logo=rust
216 [Rust 1.45]: https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html