Skip to content

Commit

Permalink
Implement Reflect for integer glam vectors. (#1455)
Browse files Browse the repository at this point in the history
This is a very simple change that allows the (reflected) use of integer glam vectors (UVec2 for instance) in components.
  • Loading branch information
rmsc committed Feb 19, 2021
1 parent 578a5b1 commit 3319195
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion crates/bevy_reflect/src/impls/bevy_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ impl Plugin for ReflectPlugin {
.register_type::<String>();
#[cfg(feature = "glam")]
{
app.register_type::<glam::Vec2>()
app.register_type::<glam::IVec2>()
.register_type::<glam::IVec3>()
.register_type::<glam::IVec4>()
.register_type::<glam::UVec2>()
.register_type::<glam::UVec3>()
.register_type::<glam::UVec4>()
.register_type::<glam::Vec2>()
.register_type::<glam::Vec3>()
.register_type::<glam::Vec4>()
.register_type::<glam::Mat3>()
Expand Down
8 changes: 7 additions & 1 deletion crates/bevy_reflect/src/impls/glam.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
use crate::ReflectDeserialize;
use bevy_reflect_derive::impl_reflect_value;
use glam::{Mat3, Mat4, Quat, Vec2, Vec3, Vec4};
use glam::{IVec2, IVec3, IVec4, Mat3, Mat4, Quat, UVec2, UVec3, UVec4, Vec2, Vec3, Vec4};

impl_reflect_value!(IVec2(PartialEq, Serialize, Deserialize));
impl_reflect_value!(IVec3(PartialEq, Serialize, Deserialize));
impl_reflect_value!(IVec4(PartialEq, Serialize, Deserialize));
impl_reflect_value!(UVec2(PartialEq, Serialize, Deserialize));
impl_reflect_value!(UVec3(PartialEq, Serialize, Deserialize));
impl_reflect_value!(UVec4(PartialEq, Serialize, Deserialize));
impl_reflect_value!(Vec2(PartialEq, Serialize, Deserialize));
impl_reflect_value!(Vec3(PartialEq, Serialize, Deserialize));
impl_reflect_value!(Vec4(PartialEq, Serialize, Deserialize));
Expand Down

0 comments on commit 3319195

Please sign in to comment.