@@ -6,7 +6,7 @@ use std::f32::consts::TAU;
6
6
use bevy_color:: Color ;
7
7
use bevy_math:: primitives:: {
8
8
BoxedPolyline3d , Capsule3d , Cone , ConicalFrustum , Cuboid , Cylinder , Line3d , Plane3d ,
9
- Polyline3d , Primitive3d , Segment3d , Sphere , Torus ,
9
+ Polyline3d , Primitive3d , Segment3d , Sphere , Tetrahedron , Torus ,
10
10
} ;
11
11
use bevy_math:: { Dir3 , Quat , Vec3 } ;
12
12
@@ -943,3 +943,32 @@ impl<T: GizmoConfigGroup> Drop for Torus3dBuilder<'_, '_, '_, T> {
943
943
} ) ;
944
944
}
945
945
}
946
+
947
+ // tetrahedron
948
+
949
+ impl < ' w , ' s , T : GizmoConfigGroup > GizmoPrimitive3d < Tetrahedron > for Gizmos < ' w , ' s , T > {
950
+ type Output < ' a > = ( ) where Self : ' a ;
951
+
952
+ fn primitive_3d (
953
+ & mut self ,
954
+ primitive : Tetrahedron ,
955
+ position : Vec3 ,
956
+ rotation : Quat ,
957
+ color : impl Into < Color > ,
958
+ ) -> Self :: Output < ' _ > {
959
+ if !self . enabled {
960
+ return ;
961
+ }
962
+
963
+ let [ a, b, c, d] = primitive
964
+ . vertices
965
+ . map ( rotate_then_translate_3d ( rotation, position) ) ;
966
+
967
+ let lines = [ ( a, b) , ( a, c) , ( a, d) , ( b, c) , ( b, d) , ( c, d) ] ;
968
+
969
+ let color = color. into ( ) ;
970
+ for ( a, b) in lines. into_iter ( ) {
971
+ self . line ( a, b, color) ;
972
+ }
973
+ }
974
+ }
0 commit comments