add Debug, Copy, Clone for all shapes (#1653)
This commit is contained in:
parent
ac661188c8
commit
f6ff80c5b1
@ -5,6 +5,7 @@ use crate::{
|
||||
use bevy_math::{Vec2, Vec3};
|
||||
|
||||
/// A cylinder with hemispheres at the top and bottom
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct Capsule {
|
||||
/// Radius on the xz plane.
|
||||
pub radius: f32,
|
||||
@ -32,7 +33,7 @@ impl Default for Capsule {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
/// Manner in which UV coordinates are distributed vertically.
|
||||
pub enum CapsuleUvProfile {
|
||||
/// UV space is distributed by how much of the capsule consists of the hemispheres.
|
||||
|
||||
@ -6,7 +6,7 @@ use crate::{
|
||||
};
|
||||
|
||||
/// A sphere made from a subdivided Icosahedron.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Icosphere {
|
||||
/// The radius of the sphere.
|
||||
pub radius: f32,
|
||||
|
||||
@ -2,6 +2,7 @@ use super::{Indices, Mesh};
|
||||
use crate::pipeline::PrimitiveTopology;
|
||||
use bevy_math::*;
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct Cube {
|
||||
pub size: f32,
|
||||
}
|
||||
@ -24,6 +25,7 @@ impl From<Cube> for Mesh {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct Box {
|
||||
pub min_x: f32,
|
||||
pub max_x: f32,
|
||||
@ -118,7 +120,7 @@ impl From<Box> for Mesh {
|
||||
}
|
||||
|
||||
/// A rectangle on the XY plane.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct Quad {
|
||||
/// Full width and height of the rectangle.
|
||||
pub size: Vec2,
|
||||
@ -126,6 +128,12 @@ pub struct Quad {
|
||||
pub flip: bool,
|
||||
}
|
||||
|
||||
impl Default for Quad {
|
||||
fn default() -> Self {
|
||||
Quad::new(Vec2::ONE)
|
||||
}
|
||||
}
|
||||
|
||||
impl Quad {
|
||||
pub fn new(size: Vec2) -> Self {
|
||||
Self { size, flip: false }
|
||||
@ -214,12 +222,18 @@ impl From<Quad> for Mesh {
|
||||
}
|
||||
|
||||
/// A square on the XZ plane.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct Plane {
|
||||
/// The total side length of the square.
|
||||
pub size: f32,
|
||||
}
|
||||
|
||||
impl Default for Plane {
|
||||
fn default() -> Self {
|
||||
Plane { size: 1.0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Plane> for Mesh {
|
||||
fn from(plane: Plane) -> Self {
|
||||
let extent = plane.size / 2.0;
|
||||
|
||||
@ -5,7 +5,7 @@ use crate::{
|
||||
use bevy_math::Vec3;
|
||||
|
||||
/// A torus (donut) shape.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Torus {
|
||||
pub radius: f32,
|
||||
pub ring_radius: f32,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user