Debian Codegraph @

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

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