Skip to content

Commit

Permalink
Implement Copy for all non-mut shape views
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet committed Aug 6, 2023
1 parent ff5326a commit d5140aa
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased
### Added
- `ColliderView::as_typed_shape` and `::to_shared_shape` to convert a `ColliderView` to a parry’s
`TypedShape` or `SharedShape`. The `From` trait has also been implemented accordingly.
- Implement `Copy` for `ColliderView` and all the other non-mut shape views.
- Add `RapierContext::rigid_body_colliders` to retrieve all collider entities attached to this rigid-body.

## 0.22.0 (10 July 2023)
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/ball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::Real;
use rapier::parry::shape::Ball;

/// Read-only access to the properties of a ball.
#[derive(Copy, Clone)]
pub struct BallView<'a> {
/// The raw shape from Rapier.
pub raw: &'a Ball,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/capsule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::math::{Real, Rot, Vect};
use rapier::parry::shape::Capsule;

/// Read-only access to the properties of a capsule.
#[derive(Copy, Clone)]
pub struct CapsuleView<'a> {
/// The raw shape from Rapier.
pub raw: &'a Capsule,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/collider_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use rapier::parry::either::Either;
use rapier::parry::shape::TypedShape;

/// Read-only access to the properties of a collider.
#[derive(Copy, Clone)]
pub enum ColliderView<'a> {
/// A ball shape.
Ball(BallView<'a>),
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/compound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::math::{Rot, Vect};
use rapier::parry::shape::Compound;

/// Read-only access to the properties of a compound shape.
#[derive(Copy, Clone)]
pub struct CompoundView<'a> {
/// The raw shape from Rapier.
pub raw: &'a Compound,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/cone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::Real;
use rapier::parry::shape::Cone;

/// Read-only access to the properties of a cone.
#[derive(Copy, Clone)]
pub struct ConeView<'a> {
/// The raw shape from Rapier.
pub raw: &'a Cone,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/convex_polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::Vect;
use rapier::parry::shape::ConvexPolygon;

/// Read-only access to the properties of a convex polygon.
#[derive(Copy, Clone)]
pub struct ConvexPolygonView<'a> {
/// The raw shape from Rapier.
pub raw: &'a ConvexPolygon,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/convex_polyhedron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::Vect;
use rapier::parry::shape::ConvexPolyhedron;

/// Read-only access to the properties of a convex polyhedron.
#[derive(Copy, Clone)]
pub struct ConvexPolyhedronView<'a> {
/// The raw shape from Rapier.
pub raw: &'a ConvexPolyhedron,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/cuboid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::Vect;
use rapier::geometry::Cuboid;

/// Read-only access to the properties of a cuboid.
#[derive(Copy, Clone)]
pub struct CuboidView<'a> {
/// The raw shape from Rapier.
pub raw: &'a Cuboid,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/cylinder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::Real;
use rapier::parry::shape::Cylinder;

/// Read-only access to the properties of a cylinder.
#[derive(Copy, Clone)]
pub struct CylinderView<'a> {
/// The raw shape from Rapier.
pub raw: &'a Cylinder,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/halfspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::Vect;
use rapier::parry::shape::HalfSpace;

/// Read-only access to the properties of a half-space.
#[derive(Copy, Clone)]
pub struct HalfSpaceView<'a> {
/// The raw shape from Rapier.
pub raw: &'a HalfSpace,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/heightfield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use rapier::parry::shape::HeightField;
pub use rapier::parry::shape::HeightFieldCellStatus;

/// Read-only access to the properties of a heightfield.
#[derive(Copy, Clone)]
pub struct HeightFieldView<'a> {
/// The raw shape from Rapier.
pub raw: &'a HeightField,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/polyline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::Vect;
use rapier::parry::shape::Polyline;

/// Read-only access to the properties of a polyline.
#[derive(Copy, Clone)]
pub struct PolylineView<'a> {
/// The raw shape from Rapier.
pub raw: &'a Polyline,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/round_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use {
macro_rules! round_shape_view(
($RoundShape: ident, $RoundShapeView: ident, $ShapeView: ident, $RoundShapeViewMut: ident, $ShapeViewMut: ident) => {
/// Read-only access to the properties of a round shape.
#[derive(Copy, Clone)]
pub struct $RoundShapeView<'a> {
/// The raw shape from Rapier.
pub raw: &'a $RoundShape,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::{Real, Vect};
use rapier::parry::shape::Segment;

/// Read-only access to the properties of a segment.
#[derive(Copy, Clone)]
pub struct SegmentView<'a> {
/// The raw shape from Rapier.
pub raw: &'a Segment,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::{Real, Vect};
use rapier::parry::shape::Triangle;

/// Read-only access to the properties of a triangle.
#[derive(Copy, Clone)]
pub struct TriangleView<'a> {
/// The raw shape from Rapier.
pub raw: &'a Triangle,
Expand Down
1 change: 1 addition & 0 deletions src/geometry/shape_views/trimesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::math::Vect;
use rapier::parry::shape::{TopologyError, TriMesh, TriMeshFlags};

/// Read-only access to the properties of a triangle mesh.
#[derive(Copy, Clone)]
pub struct TriMeshView<'a> {
/// The raw shape from Rapier.
pub raw: &'a TriMesh,
Expand Down

0 comments on commit d5140aa

Please sign in to comment.