diff options
| author | HampusM <hampus@hampusmat.com> | 2026-04-14 16:03:30 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-04-14 16:03:30 +0200 |
| commit | 36fa6811c1c8171008bde10127a31be9614d6de8 (patch) | |
| tree | cbfe523c1de398f4b7f687fafd0a50f12db3fa6d /engine/src | |
| parent | b7cef4d4c76acc66830dc947872a763a32c1a9e1 (diff) | |
feat(engine): add into_array fn to Vec2 & Vec3
Diffstat (limited to 'engine/src')
| -rw-r--r-- | engine/src/data_types/vector.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/engine/src/data_types/vector.rs b/engine/src/data_types/vector.rs index 8567af5..e745387 100644 --- a/engine/src/data_types/vector.rs +++ b/engine/src/data_types/vector.rs @@ -9,6 +9,14 @@ pub struct Vec2<Value> pub y: Value, } +impl<Value> Vec2<Value> +{ + pub fn into_array(self) -> [Value; 2] + { + self.into() + } +} + impl Vec2<u32> { pub const ZERO: Self = Self { x: 0, y: 0 }; @@ -182,9 +190,9 @@ impl Vec3<f32> impl<Value> Vec3<Value> { - pub fn as_ptr(&self) -> *const Value + pub fn into_array(self) -> [Value; 3] { - &self.x + self.into() } } |
