@@ -12,18 +12,20 @@ use godot_ffi as sys;
1212use sys:: { ffi_methods, GodotFfi } ;
1313
1414use crate :: builtin:: math:: { GlamConv , GlamType } ;
15- use crate :: builtin:: { inner, real, RVec3 , Vector3 , Vector3Axis } ;
15+ use crate :: builtin:: { inner, real, RVec3 , Vector2i , Vector3 , Vector3Axis } ;
1616
1717/// Vector used for 3D math using integer coordinates.
1818///
1919/// 3-element structure that can be used to represent discrete positions or directions in 3D space,
2020/// as well as any other triple of numeric values.
2121///
22- /// It uses integer coordinates and is therefore preferable to [`Vector3`] when exact precision is
22+ /// `Vector3i` uses integer coordinates and is therefore preferable to [`Vector3`] when exact precision is
2323/// required. Note that the values are limited to 32 bits, and unlike `Vector3` this cannot be
2424/// configured with an engine build option. Use `i64` or [`PackedInt64Array`][crate::builtin::PackedInt64Array]
2525/// if 64-bit values are needed.
2626///
27+ #[ doc = shared_vector_docs ! ( ) ]
28+ ///
2729/// ### Navigation to `impl` blocks within this page
2830///
2931/// - [Constants](#constants)
@@ -40,6 +42,8 @@ use crate::builtin::{inner, real, RVec3, Vector3, Vector3Axis};
4042/// | 3D | [`Vector3`][crate::builtin::Vector3] | **`Vector3i`** |
4143/// | 4D | [`Vector4`][crate::builtin::Vector4] | [`Vector4i`][crate::builtin::Vector4i] |
4244///
45+ /// <br>You can convert to 2D vectors using [`to_2d()`][Self::to_2d], and to `Vector3` using [`cast_float()`][Self::cast_float].
46+ ///
4347/// # Godot docs
4448///
4549/// [`Vector3i` (stable)](https://docs.godotengine.org/en/stable/classes/class_vector3i.html)
@@ -68,17 +72,13 @@ impl_vector_fns!(Vector3i, glam::IVec3, i32, (x, y, z));
6872
6973/// # Specialized `Vector3i` functions
7074impl Vector3i {
71- /// Constructs a new `Vector3i` from a [` Vector3`]. The floating point coordinates will be truncated.
75+ # [ deprecated = "Moved to ` Vector3::cast_int()`" ]
7276 #[ inline]
7377 pub const fn from_vector3 ( v : Vector3 ) -> Self {
74- Self {
75- x : v. x as i32 ,
76- y : v. y as i32 ,
77- z : v. z as i32 ,
78- }
78+ v. cast_int ( )
7979 }
8080
81- inline_impl_integer_vector_fns ! ( x, y, z) ;
81+ inline_impl_integer_vector_fns ! ( Vector3 , x, y, z) ;
8282
8383 /// Converts `self` to the corresponding [`real`] `glam` type.
8484 #[ doc( hidden) ]
@@ -94,7 +94,7 @@ impl Vector3i {
9494 }
9595}
9696
97- impl_vector3x_fns ! ( Vector3i , i32 ) ;
97+ impl_vector3x_fns ! ( Vector3i , Vector2i , i32 ) ;
9898
9999impl_vector_operators ! ( Vector3i , i32 , ( x, y, z) ) ;
100100
0 commit comments