@@ -29,7 +29,7 @@ pub trait GizmoPrimitive3d<P: Primitive3d> {
29
29
primitive : P ,
30
30
position : Vec3 ,
31
31
rotation : Quat ,
32
- color : Color ,
32
+ color : impl Into < Color > ,
33
33
) -> Self :: Output < ' _ > ;
34
34
}
35
35
@@ -43,7 +43,7 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Dir3> for Gizmos<'w, 's, T> {
43
43
primitive : Dir3 ,
44
44
position : Vec3 ,
45
45
rotation : Quat ,
46
- color : Color ,
46
+ color : impl Into < Color > ,
47
47
) -> Self :: Output < ' _ > {
48
48
self . arrow ( position, position + ( rotation * * primitive) , color) ;
49
49
}
@@ -85,14 +85,14 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Sphere> for Gizmos<'w, 's, T>
85
85
primitive : Sphere ,
86
86
position : Vec3 ,
87
87
rotation : Quat ,
88
- color : Color ,
88
+ color : impl Into < Color > ,
89
89
) -> Self :: Output < ' _ > {
90
90
SphereBuilder {
91
91
gizmos : self ,
92
92
radius : primitive. radius ,
93
93
position,
94
94
rotation,
95
- color,
95
+ color : color . into ( ) ,
96
96
segments : DEFAULT_NUMBER_SEGMENTS ,
97
97
}
98
98
}
@@ -184,14 +184,14 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Plane3d> for Gizmos<'w, 's, T
184
184
primitive : Plane3d ,
185
185
position : Vec3 ,
186
186
rotation : Quat ,
187
- color : Color ,
187
+ color : impl Into < Color > ,
188
188
) -> Self :: Output < ' _ > {
189
189
Plane3dBuilder {
190
190
gizmos : self ,
191
191
normal : primitive. normal ,
192
192
rotation,
193
193
position,
194
- color,
194
+ color : color . into ( ) ,
195
195
axis_count : 4 ,
196
196
segment_count : 3 ,
197
197
segment_length : 0.25 ,
@@ -251,12 +251,13 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Line3d> for Gizmos<'w, 's, T>
251
251
primitive : Line3d ,
252
252
position : Vec3 ,
253
253
rotation : Quat ,
254
- color : Color ,
254
+ color : impl Into < Color > ,
255
255
) -> Self :: Output < ' _ > {
256
256
if !self . enabled {
257
257
return ;
258
258
}
259
259
260
+ let color = color. into ( ) ;
260
261
let direction = rotation * * primitive. direction ;
261
262
self . arrow ( position, position + direction, color) ;
262
263
@@ -278,7 +279,7 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Segment3d> for Gizmos<'w, 's,
278
279
primitive : Segment3d ,
279
280
position : Vec3 ,
280
281
rotation : Quat ,
281
- color : Color ,
282
+ color : impl Into < Color > ,
282
283
) -> Self :: Output < ' _ > {
283
284
if !self . enabled {
284
285
return ;
@@ -303,7 +304,7 @@ impl<'w, 's, const N: usize, T: GizmoConfigGroup> GizmoPrimitive3d<Polyline3d<N>
303
304
primitive : Polyline3d < N > ,
304
305
position : Vec3 ,
305
306
rotation : Quat ,
306
- color : Color ,
307
+ color : impl Into < Color > ,
307
308
) -> Self :: Output < ' _ > {
308
309
if !self . enabled {
309
310
return ;
@@ -328,7 +329,7 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<BoxedPolyline3d> for Gizmos<'
328
329
primitive : BoxedPolyline3d ,
329
330
position : Vec3 ,
330
331
rotation : Quat ,
331
- color : Color ,
332
+ color : impl Into < Color > ,
332
333
) -> Self :: Output < ' _ > {
333
334
if !self . enabled {
334
335
return ;
@@ -355,7 +356,7 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Cuboid> for Gizmos<'w, 's, T>
355
356
primitive : Cuboid ,
356
357
position : Vec3 ,
357
358
rotation : Quat ,
358
- color : Color ,
359
+ color : impl Into < Color > ,
359
360
) -> Self :: Output < ' _ > {
360
361
if !self . enabled {
361
362
return ;
@@ -390,6 +391,7 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Cuboid> for Gizmos<'w, 's, T>
390
391
// lines connecting upper and lower rectangles of the cuboid
391
392
let connections = vertices. into_iter ( ) . zip ( vertices. into_iter ( ) . skip ( 4 ) ) ;
392
393
394
+ let color = color. into ( ) ;
393
395
upper
394
396
. chain ( lower)
395
397
. chain ( connections)
@@ -439,15 +441,15 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Cylinder> for Gizmos<'w, 's,
439
441
primitive : Cylinder ,
440
442
position : Vec3 ,
441
443
rotation : Quat ,
442
- color : Color ,
444
+ color : impl Into < Color > ,
443
445
) -> Self :: Output < ' _ > {
444
446
Cylinder3dBuilder {
445
447
gizmos : self ,
446
448
radius : primitive. radius ,
447
449
half_height : primitive. half_height ,
448
450
position,
449
451
rotation,
450
- color,
452
+ color : color . into ( ) ,
451
453
segments : DEFAULT_NUMBER_SEGMENTS ,
452
454
}
453
455
}
@@ -536,15 +538,15 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Capsule3d> for Gizmos<'w, 's,
536
538
primitive : Capsule3d ,
537
539
position : Vec3 ,
538
540
rotation : Quat ,
539
- color : Color ,
541
+ color : impl Into < Color > ,
540
542
) -> Self :: Output < ' _ > {
541
543
Capsule3dBuilder {
542
544
gizmos : self ,
543
545
radius : primitive. radius ,
544
546
half_length : primitive. half_length ,
545
547
position,
546
548
rotation,
547
- color,
549
+ color : color . into ( ) ,
548
550
segments : DEFAULT_NUMBER_SEGMENTS ,
549
551
}
550
552
}
@@ -651,15 +653,15 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Cone> for Gizmos<'w, 's, T> {
651
653
primitive : Cone ,
652
654
position : Vec3 ,
653
655
rotation : Quat ,
654
- color : Color ,
656
+ color : impl Into < Color > ,
655
657
) -> Self :: Output < ' _ > {
656
658
Cone3dBuilder {
657
659
gizmos : self ,
658
660
radius : primitive. radius ,
659
661
height : primitive. height ,
660
662
position,
661
663
rotation,
662
- color,
664
+ color : color . into ( ) ,
663
665
base_segments : DEFAULT_NUMBER_SEGMENTS ,
664
666
height_segments : DEFAULT_NUMBER_SEGMENTS ,
665
667
}
@@ -749,7 +751,7 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<ConicalFrustum> for Gizmos<'w
749
751
primitive : ConicalFrustum ,
750
752
position : Vec3 ,
751
753
rotation : Quat ,
752
- color : Color ,
754
+ color : impl Into < Color > ,
753
755
) -> Self :: Output < ' _ > {
754
756
ConicalFrustum3dBuilder {
755
757
gizmos : self ,
@@ -758,7 +760,7 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<ConicalFrustum> for Gizmos<'w
758
760
height : primitive. height ,
759
761
position,
760
762
rotation,
761
- color,
763
+ color : color . into ( ) ,
762
764
segments : DEFAULT_NUMBER_SEGMENTS ,
763
765
}
764
766
}
@@ -861,15 +863,15 @@ impl<'w, 's, T: GizmoConfigGroup> GizmoPrimitive3d<Torus> for Gizmos<'w, 's, T>
861
863
primitive : Torus ,
862
864
position : Vec3 ,
863
865
rotation : Quat ,
864
- color : Color ,
866
+ color : impl Into < Color > ,
865
867
) -> Self :: Output < ' _ > {
866
868
Torus3dBuilder {
867
869
gizmos : self ,
868
870
minor_radius : primitive. minor_radius ,
869
871
major_radius : primitive. major_radius ,
870
872
position,
871
873
rotation,
872
- color,
874
+ color : color . into ( ) ,
873
875
minor_segments : DEFAULT_NUMBER_SEGMENTS ,
874
876
major_segments : DEFAULT_NUMBER_SEGMENTS ,
875
877
}
0 commit comments