Move bevy_math Reflect impls (#13520)
				
					
				
			# Objective Fixes #13456 ## Solution Moved `bevy_math`'s `Reflect` impls from `bevy_reflect` to `bevy_math`. ### Quick note I accidentally used the same commit message while resolving a merge conflict (first time I had to resolve a conflict). Sorry about that.
This commit is contained in:
		
							parent
							
								
									cf4baf8fbf
								
							
						
					
					
						commit
						8c7f73ab81
					
				| @ -20,6 +20,8 @@ rand = { version = "0.8", features = [ | |||||||
| ], default-features = false, optional = true } | ], default-features = false, optional = true } | ||||||
| smallvec = { version = "1.11" } | smallvec = { version = "1.11" } | ||||||
| 
 | 
 | ||||||
|  | bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", optional = true } | ||||||
|  | 
 | ||||||
| [dev-dependencies] | [dev-dependencies] | ||||||
| approx = "0.5" | approx = "0.5" | ||||||
| # Supply rngs for examples and tests | # Supply rngs for examples and tests | ||||||
| @ -31,7 +33,7 @@ glam = { version = "0.27", features = ["approx"] } | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| [features] | [features] | ||||||
| default = ["rand"] | default = ["rand", "bevy_reflect"] | ||||||
| serialize = ["dep:serde", "glam/serde"] | serialize = ["dep:serde", "glam/serde"] | ||||||
| # Enable approx for glam types to approximate floating point equality comparisons and assertions | # Enable approx for glam types to approximate floating point equality comparisons and assertions | ||||||
| approx = ["dep:approx", "glam/approx"] | approx = ["dep:approx", "glam/approx"] | ||||||
|  | |||||||
| @ -6,6 +6,9 @@ use crate::{Vec2, VectorSpace}; | |||||||
| 
 | 
 | ||||||
| use thiserror::Error; | use thiserror::Error; | ||||||
| 
 | 
 | ||||||
|  | #[cfg(feature = "bevy_reflect")] | ||||||
|  | use bevy_reflect::{std_traits::ReflectDefault, Reflect}; | ||||||
|  | 
 | ||||||
| /// A spline composed of a single cubic Bezier curve.
 | /// A spline composed of a single cubic Bezier curve.
 | ||||||
| ///
 | ///
 | ||||||
| /// Useful for user-drawn curves with local control, or animation easing. See
 | /// Useful for user-drawn curves with local control, or animation easing. See
 | ||||||
| @ -41,6 +44,7 @@ use thiserror::Error; | |||||||
| /// let positions: Vec<_> = bezier.iter_positions(100).collect();
 | /// let positions: Vec<_> = bezier.iter_positions(100).collect();
 | ||||||
| /// ```
 | /// ```
 | ||||||
| #[derive(Clone, Debug)] | #[derive(Clone, Debug)] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] | ||||||
| pub struct CubicBezier<P: VectorSpace> { | pub struct CubicBezier<P: VectorSpace> { | ||||||
|     /// The control points of the Bezier curve
 |     /// The control points of the Bezier curve
 | ||||||
|     pub control_points: Vec<[P; 4]>, |     pub control_points: Vec<[P; 4]>, | ||||||
| @ -114,6 +118,7 @@ impl<P: VectorSpace> CubicGenerator<P> for CubicBezier<P> { | |||||||
| /// let positions: Vec<_> = hermite.iter_positions(100).collect();
 | /// let positions: Vec<_> = hermite.iter_positions(100).collect();
 | ||||||
| /// ```
 | /// ```
 | ||||||
| #[derive(Clone, Debug)] | #[derive(Clone, Debug)] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] | ||||||
| pub struct CubicHermite<P: VectorSpace> { | pub struct CubicHermite<P: VectorSpace> { | ||||||
|     /// The control points of the Hermite curve
 |     /// The control points of the Hermite curve
 | ||||||
|     pub control_points: Vec<(P, P)>, |     pub control_points: Vec<(P, P)>, | ||||||
| @ -182,6 +187,7 @@ impl<P: VectorSpace> CubicGenerator<P> for CubicHermite<P> { | |||||||
| /// let positions: Vec<_> = cardinal.iter_positions(100).collect();
 | /// let positions: Vec<_> = cardinal.iter_positions(100).collect();
 | ||||||
| /// ```
 | /// ```
 | ||||||
| #[derive(Clone, Debug)] | #[derive(Clone, Debug)] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] | ||||||
| pub struct CubicCardinalSpline<P: VectorSpace> { | pub struct CubicCardinalSpline<P: VectorSpace> { | ||||||
|     /// Tension
 |     /// Tension
 | ||||||
|     pub tension: f32, |     pub tension: f32, | ||||||
| @ -272,6 +278,7 @@ impl<P: VectorSpace> CubicGenerator<P> for CubicCardinalSpline<P> { | |||||||
| /// let positions: Vec<_> = b_spline.iter_positions(100).collect();
 | /// let positions: Vec<_> = b_spline.iter_positions(100).collect();
 | ||||||
| /// ```
 | /// ```
 | ||||||
| #[derive(Clone, Debug)] | #[derive(Clone, Debug)] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] | ||||||
| pub struct CubicBSpline<P: VectorSpace> { | pub struct CubicBSpline<P: VectorSpace> { | ||||||
|     /// The control points of the spline
 |     /// The control points of the spline
 | ||||||
|     pub control_points: Vec<P>, |     pub control_points: Vec<P>, | ||||||
| @ -391,6 +398,7 @@ pub enum CubicNurbsError { | |||||||
| /// let positions: Vec<_> = nurbs.iter_positions(100).collect();
 | /// let positions: Vec<_> = nurbs.iter_positions(100).collect();
 | ||||||
| /// ```
 | /// ```
 | ||||||
| #[derive(Clone, Debug)] | #[derive(Clone, Debug)] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] | ||||||
| pub struct CubicNurbs<P: VectorSpace> { | pub struct CubicNurbs<P: VectorSpace> { | ||||||
|     /// The control points of the NURBS
 |     /// The control points of the NURBS
 | ||||||
|     pub control_points: Vec<P>, |     pub control_points: Vec<P>, | ||||||
| @ -640,6 +648,7 @@ pub trait CubicGenerator<P: VectorSpace> { | |||||||
| ///
 | ///
 | ||||||
| /// Segments can be chained together to form a longer compound curve.
 | /// Segments can be chained together to form a longer compound curve.
 | ||||||
| #[derive(Copy, Clone, Debug, Default, PartialEq)] | #[derive(Copy, Clone, Debug, Default, PartialEq)] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Default))] | ||||||
| pub struct CubicSegment<P: VectorSpace> { | pub struct CubicSegment<P: VectorSpace> { | ||||||
|     /// Coefficients of the segment
 |     /// Coefficients of the segment
 | ||||||
|     pub coeff: [P; 4], |     pub coeff: [P; 4], | ||||||
| @ -799,6 +808,7 @@ impl CubicSegment<Vec2> { | |||||||
| /// Use any struct that implements the [`CubicGenerator`] trait to create a new curve, such as
 | /// Use any struct that implements the [`CubicGenerator`] trait to create a new curve, such as
 | ||||||
| /// [`CubicBezier`].
 | /// [`CubicBezier`].
 | ||||||
| #[derive(Clone, Debug, PartialEq)] | #[derive(Clone, Debug, PartialEq)] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] | ||||||
| pub struct CubicCurve<P: VectorSpace> { | pub struct CubicCurve<P: VectorSpace> { | ||||||
|     /// Segments of the curve
 |     /// Segments of the curve
 | ||||||
|     pub segments: Vec<CubicSegment<P>>, |     pub segments: Vec<CubicSegment<P>>, | ||||||
| @ -932,6 +942,7 @@ pub trait RationalGenerator<P: VectorSpace> { | |||||||
| ///
 | ///
 | ||||||
| /// Segments can be chained together to form a longer compound curve.
 | /// Segments can be chained together to form a longer compound curve.
 | ||||||
| #[derive(Copy, Clone, Debug, Default, PartialEq)] | #[derive(Copy, Clone, Debug, Default, PartialEq)] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Default))] | ||||||
| pub struct RationalSegment<P: VectorSpace> { | pub struct RationalSegment<P: VectorSpace> { | ||||||
|     /// The coefficients matrix of the cubic curve.
 |     /// The coefficients matrix of the cubic curve.
 | ||||||
|     pub coeff: [P; 4], |     pub coeff: [P; 4], | ||||||
| @ -1059,6 +1070,7 @@ impl<P: VectorSpace> RationalSegment<P> { | |||||||
| /// Use any struct that implements the [`RationalGenerator`] trait to create a new curve, such as
 | /// Use any struct that implements the [`RationalGenerator`] trait to create a new curve, such as
 | ||||||
| /// [`CubicNurbs`], or convert [`CubicCurve`] using `into/from`.
 | /// [`CubicNurbs`], or convert [`CubicCurve`] using `into/from`.
 | ||||||
| #[derive(Clone, Debug, PartialEq)] | #[derive(Clone, Debug, PartialEq)] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] | ||||||
| pub struct RationalCurve<P: VectorSpace> { | pub struct RationalCurve<P: VectorSpace> { | ||||||
|     /// The segments in the curve
 |     /// The segments in the curve
 | ||||||
|     pub segments: Vec<RationalSegment<P>>, |     pub segments: Vec<RationalSegment<P>>, | ||||||
|  | |||||||
| @ -3,6 +3,11 @@ use crate::{ | |||||||
|     Quat, Rotation2d, Vec2, Vec3, Vec3A, |     Quat, Rotation2d, Vec2, Vec3, Vec3A, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | #[cfg(feature = "bevy_reflect")] | ||||||
|  | use bevy_reflect::Reflect; | ||||||
|  | #[cfg(all(feature = "serialize", feature = "bevy_reflect"))] | ||||||
|  | use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; | ||||||
|  | 
 | ||||||
| /// An error indicating that a direction is invalid.
 | /// An error indicating that a direction is invalid.
 | ||||||
| #[derive(Debug, PartialEq)] | #[derive(Debug, PartialEq)] | ||||||
| pub enum InvalidDirectionError { | pub enum InvalidDirectionError { | ||||||
| @ -79,6 +84,11 @@ pub type Direction3d = Dir3; | |||||||
| /// A normalized vector pointing in a direction in 2D space
 | /// A normalized vector pointing in a direction in 2D space
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| #[doc(alias = "Direction2d")] | #[doc(alias = "Direction2d")] | ||||||
| pub struct Dir2(Vec2); | pub struct Dir2(Vec2); | ||||||
| impl Primitive2d for Dir2 {} | impl Primitive2d for Dir2 {} | ||||||
| @ -269,6 +279,11 @@ impl approx::UlpsEq for Dir2 { | |||||||
| /// A normalized vector pointing in a direction in 3D space
 | /// A normalized vector pointing in a direction in 3D space
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| #[doc(alias = "Direction3d")] | #[doc(alias = "Direction3d")] | ||||||
| pub struct Dir3(Vec3); | pub struct Dir3(Vec3); | ||||||
| impl Primitive3d for Dir3 {} | impl Primitive3d for Dir3 {} | ||||||
| @ -470,6 +485,11 @@ impl approx::UlpsEq for Dir3 { | |||||||
| /// This may or may not be faster than [`Dir3`]: make sure to benchmark!
 | /// This may or may not be faster than [`Dir3`]: make sure to benchmark!
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| #[doc(alias = "Direction3dA")] | #[doc(alias = "Direction3dA")] | ||||||
| pub struct Dir3A(Vec3A); | pub struct Dir3A(Vec3A); | ||||||
| impl Primitive3d for Dir3A {} | impl Primitive3d for Dir3A {} | ||||||
|  | |||||||
| @ -3,9 +3,23 @@ use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, PI}; | |||||||
| use super::{Measured2d, Primitive2d, WindingOrder}; | use super::{Measured2d, Primitive2d, WindingOrder}; | ||||||
| use crate::{Dir2, Vec2}; | use crate::{Dir2, Vec2}; | ||||||
| 
 | 
 | ||||||
|  | #[cfg(feature = "bevy_reflect")] | ||||||
|  | use bevy_reflect::{std_traits::ReflectDefault, Reflect}; | ||||||
|  | #[cfg(all(feature = "serialize", feature = "bevy_reflect"))] | ||||||
|  | use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; | ||||||
|  | 
 | ||||||
| /// A circle primitive
 | /// A circle primitive
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Circle { | pub struct Circle { | ||||||
|     /// The radius of the circle
 |     /// The radius of the circle
 | ||||||
|     pub radius: f32, |     pub radius: f32, | ||||||
| @ -703,6 +717,15 @@ mod arc_tests { | |||||||
| /// An ellipse primitive
 | /// An ellipse primitive
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Ellipse { | pub struct Ellipse { | ||||||
|     /// Half of the width and height of the ellipse.
 |     /// Half of the width and height of the ellipse.
 | ||||||
|     ///
 |     ///
 | ||||||
| @ -844,6 +867,15 @@ impl Measured2d for Ellipse { | |||||||
| /// A primitive shape formed by the region between two circles, also known as a ring.
 | /// A primitive shape formed by the region between two circles, also known as a ring.
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| #[doc(alias = "Ring")] | #[doc(alias = "Ring")] | ||||||
| pub struct Annulus { | pub struct Annulus { | ||||||
|     /// The inner circle of the annulus
 |     /// The inner circle of the annulus
 | ||||||
| @ -932,6 +964,15 @@ impl Measured2d for Annulus { | |||||||
| /// A rhombus primitive, also known as a diamond shape.
 | /// A rhombus primitive, also known as a diamond shape.
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| #[doc(alias = "Diamond")] | #[doc(alias = "Diamond")] | ||||||
| pub struct Rhombus { | pub struct Rhombus { | ||||||
|     /// Size of the horizontal and vertical diagonals of the rhombus
 |     /// Size of the horizontal and vertical diagonals of the rhombus
 | ||||||
| @ -1059,6 +1100,15 @@ impl Measured2d for Rhombus { | |||||||
| /// stretching infinitely far
 | /// stretching infinitely far
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Plane2d { | pub struct Plane2d { | ||||||
|     /// The normal of the plane. The plane will be placed perpendicular to this direction
 |     /// The normal of the plane. The plane will be placed perpendicular to this direction
 | ||||||
|     pub normal: Dir2, |     pub normal: Dir2, | ||||||
| @ -1091,6 +1141,11 @@ impl Plane2d { | |||||||
| /// For a finite line: [`Segment2d`]
 | /// For a finite line: [`Segment2d`]
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Line2d { | pub struct Line2d { | ||||||
|     /// The direction of the line. The line extends infinitely in both the given direction
 |     /// The direction of the line. The line extends infinitely in both the given direction
 | ||||||
|     /// and its opposite direction
 |     /// and its opposite direction
 | ||||||
| @ -1101,6 +1156,11 @@ impl Primitive2d for Line2d {} | |||||||
| /// A segment of a line along a direction in 2D space.
 | /// A segment of a line along a direction in 2D space.
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| #[doc(alias = "LineSegment2d")] | #[doc(alias = "LineSegment2d")] | ||||||
| pub struct Segment2d { | pub struct Segment2d { | ||||||
|     /// The direction of the line segment
 |     /// The direction of the line segment
 | ||||||
| @ -1156,6 +1216,7 @@ impl Segment2d { | |||||||
| /// For a version without generics: [`BoxedPolyline2d`]
 | /// For a version without generics: [`BoxedPolyline2d`]
 | ||||||
| #[derive(Clone, Debug, PartialEq)] | #[derive(Clone, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||||||
| pub struct Polyline2d<const N: usize> { | pub struct Polyline2d<const N: usize> { | ||||||
|     /// The vertices of the polyline
 |     /// The vertices of the polyline
 | ||||||
|     #[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))] |     #[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))] | ||||||
| @ -1212,6 +1273,15 @@ impl BoxedPolyline2d { | |||||||
| /// A triangle in 2D space
 | /// A triangle in 2D space
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Triangle2d { | pub struct Triangle2d { | ||||||
|     /// The vertices of the triangle
 |     /// The vertices of the triangle
 | ||||||
|     pub vertices: [Vec2; 3], |     pub vertices: [Vec2; 3], | ||||||
| @ -1374,6 +1444,15 @@ impl Measured2d for Triangle2d { | |||||||
| /// A rectangle primitive
 | /// A rectangle primitive
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| #[doc(alias = "Quad")] | #[doc(alias = "Quad")] | ||||||
| pub struct Rectangle { | pub struct Rectangle { | ||||||
|     /// Half of the width and height of the rectangle
 |     /// Half of the width and height of the rectangle
 | ||||||
| @ -1458,6 +1537,7 @@ impl Measured2d for Rectangle { | |||||||
| /// For a version without generics: [`BoxedPolygon`]
 | /// For a version without generics: [`BoxedPolygon`]
 | ||||||
| #[derive(Clone, Debug, PartialEq)] | #[derive(Clone, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||||||
| pub struct Polygon<const N: usize> { | pub struct Polygon<const N: usize> { | ||||||
|     /// The vertices of the `Polygon`
 |     /// The vertices of the `Polygon`
 | ||||||
|     #[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))] |     #[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))] | ||||||
| @ -1514,6 +1594,15 @@ impl BoxedPolygon { | |||||||
| /// A polygon where all vertices lie on a circle, equally far apart.
 | /// A polygon where all vertices lie on a circle, equally far apart.
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct RegularPolygon { | pub struct RegularPolygon { | ||||||
|     /// The circumcircle on which all vertices lie
 |     /// The circumcircle on which all vertices lie
 | ||||||
|     pub circumcircle: Circle, |     pub circumcircle: Circle, | ||||||
| @ -1651,6 +1740,15 @@ impl Measured2d for RegularPolygon { | |||||||
| /// A two-dimensional capsule is defined as a neighborhood of points at a distance (radius) from a line
 | /// A two-dimensional capsule is defined as a neighborhood of points at a distance (radius) from a line
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| #[doc(alias = "stadium", alias = "pill")] | #[doc(alias = "stadium", alias = "pill")] | ||||||
| pub struct Capsule2d { | pub struct Capsule2d { | ||||||
|     /// The radius of the capsule
 |     /// The radius of the capsule
 | ||||||
|  | |||||||
| @ -3,9 +3,23 @@ use std::f32::consts::{FRAC_PI_3, PI}; | |||||||
| use super::{Circle, Measured2d, Measured3d, Primitive2d, Primitive3d}; | use super::{Circle, Measured2d, Measured3d, Primitive2d, Primitive3d}; | ||||||
| use crate::{Dir3, InvalidDirectionError, Mat3, Vec2, Vec3}; | use crate::{Dir3, InvalidDirectionError, Mat3, Vec2, Vec3}; | ||||||
| 
 | 
 | ||||||
|  | #[cfg(feature = "bevy_reflect")] | ||||||
|  | use bevy_reflect::{std_traits::ReflectDefault, Reflect}; | ||||||
|  | #[cfg(all(feature = "serialize", feature = "bevy_reflect"))] | ||||||
|  | use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; | ||||||
|  | 
 | ||||||
| /// A sphere primitive
 | /// A sphere primitive
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Sphere { | pub struct Sphere { | ||||||
|     /// The radius of the sphere
 |     /// The radius of the sphere
 | ||||||
|     pub radius: f32, |     pub radius: f32, | ||||||
| @ -69,6 +83,15 @@ impl Measured3d for Sphere { | |||||||
| /// A bounded plane in 3D space. It forms a surface starting from the origin with a defined height and width.
 | /// A bounded plane in 3D space. It forms a surface starting from the origin with a defined height and width.
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Plane3d { | pub struct Plane3d { | ||||||
|     /// The normal of the plane. The plane will be placed perpendicular to this direction
 |     /// The normal of the plane. The plane will be placed perpendicular to this direction
 | ||||||
|     pub normal: Dir3, |     pub normal: Dir3, | ||||||
| @ -132,6 +155,15 @@ impl Plane3d { | |||||||
| /// stretching infinitely far
 | /// stretching infinitely far
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct InfinitePlane3d { | pub struct InfinitePlane3d { | ||||||
|     /// The normal of the plane. The plane will be placed perpendicular to this direction
 |     /// The normal of the plane. The plane will be placed perpendicular to this direction
 | ||||||
|     pub normal: Dir3, |     pub normal: Dir3, | ||||||
| @ -189,6 +221,11 @@ impl InfinitePlane3d { | |||||||
| /// For a finite line: [`Segment3d`]
 | /// For a finite line: [`Segment3d`]
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Line3d { | pub struct Line3d { | ||||||
|     /// The direction of the line
 |     /// The direction of the line
 | ||||||
|     pub direction: Dir3, |     pub direction: Dir3, | ||||||
| @ -199,6 +236,11 @@ impl Primitive3d for Line3d {} | |||||||
| #[doc(alias = "LineSegment3d")] | #[doc(alias = "LineSegment3d")] | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Segment3d { | pub struct Segment3d { | ||||||
|     /// The direction of the line
 |     /// The direction of the line
 | ||||||
|     pub direction: Dir3, |     pub direction: Dir3, | ||||||
| @ -253,6 +295,7 @@ impl Segment3d { | |||||||
| /// For a version without generics: [`BoxedPolyline3d`]
 | /// For a version without generics: [`BoxedPolyline3d`]
 | ||||||
| #[derive(Clone, Debug, PartialEq)] | #[derive(Clone, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||||||
| pub struct Polyline3d<const N: usize> { | pub struct Polyline3d<const N: usize> { | ||||||
|     /// The vertices of the polyline
 |     /// The vertices of the polyline
 | ||||||
|     #[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))] |     #[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))] | ||||||
| @ -309,6 +352,15 @@ impl BoxedPolyline3d { | |||||||
| /// A cuboid primitive, more commonly known as a box.
 | /// A cuboid primitive, more commonly known as a box.
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Cuboid { | pub struct Cuboid { | ||||||
|     /// Half of the width, height and depth of the cuboid
 |     /// Half of the width, height and depth of the cuboid
 | ||||||
|     pub half_size: Vec3, |     pub half_size: Vec3, | ||||||
| @ -392,6 +444,15 @@ impl Measured3d for Cuboid { | |||||||
| /// A cylinder primitive
 | /// A cylinder primitive
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Cylinder { | pub struct Cylinder { | ||||||
|     /// The radius of the cylinder
 |     /// The radius of the cylinder
 | ||||||
|     pub radius: f32, |     pub radius: f32, | ||||||
| @ -461,6 +522,15 @@ impl Measured3d for Cylinder { | |||||||
| /// A three-dimensional capsule is defined as a surface at a distance (radius) from a line
 | /// A three-dimensional capsule is defined as a surface at a distance (radius) from a line
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Capsule3d { | pub struct Capsule3d { | ||||||
|     /// The radius of the capsule
 |     /// The radius of the capsule
 | ||||||
|     pub radius: f32, |     pub radius: f32, | ||||||
| @ -520,6 +590,15 @@ impl Measured3d for Capsule3d { | |||||||
| /// A cone primitive.
 | /// A cone primitive.
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Cone { | pub struct Cone { | ||||||
|     /// The radius of the base
 |     /// The radius of the base
 | ||||||
|     pub radius: f32, |     pub radius: f32, | ||||||
| @ -589,6 +668,15 @@ impl Measured3d for Cone { | |||||||
| /// by slicing off a section of a cone.
 | /// by slicing off a section of a cone.
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct ConicalFrustum { | pub struct ConicalFrustum { | ||||||
|     /// The radius of the top of the frustum
 |     /// The radius of the top of the frustum
 | ||||||
|     pub radius_top: f32, |     pub radius_top: f32, | ||||||
| @ -631,6 +719,15 @@ pub enum TorusKind { | |||||||
| /// A torus primitive, often representing a ring or donut shape
 | /// A torus primitive, often representing a ring or donut shape
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Torus { | pub struct Torus { | ||||||
|     /// The radius of the tube of the torus
 |     /// The radius of the tube of the torus
 | ||||||
|     #[doc(
 |     #[doc(
 | ||||||
| @ -733,6 +830,15 @@ impl Measured3d for Torus { | |||||||
| /// A 3D triangle primitive.
 | /// A 3D triangle primitive.
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Triangle3d { | pub struct Triangle3d { | ||||||
|     /// The vertices of the triangle.
 |     /// The vertices of the triangle.
 | ||||||
|     pub vertices: [Vec3; 3], |     pub vertices: [Vec3; 3], | ||||||
| @ -917,6 +1023,15 @@ impl Measured2d for Triangle3d { | |||||||
| /// A tetrahedron primitive.
 | /// A tetrahedron primitive.
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Tetrahedron { | pub struct Tetrahedron { | ||||||
|     /// The vertices of the tetrahedron.
 |     /// The vertices of the tetrahedron.
 | ||||||
|     pub vertices: [Vec3; 4], |     pub vertices: [Vec3; 4], | ||||||
|  | |||||||
| @ -1,5 +1,10 @@ | |||||||
| use crate::{IVec2, Rect, URect}; | use crate::{IVec2, Rect, URect}; | ||||||
| 
 | 
 | ||||||
|  | #[cfg(feature = "bevy_reflect")] | ||||||
|  | use bevy_reflect::{std_traits::ReflectDefault, Reflect}; | ||||||
|  | #[cfg(all(feature = "serialize", feature = "bevy_reflect"))] | ||||||
|  | use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; | ||||||
|  | 
 | ||||||
| /// A rectangle defined by two opposite corners.
 | /// A rectangle defined by two opposite corners.
 | ||||||
| ///
 | ///
 | ||||||
| /// The rectangle is axis aligned, and defined by its minimum and maximum coordinates,
 | /// The rectangle is axis aligned, and defined by its minimum and maximum coordinates,
 | ||||||
| @ -11,6 +16,15 @@ use crate::{IVec2, Rect, URect}; | |||||||
| #[repr(C)] | #[repr(C)] | ||||||
| #[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash)] | #[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Hash, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct IRect { | pub struct IRect { | ||||||
|     /// The minimum corner point of the rect.
 |     /// The minimum corner point of the rect.
 | ||||||
|     pub min: IVec2, |     pub min: IVec2, | ||||||
|  | |||||||
| @ -1,5 +1,10 @@ | |||||||
| use crate::{IRect, URect, Vec2}; | use crate::{IRect, URect, Vec2}; | ||||||
| 
 | 
 | ||||||
|  | #[cfg(feature = "bevy_reflect")] | ||||||
|  | use bevy_reflect::{std_traits::ReflectDefault, Reflect}; | ||||||
|  | #[cfg(all(feature = "serialize", feature = "bevy_reflect"))] | ||||||
|  | use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; | ||||||
|  | 
 | ||||||
| /// A rectangle defined by two opposite corners.
 | /// A rectangle defined by two opposite corners.
 | ||||||
| ///
 | ///
 | ||||||
| /// The rectangle is axis aligned, and defined by its minimum and maximum coordinates,
 | /// The rectangle is axis aligned, and defined by its minimum and maximum coordinates,
 | ||||||
| @ -11,6 +16,15 @@ use crate::{IRect, URect, Vec2}; | |||||||
| #[repr(C)] | #[repr(C)] | ||||||
| #[derive(Default, Clone, Copy, Debug, PartialEq)] | #[derive(Default, Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Rect { | pub struct Rect { | ||||||
|     /// The minimum corner point of the rect.
 |     /// The minimum corner point of the rect.
 | ||||||
|     pub min: Vec2, |     pub min: Vec2, | ||||||
|  | |||||||
| @ -1,5 +1,10 @@ | |||||||
| use crate::{IRect, Rect, UVec2}; | use crate::{IRect, Rect, UVec2}; | ||||||
| 
 | 
 | ||||||
|  | #[cfg(feature = "bevy_reflect")] | ||||||
|  | use bevy_reflect::{std_traits::ReflectDefault, Reflect}; | ||||||
|  | #[cfg(all(feature = "serialize", feature = "bevy_reflect"))] | ||||||
|  | use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; | ||||||
|  | 
 | ||||||
| /// A rectangle defined by two opposite corners.
 | /// A rectangle defined by two opposite corners.
 | ||||||
| ///
 | ///
 | ||||||
| /// The rectangle is axis aligned, and defined by its minimum and maximum coordinates,
 | /// The rectangle is axis aligned, and defined by its minimum and maximum coordinates,
 | ||||||
| @ -11,6 +16,15 @@ use crate::{IRect, Rect, UVec2}; | |||||||
| #[repr(C)] | #[repr(C)] | ||||||
| #[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash)] | #[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Hash, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct URect { | pub struct URect { | ||||||
|     /// The minimum corner point of the rect.
 |     /// The minimum corner point of the rect.
 | ||||||
|     pub min: UVec2, |     pub min: UVec2, | ||||||
|  | |||||||
| @ -2,6 +2,11 @@ use glam::FloatExt; | |||||||
| 
 | 
 | ||||||
| use crate::prelude::{Mat2, Vec2}; | use crate::prelude::{Mat2, Vec2}; | ||||||
| 
 | 
 | ||||||
|  | #[cfg(feature = "bevy_reflect")] | ||||||
|  | use bevy_reflect::{std_traits::ReflectDefault, Reflect}; | ||||||
|  | #[cfg(all(feature = "serialize", feature = "bevy_reflect"))] | ||||||
|  | use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; | ||||||
|  | 
 | ||||||
| /// A counterclockwise 2D rotation in radians.
 | /// A counterclockwise 2D rotation in radians.
 | ||||||
| ///
 | ///
 | ||||||
| /// The rotation angle is wrapped to be within the `(-pi, pi]` range.
 | /// The rotation angle is wrapped to be within the `(-pi, pi]` range.
 | ||||||
| @ -29,6 +34,15 @@ use crate::prelude::{Mat2, Vec2}; | |||||||
| /// ```
 | /// ```
 | ||||||
| #[derive(Clone, Copy, Debug, PartialEq)] | #[derive(Clone, Copy, Debug, PartialEq)] | ||||||
| #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     feature = "bevy_reflect", | ||||||
|  |     derive(Reflect), | ||||||
|  |     reflect(Debug, PartialEq, Default) | ||||||
|  | )] | ||||||
|  | #[cfg_attr(
 | ||||||
|  |     all(feature = "serialize", feature = "bevy_reflect"), | ||||||
|  |     reflect(Serialize, Deserialize) | ||||||
|  | )] | ||||||
| pub struct Rotation2d { | pub struct Rotation2d { | ||||||
|     /// The cosine of the rotation angle in radians.
 |     /// The cosine of the rotation angle in radians.
 | ||||||
|     ///
 |     ///
 | ||||||
|  | |||||||
| @ -12,9 +12,8 @@ rust-version = "1.76.0" | |||||||
| [features] | [features] | ||||||
| default = ["smallvec"] | default = ["smallvec"] | ||||||
| # When enabled, provides Bevy-related reflection implementations | # When enabled, provides Bevy-related reflection implementations | ||||||
| bevy = ["smallvec", "bevy_math", "smol_str"] | bevy = ["smallvec", "smol_str"] | ||||||
| glam = ["dep:glam"] | glam = ["dep:glam"] | ||||||
| bevy_math = ["glam", "dep:bevy_math"] |  | ||||||
| petgraph = ["dep:petgraph"] | petgraph = ["dep:petgraph"] | ||||||
| smallvec = ["dep:smallvec"] | smallvec = ["dep:smallvec"] | ||||||
| uuid = ["dep:uuid"] | uuid = ["dep:uuid"] | ||||||
| @ -23,9 +22,6 @@ documentation = ["bevy_reflect_derive/documentation"] | |||||||
| 
 | 
 | ||||||
| [dependencies] | [dependencies] | ||||||
| # bevy | # bevy | ||||||
| bevy_math = { path = "../bevy_math", version = "0.14.0-dev", features = [ |  | ||||||
|   "serialize", |  | ||||||
| ], optional = true } |  | ||||||
| bevy_reflect_derive = { path = "derive", version = "0.14.0-dev" } | bevy_reflect_derive = { path = "derive", version = "0.14.0-dev" } | ||||||
| bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" } | bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" } | ||||||
| bevy_ptr = { path = "../bevy_ptr", version = "0.14.0-dev" } | bevy_ptr = { path = "../bevy_ptr", version = "0.14.0-dev" } | ||||||
|  | |||||||
| @ -1,89 +0,0 @@ | |||||||
| 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>>, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| @ -1,7 +0,0 @@ | |||||||
| use crate as bevy_reflect; |  | ||||||
| use crate::{ReflectDeserialize, ReflectSerialize}; |  | ||||||
| use bevy_reflect_derive::impl_reflect_value; |  | ||||||
| 
 |  | ||||||
| impl_reflect_value!(::bevy_math::Dir2(Debug, PartialEq, Serialize, Deserialize)); |  | ||||||
| impl_reflect_value!(::bevy_math::Dir3(Debug, PartialEq, Serialize, Deserialize)); |  | ||||||
| impl_reflect_value!(::bevy_math::Dir3A(Debug, PartialEq, Serialize, Deserialize)); |  | ||||||
| @ -1,112 +0,0 @@ | |||||||
| use crate as bevy_reflect; |  | ||||||
| use crate::{ReflectDeserialize, ReflectSerialize}; |  | ||||||
| use bevy_math::{primitives::*, Dir2, Vec2}; |  | ||||||
| use bevy_reflect_derive::impl_reflect; |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Circle { |  | ||||||
|         radius: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Ellipse { |  | ||||||
|         half_size: Vec2, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Annulus { |  | ||||||
|         inner_circle: Circle, |  | ||||||
|         outer_circle: Circle, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Rhombus { |  | ||||||
|         half_diagonals: Vec2, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Plane2d { |  | ||||||
|         normal: Dir2, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Line2d { |  | ||||||
|         direction: Dir2, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Segment2d { |  | ||||||
|         direction: Dir2, |  | ||||||
|         half_length: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Polyline2d<const N: usize> { |  | ||||||
|         vertices: [Vec2; N], |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Triangle2d { |  | ||||||
|         vertices: [Vec2; 3], |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Rectangle { |  | ||||||
|         half_size: Vec2, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Polygon<const N: usize> { |  | ||||||
|         vertices: [Vec2; N], |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct RegularPolygon { |  | ||||||
|         circumcircle: Circle, |  | ||||||
|         sides: usize, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Capsule2d { |  | ||||||
|         radius: f32, |  | ||||||
|         half_length: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| @ -1,124 +0,0 @@ | |||||||
| use crate as bevy_reflect; |  | ||||||
| use crate::{ReflectDeserialize, ReflectSerialize}; |  | ||||||
| use bevy_math::{primitives::*, Dir3, Vec2, Vec3}; |  | ||||||
| use bevy_reflect_derive::impl_reflect; |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Sphere { |  | ||||||
|         radius: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Plane3d { |  | ||||||
|         normal: Dir3, |  | ||||||
|         half_size: Vec2, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct InfinitePlane3d { |  | ||||||
|         normal: Dir3, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Line3d { |  | ||||||
|         direction: Dir3, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Segment3d { |  | ||||||
|         direction: Dir3, |  | ||||||
|         half_length: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Polyline3d<const N: usize> { |  | ||||||
|         vertices: [Vec3; N], |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Triangle3d { |  | ||||||
|         vertices: [Vec3; 3], |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Cuboid { |  | ||||||
|         half_size: Vec3, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Cylinder { |  | ||||||
|         radius: f32, |  | ||||||
|         half_height: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Capsule3d { |  | ||||||
|         radius: f32, |  | ||||||
|         half_length: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Cone { |  | ||||||
|         radius: f32, |  | ||||||
|         height: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct ConicalFrustum { |  | ||||||
|         radius_top: f32, |  | ||||||
|         radius_bottom: f32, |  | ||||||
|         height: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Torus { |  | ||||||
|         minor_radius: f32, |  | ||||||
|         major_radius: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math::primitives"] |  | ||||||
|     struct Tetrahedron { |  | ||||||
|         vertices: [Vec3; 4], |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| @ -1,32 +0,0 @@ | |||||||
| use crate as bevy_reflect; |  | ||||||
| use crate::prelude::ReflectDefault; |  | ||||||
| use crate::{ReflectDeserialize, ReflectSerialize}; |  | ||||||
| use bevy_math::{IRect, IVec2, Rect, URect, UVec2, Vec2}; |  | ||||||
| use bevy_reflect_derive::impl_reflect; |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Hash, Serialize, Deserialize, Default)] |  | ||||||
|     #[type_path = "bevy_math"] |  | ||||||
|     struct IRect { |  | ||||||
|         min: IVec2, |  | ||||||
|         max: IVec2, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize, Default)] |  | ||||||
|     #[type_path = "bevy_math"] |  | ||||||
|     struct Rect { |  | ||||||
|         min: Vec2, |  | ||||||
|         max: Vec2, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Hash, Serialize, Deserialize, Default)] |  | ||||||
|     #[type_path = "bevy_math"] |  | ||||||
|     struct URect { |  | ||||||
|         min: UVec2, |  | ||||||
|         max: UVec2, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| @ -1,13 +0,0 @@ | |||||||
| use crate as bevy_reflect; |  | ||||||
| use crate::{ReflectDeserialize, ReflectSerialize}; |  | ||||||
| use bevy_math::Rotation2d; |  | ||||||
| use bevy_reflect_derive::impl_reflect; |  | ||||||
| 
 |  | ||||||
| impl_reflect!( |  | ||||||
|     #[reflect(Debug, PartialEq, Serialize, Deserialize)] |  | ||||||
|     #[type_path = "bevy_math"] |  | ||||||
|     struct Rotation2d { |  | ||||||
|         cos: f32, |  | ||||||
|         sin: f32, |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
| @ -490,16 +490,6 @@ mod type_registry; | |||||||
| mod impls { | mod impls { | ||||||
|     #[cfg(feature = "glam")] |     #[cfg(feature = "glam")] | ||||||
|     mod glam; |     mod glam; | ||||||
| 
 |  | ||||||
|     #[cfg(feature = "bevy_math")] |  | ||||||
|     mod math { |  | ||||||
|         mod cubic_splines; |  | ||||||
|         mod direction; |  | ||||||
|         mod primitives2d; |  | ||||||
|         mod primitives3d; |  | ||||||
|         mod rect; |  | ||||||
|         mod rotation2d; |  | ||||||
|     } |  | ||||||
|     #[cfg(feature = "petgraph")] |     #[cfg(feature = "petgraph")] | ||||||
|     mod petgraph; |     mod petgraph; | ||||||
|     #[cfg(feature = "smallvec")] |     #[cfg(feature = "smallvec")] | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Olle Lukowski
						Olle Lukowski