forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reflect impls for bevy_math curve structs (bevyengine#13348)
# Objective Fixes bevyengine#13189 ## Solution To add the reflect impls I needed to make all the struct fields pub. I don't think there's any harm for these types, but just a note for review. --------- Co-authored-by: Ben Harper <[email protected]>
- Loading branch information
Showing
3 changed files
with
117 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
use crate as bevy_reflect; | ||
use bevy_math::{cubic_splines::*, VectorSpace}; | ||
use bevy_reflect::std_traits::ReflectDefault; | ||
use bevy_reflect_derive::impl_reflect; | ||
|
||
impl_reflect!( | ||
#[reflect(Debug)] | ||
#[type_path = "bevy_math::cubic_splines"] | ||
struct CubicBezier<P: VectorSpace> { | ||
control_points: Vec<[P; 4]>, | ||
} | ||
); | ||
|
||
impl_reflect!( | ||
#[reflect(Debug)] | ||
#[type_path = "bevy_math::cubic_splines"] | ||
struct CubicHermite<P: VectorSpace> { | ||
control_points: Vec<(P, P)>, | ||
} | ||
); | ||
|
||
impl_reflect!( | ||
#[reflect(Debug)] | ||
#[type_path = "bevy_math::cubic_splines"] | ||
struct CubicCardinalSpline<P: VectorSpace> { | ||
tension: f32, | ||
control_points: Vec<P>, | ||
} | ||
); | ||
|
||
impl_reflect!( | ||
#[reflect(Debug)] | ||
#[type_path = "bevy_math::cubic_splines"] | ||
struct CubicBSpline<P: VectorSpace> { | ||
control_points: Vec<P>, | ||
} | ||
); | ||
|
||
impl_reflect!( | ||
#[reflect(Debug)] | ||
#[type_path = "bevy_math::cubic_splines"] | ||
struct CubicNurbs<P: VectorSpace> { | ||
control_points: Vec<P>, | ||
weights: Vec<f32>, | ||
knots: Vec<f32>, | ||
} | ||
); | ||
|
||
impl_reflect!( | ||
#[reflect(Debug)] | ||
#[type_path = "bevy_math::cubic_splines"] | ||
struct LinearSpline<P: VectorSpace> { | ||
points: Vec<P>, | ||
} | ||
); | ||
|
||
impl_reflect!( | ||
#[reflect(Debug, Default)] | ||
#[type_path = "bevy_math::cubic_splines"] | ||
struct CubicSegment<P: VectorSpace> { | ||
coeff: [P; 4], | ||
} | ||
); | ||
|
||
impl_reflect!( | ||
#[reflect(Debug)] | ||
#[type_path = "bevy_math::cubic_splines"] | ||
struct CubicCurve<P: VectorSpace> { | ||
segments: Vec<CubicSegment<P>>, | ||
} | ||
); | ||
|
||
impl_reflect!( | ||
#[reflect(Debug, Default)] | ||
#[type_path = "bevy_math::cubic_splines"] | ||
struct RationalSegment<P: VectorSpace> { | ||
coeff: [P; 4], | ||
weight_coeff: [f32; 4], | ||
knot_span: f32, | ||
} | ||
); | ||
|
||
impl_reflect!( | ||
#[reflect(Debug)] | ||
#[type_path = "bevy_math::cubic_splines"] | ||
struct RationalCurve<P: VectorSpace> { | ||
segments: Vec<RationalSegment<P>>, | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters