Skip to content

Commit

Permalink
Add Reflect support for DMat3, DMat4, DQuat (#4128)
Browse files Browse the repository at this point in the history
## Objective

A step towards `f64` `Transform`s (#1680). For now, I am rolling my own `Transform`. But in order to derive Reflect, I specifically need `DQuat` to be reflectable.

```rust
#[derive(Component, Reflect, Copy, Clone, PartialEq, Debug)]
#[reflect(Component, PartialEq)]
pub struct Transform {
    pub translation: DVec3,
    pub rotation: DQuat, // error: the trait `bevy::prelude::Reflect` is not implemented for `DQuat`
    pub scale: DVec3,
}
```

## Solution

I have added a `DQuat` impl for `Reflect` alongside the other glam impls. I've also added impls for `DMat3` and `DMat4` to match.
  • Loading branch information
ItsDoot committed Mar 8, 2022
1 parent 2d674e7 commit c05ba23
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/bevy_reflect/src/impls/glam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ impl_reflect_value!(DVec4(PartialEq, Serialize, Deserialize));
impl_reflect_value!(Mat3(PartialEq, Serialize, Deserialize));
impl_reflect_value!(Mat4(PartialEq, Serialize, Deserialize));
impl_reflect_value!(Quat(PartialEq, Serialize, Deserialize));
impl_reflect_value!(DMat3(PartialEq, Serialize, Deserialize));
impl_reflect_value!(DMat4(PartialEq, Serialize, Deserialize));
impl_reflect_value!(DQuat(PartialEq, Serialize, Deserialize));

impl_from_reflect_value!(IVec2);
impl_from_reflect_value!(IVec3);
Expand All @@ -36,3 +39,6 @@ impl_from_reflect_value!(DVec4);
impl_from_reflect_value!(Mat3);
impl_from_reflect_value!(Mat4);
impl_from_reflect_value!(Quat);
impl_from_reflect_value!(DMat3);
impl_from_reflect_value!(DMat4);
impl_from_reflect_value!(DQuat);

0 comments on commit c05ba23

Please sign in to comment.