openxr_sys/
mint_impls.rs

1use crate::{
2    Extent2Df, Extent2Di, Offset2Df, Offset2Di, Quaternionf, Vector2f, Vector3f, Vector4f,
3};
4use mint::{Quaternion, Vector2, Vector3, Vector4};
5
6impl From<Vector2f> for Vector2<f32> {
7    fn from(v: Vector2f) -> Self {
8        Vector2 { x: v.x, y: v.y }
9    }
10}
11
12impl From<Vector2<f32>> for Vector2f {
13    fn from(v: Vector2<f32>) -> Self {
14        Self { x: v.x, y: v.y }
15    }
16}
17
18impl From<Offset2Df> for Vector2<f32> {
19    fn from(v: Offset2Df) -> Self {
20        Vector2 { x: v.x, y: v.y }
21    }
22}
23
24impl From<Vector2<f32>> for Offset2Df {
25    fn from(v: Vector2<f32>) -> Self {
26        Self { x: v.x, y: v.y }
27    }
28}
29
30impl From<Offset2Di> for Vector2<i32> {
31    fn from(v: Offset2Di) -> Self {
32        Vector2 { x: v.x, y: v.y }
33    }
34}
35
36impl From<Vector2<i32>> for Offset2Di {
37    fn from(v: Vector2<i32>) -> Self {
38        Self { x: v.x, y: v.y }
39    }
40}
41
42impl From<Extent2Df> for Vector2<f32> {
43    fn from(v: Extent2Df) -> Self {
44        Vector2 {
45            x: v.width,
46            y: v.height,
47        }
48    }
49}
50
51impl From<Vector2<f32>> for Extent2Df {
52    fn from(v: Vector2<f32>) -> Self {
53        Self {
54            width: v.x,
55            height: v.y,
56        }
57    }
58}
59
60impl From<Extent2Di> for Vector2<i32> {
61    fn from(v: Extent2Di) -> Self {
62        Vector2 {
63            x: v.width,
64            y: v.height,
65        }
66    }
67}
68
69impl From<Vector2<i32>> for Extent2Di {
70    fn from(v: Vector2<i32>) -> Self {
71        Self {
72            width: v.x,
73            height: v.y,
74        }
75    }
76}
77
78impl From<Vector3f> for Vector3<f32> {
79    fn from(v: Vector3f) -> Self {
80        Vector3 {
81            x: v.x,
82            y: v.y,
83            z: v.z,
84        }
85    }
86}
87
88impl From<Vector3<f32>> for Vector3f {
89    fn from(v: Vector3<f32>) -> Self {
90        Self {
91            x: v.x,
92            y: v.y,
93            z: v.z,
94        }
95    }
96}
97
98impl From<Vector4f> for Vector4<f32> {
99    fn from(v: Vector4f) -> Self {
100        Vector4 {
101            x: v.x,
102            y: v.y,
103            z: v.z,
104            w: v.w,
105        }
106    }
107}
108
109impl From<Vector4<f32>> for Vector4f {
110    fn from(v: Vector4<f32>) -> Self {
111        Self {
112            x: v.x,
113            y: v.y,
114            z: v.z,
115            w: v.w,
116        }
117    }
118}
119
120impl From<Quaternion<f32>> for Quaternionf {
121    fn from(q: Quaternion<f32>) -> Self {
122        Self {
123            x: q.v.x,
124            y: q.v.y,
125            z: q.v.z,
126            w: q.s,
127        }
128    }
129}
130
131impl From<Quaternionf> for Quaternion<f32> {
132    fn from(q: Quaternionf) -> Quaternion<f32> {
133        Quaternion {
134            s: q.w,
135            v: Vector3 {
136                x: q.x,
137                y: q.y,
138                z: q.z,
139            },
140        }
141    }
142}