| 1 | #[cfg(any( |
| 2 | all(debug_assertions, feature = "debug-glam-assert"), |
| 3 | feature = "glam-assert" |
| 4 | ))] |
| 5 | macro_rules! glam_assert { |
| 6 | ($($arg:tt)*) => ( assert!($($arg)*); ) |
| 7 | } |
| 8 | #[cfg(not(any( |
| 9 | all(debug_assertions, feature = "debug-glam-assert"), |
| 10 | feature = "glam-assert" |
| 11 | )))] |
| 12 | macro_rules! glam_assert { |
| 13 | ($($arg:tt)*) => {}; |
| 14 | } |
| 15 | |
| 16 | macro_rules! const_assert { |
| 17 | ($x:expr $(,)?) => { |
| 18 | #[allow(unknown_lints, clippy::eq_op)] |
| 19 | const _: () = assert!($x); |
| 20 | }; |
| 21 | } |
| 22 | |
| 23 | macro_rules! const_assert_eq { |
| 24 | ($x:expr, $y:expr $(,)?) => { |
| 25 | const_assert!($x == $y); |
| 26 | }; |
| 27 | } |
| 28 | |
| 29 | #[deprecated(since = "0.21.0", note = "use sse2::m128_from_f32x4() instead.")] |
| 30 | #[macro_export] |
| 31 | #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
| 32 | macro_rules! const_m128 { |
| 33 | ($fx4:expr) => {{ |
| 34 | $crate::sse2::m128_from_f32x4($fx4) |
| 35 | }}; |
| 36 | } |
| 37 | |
| 38 | #[deprecated(since = "0.21.0", note = "use Vec2::from_array() instead.")] |
| 39 | #[macro_export] |
| 40 | macro_rules! const_vec2 { |
| 41 | ($fx2:expr) => {{ |
| 42 | $crate::Vec2::from_array($fx2) |
| 43 | }}; |
| 44 | } |
| 45 | |
| 46 | #[deprecated(since = "0.21.0", note = "use Vec3::from_array() instead.")] |
| 47 | #[macro_export] |
| 48 | macro_rules! const_vec3 { |
| 49 | ($fx3:expr) => {{ |
| 50 | $crate::Vec3::from_array($fx3) |
| 51 | }}; |
| 52 | } |
| 53 | |
| 54 | #[deprecated(since = "0.21.0", note = "use Vec3A::from_array() instead.")] |
| 55 | #[macro_export] |
| 56 | macro_rules! const_vec3a { |
| 57 | ($fx3:expr) => {{ |
| 58 | $crate::Vec3A::from_array($fx3) |
| 59 | }}; |
| 60 | } |
| 61 | |
| 62 | #[deprecated(since = "0.21.0", note = "use Vec4::from_array() instead.")] |
| 63 | #[macro_export] |
| 64 | macro_rules! const_vec4 { |
| 65 | ($fx4:expr) => {{ |
| 66 | $crate::Vec4::from_array($fx4) |
| 67 | }}; |
| 68 | } |
| 69 | |
| 70 | #[deprecated( |
| 71 | since = "0.21.0", |
| 72 | note = "use Mat2::from_cols(), Mat2::from_cols_array() or Mat2::from_cols_array_2d() instead." |
| 73 | )] |
| 74 | #[macro_export] |
| 75 | macro_rules! const_mat2 { |
| 76 | ($col0:expr, $col1:expr) => {{ |
| 77 | $crate::Mat2::from_cols_array_2d(&[$col0, $col1]) |
| 78 | }}; |
| 79 | ($fx4:expr) => {{ |
| 80 | $crate::Mat2::from_cols_array(&$fx4) |
| 81 | }}; |
| 82 | } |
| 83 | |
| 84 | #[deprecated( |
| 85 | since = "0.21.0", |
| 86 | note = "use Mat3::from_cols(), Mat3::from_cols_array() or Mat3::from_cols_array_2d() instead." |
| 87 | )] |
| 88 | #[macro_export] |
| 89 | macro_rules! const_mat3 { |
| 90 | ($col0:expr, $col1:expr, $col2:expr) => {{ |
| 91 | $crate::Mat3::from_cols_array_2d(&[$col0, $col1, $col2]) |
| 92 | }}; |
| 93 | ($fx9:expr) => {{ |
| 94 | $crate::Mat3::from_cols_array(&$fx9) |
| 95 | }}; |
| 96 | } |
| 97 | |
| 98 | #[deprecated( |
| 99 | since = "0.21.0", |
| 100 | note = "use Mat3A::from_cols(), Mat3A::from_cols_array() or Mat3A::from_cols_array_2d() instead." |
| 101 | )] |
| 102 | #[macro_export] |
| 103 | macro_rules! const_mat3a { |
| 104 | ($col0:expr, $col1:expr, $col2:expr) => {{ |
| 105 | $crate::Mat3A::from_cols_array_2d(&[$col0, $col1, $col2]) |
| 106 | }}; |
| 107 | ($fx9:expr) => {{ |
| 108 | $crate::Mat3A::from_cols_array(&$fx9) |
| 109 | }}; |
| 110 | } |
| 111 | |
| 112 | #[deprecated( |
| 113 | since = "0.21.0", |
| 114 | note = "use Mat4::from_cols(), Mat4::from_cols_array() or Mat4::from_cols_array_2d() instead." |
| 115 | )] |
| 116 | #[macro_export] |
| 117 | macro_rules! const_mat4 { |
| 118 | ($col0:expr, $col1:expr, $col2:expr, $col3:expr) => {{ |
| 119 | $crate::Mat4::from_cols_array_2d(&[$col0, $col1, $col2, $col3]) |
| 120 | }}; |
| 121 | ($fx16:expr) => {{ |
| 122 | $crate::Mat4::from_cols_array(&$fx16) |
| 123 | }}; |
| 124 | } |
| 125 | |
| 126 | #[deprecated( |
| 127 | since = "0.21.0", |
| 128 | note = "use Quat::from_xyzw() or Quat::from_array() instead." |
| 129 | )] |
| 130 | #[macro_export] |
| 131 | macro_rules! const_quat { |
| 132 | ($fx4:expr) => {{ |
| 133 | $crate::Quat::from_array($fx4) |
| 134 | }}; |
| 135 | } |
| 136 | |
| 137 | #[deprecated(since = "0.21.0", note = "use DVec2::from_array() instead.")] |
| 138 | #[macro_export] |
| 139 | macro_rules! const_dvec2 { |
| 140 | ($fx2:expr) => {{ |
| 141 | $crate::DVec2::from_array($fx2) |
| 142 | }}; |
| 143 | } |
| 144 | |
| 145 | #[deprecated(since = "0.21.0", note = "use DVec3::from_array() instead.")] |
| 146 | #[macro_export] |
| 147 | macro_rules! const_dvec3 { |
| 148 | ($fx3:expr) => {{ |
| 149 | $crate::DVec3::from_array($fx3) |
| 150 | }}; |
| 151 | } |
| 152 | |
| 153 | #[deprecated(since = "0.21.0", note = "use DVec4::from_array() instead.")] |
| 154 | #[macro_export] |
| 155 | macro_rules! const_dvec4 { |
| 156 | ($fx4:expr) => {{ |
| 157 | $crate::DVec4::from_array($fx4) |
| 158 | }}; |
| 159 | } |
| 160 | |
| 161 | #[deprecated( |
| 162 | since = "0.21.0", |
| 163 | note = "use DMat2::from_cols(), DMat2::from_cols_array() or DMat2::from_cols_array_2d() instead." |
| 164 | )] |
| 165 | #[macro_export] |
| 166 | macro_rules! const_dmat2 { |
| 167 | ($col0:expr, $col1:expr) => {{ |
| 168 | $crate::DMat2::from_cols_array_2d(&[$col0, $col1]) |
| 169 | }}; |
| 170 | ($fx4:expr) => {{ |
| 171 | $crate::DMat2::from_cols_array(&$fx4) |
| 172 | }}; |
| 173 | } |
| 174 | |
| 175 | #[deprecated( |
| 176 | since = "0.21.0", |
| 177 | note = "use DMat3::from_cols(), DMat3::from_cols_array() or DMat3::from_cols_array_2d() instead." |
| 178 | )] |
| 179 | #[macro_export] |
| 180 | macro_rules! const_dmat3 { |
| 181 | ($col0:expr, $col1:expr, $col2:expr) => {{ |
| 182 | $crate::DMat3::from_cols_array_2d(&[$col0, $col1, $col2]) |
| 183 | }}; |
| 184 | ($fx9:expr) => {{ |
| 185 | $crate::DMat3::from_cols_array(&$fx9) |
| 186 | }}; |
| 187 | } |
| 188 | |
| 189 | #[deprecated( |
| 190 | since = "0.21.0", |
| 191 | note = "use DMat4::from_cols(), DMat4::from_cols_array() or DMat4::from_cols_array_2d() instead." |
| 192 | )] |
| 193 | #[macro_export] |
| 194 | macro_rules! const_dmat4 { |
| 195 | ($col0:expr, $col1:expr, $col2:expr, $col3:expr) => {{ |
| 196 | $crate::DMat4::from_cols_array_2d(&[$col0, $col1, $col2, $col3]) |
| 197 | }}; |
| 198 | ($fx16:expr) => {{ |
| 199 | $crate::DMat4::from_cols_array(&$fx16) |
| 200 | }}; |
| 201 | } |
| 202 | |
| 203 | #[deprecated( |
| 204 | since = "0.21.0", |
| 205 | note = "use DQuat::from_xyzw() or DQuat::from_array() instead." |
| 206 | )] |
| 207 | #[macro_export] |
| 208 | macro_rules! const_dquat { |
| 209 | ($fx4:expr) => {{ |
| 210 | $crate::DQuat::from_array($fx4) |
| 211 | }}; |
| 212 | } |
| 213 | |
| 214 | #[deprecated(since = "0.21.0", note = "use IVec2::from_array() instead.")] |
| 215 | #[macro_export] |
| 216 | macro_rules! const_ivec2 { |
| 217 | ($ix2:expr) => {{ |
| 218 | $crate::IVec2::from_array($ix2) |
| 219 | }}; |
| 220 | } |
| 221 | |
| 222 | #[deprecated(since = "0.21.0", note = "use IVec3::from_array() instead.")] |
| 223 | #[macro_export] |
| 224 | macro_rules! const_ivec3 { |
| 225 | ($ix3:expr) => {{ |
| 226 | $crate::IVec3::from_array($ix3) |
| 227 | }}; |
| 228 | } |
| 229 | |
| 230 | #[deprecated(since = "0.21.0", note = "use IVec4::from_array() instead.")] |
| 231 | #[macro_export] |
| 232 | macro_rules! const_ivec4 { |
| 233 | ($ix4:expr) => {{ |
| 234 | $crate::IVec4::from_array($ix4) |
| 235 | }}; |
| 236 | } |
| 237 | |
| 238 | #[deprecated(since = "0.21.0", note = "use UVec2::from_array() instead.")] |
| 239 | #[macro_export] |
| 240 | macro_rules! const_uvec2 { |
| 241 | ($ux2:expr) => {{ |
| 242 | $crate::UVec2::from_array($ux2) |
| 243 | }}; |
| 244 | } |
| 245 | |
| 246 | #[deprecated(since = "0.21.0", note = "use UVec3::from_array() instead.")] |
| 247 | #[macro_export] |
| 248 | macro_rules! const_uvec3 { |
| 249 | ($ux3:expr) => {{ |
| 250 | $crate::UVec3::from_array($ux3) |
| 251 | }}; |
| 252 | } |
| 253 | |
| 254 | #[deprecated(since = "0.21.0", note = "use UVec4::from_array() instead.")] |
| 255 | #[macro_export] |
| 256 | macro_rules! const_uvec4 { |
| 257 | ($ux4:expr) => {{ |
| 258 | $crate::UVec4::from_array($ux4) |
| 259 | }}; |
| 260 | } |