nova_math/
types.rs

1/*
2 *
3 * This file is a part of NovaEngine
4 * https://gitlab.com/MindSpunk/NovaEngine
5 *
6 *
7 * MIT License
8 *
9 * Copyright (c) 2018 Nathan Voglsam
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in all
19 * copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28 */
29
30use crate::matrix::TMat4x4;
31use crate::vector::{TVec2, TVec3, TVec4};
32
33use crate::quaternion::TQuat;
34
35///
36/// A 2 component f32 vector
37///
38pub type Vec2 = TVec2<f32>;
39
40///
41/// A 3 component f32 vector
42///
43pub type Vec3 = TVec3<f32>;
44
45///
46/// A 4 component f32 vector
47///
48pub type Vec4 = TVec4<f32>;
49
50///
51/// A 2 component f64 vector
52///
53pub type DVec2 = TVec2<f64>;
54
55///
56/// A 3 component f64 vector
57///
58pub type DVec3 = TVec3<f64>;
59
60///
61/// A 4 component f64 vector
62///
63pub type DVec4 = TVec4<f64>;
64
65///
66/// A f32 quaternion
67///
68pub type Quat = TQuat<f32>;
69
70///
71/// A f64 quaternion
72///
73pub type DQuat = TQuat<f64>;
74
75///
76/// A 4x4 f32 matrix
77///
78pub type Mat4x4 = TMat4x4<f32>;
79
80///
81/// A 4x4 f64 matrix
82///
83pub type DMat4x4 = TMat4x4<f64>;
84
85pub mod std140 {
86    use crate::matrix::std140::TMat4x4P;
87    use crate::vector::std140::TVec2P;
88    use crate::vector::std140::TVec3P;
89    use crate::vector::std140::TVec4P;
90
91    ///
92    /// A packed 2 component f32 vector
93    ///
94    pub type Vec2P = TVec2P<f32>;
95
96    ///
97    /// A packed 3 component f32 vector
98    ///
99    pub type Vec3P = TVec3P<f32>;
100
101    ///
102    /// A packed 4 component f32 vector
103    ///
104    pub type Vec4P = TVec4P<f32>;
105
106    ///
107    /// A packed 2 component f64 vector
108    ///
109    pub type DVec2P = TVec2P<f64>;
110
111    ///
112    /// A packed 3 component f64 vector
113    ///
114    pub type DVec3P = TVec3P<f64>;
115
116    ///
117    /// A packed 4 component f64 vector
118    ///
119    pub type DVec4P = TVec4P<f64>;
120
121    ///
122    /// A packed 4x4 f32 matrix
123    ///
124    pub type Mat4x4P = TMat4x4P<f32>;
125    ///
126    /// A packed 4x4 f64 matrix
127    ///
128    pub type DMat4x4P = TMat4x4P<f64>;
129}