-
-
Notifications
You must be signed in to change notification settings - Fork 268
Tweaks to glamconv and indexing for vectors #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,12 +7,17 @@ use std::ops::*; | |
|
|
||
| use std::fmt; | ||
|
|
||
| use glam::f32::Vec3; | ||
| use glam::Vec3A; | ||
| use godot_ffi as sys; | ||
| use sys::{ffi_methods, GodotFfi}; | ||
|
|
||
| use crate::builtin::math::*; | ||
| use crate::builtin::Vector3i; | ||
|
|
||
| use super::glam_helpers::GlamConv; | ||
| use super::glam_helpers::GlamType; | ||
|
|
||
| /// Vector used for 3D math using floating point coordinates. | ||
| /// | ||
| /// 3-element structure that can be used to represent positions in 3D space or any other triple of | ||
|
|
@@ -336,3 +341,31 @@ pub enum Vector3Axis { | |
| impl GodotFfi for Vector3Axis { | ||
| ffi_methods! { type sys::GDExtensionTypePtr = *mut Self; .. } | ||
| } | ||
|
|
||
| impl GlamType for Vec3 { | ||
| type Mapped = Vector3; | ||
|
|
||
| fn to_front(&self) -> Self::Mapped { | ||
| Vector3::new(self.x, self.y, self.z) | ||
| } | ||
|
|
||
| fn from_front(mapped: &Self::Mapped) -> Self { | ||
| Vec3::new(mapped.x, mapped.y, mapped.z) | ||
| } | ||
| } | ||
|
|
||
| impl GlamType for Vec3A { | ||
| type Mapped = Vector3; | ||
|
|
||
| fn to_front(&self) -> Self::Mapped { | ||
| Vector3::new(self.x, self.y, self.z) | ||
| } | ||
|
|
||
| fn from_front(mapped: &Self::Mapped) -> Self { | ||
| Vec3A::new(mapped.x, mapped.y, mapped.z) | ||
| } | ||
| } | ||
|
Comment on lines
+357
to
+367
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are not using
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we will be because the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, we then need to see if |
||
|
|
||
| impl GlamConv for Vector3 { | ||
| type Glam = Vec3; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this wrapping correctly?
Is the output in
[0, TAU]or[-PI, PI]range or something else?Some docs would be nice 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just copied the code from godot, so i didn't super look into it closely.
https://github.com/godotengine/godot/blob/master/core/math/math_funcs.h#L389