@@ -119,14 +119,32 @@ impl Default for DebugDraw {
119
119
impl DebugDraw {
120
120
/// Draw a line from `start` to `end`.
121
121
pub fn line ( & mut self , start : Vec3 , end : Vec3 , color : Color ) {
122
+ self . line_gradient ( start, end, color, color) ;
123
+ }
124
+
125
+ /// Draw a line from `start` to `end`.
126
+ pub fn line_gradient ( & mut self , start : Vec3 , end : Vec3 , start_color : Color , end_color : Color ) {
122
127
self . positions . extend ( [ start. to_array ( ) , end. to_array ( ) ] ) ;
123
- let color = color. as_linear_rgba_f32 ( ) ;
124
- self . colors . extend ( [ color, color] ) ;
128
+ self . colors . extend ( [
129
+ start_color. as_linear_rgba_f32 ( ) ,
130
+ end_color. as_linear_rgba_f32 ( ) ,
131
+ ] ) ;
125
132
}
126
133
127
134
/// Draw a line from `start` to `start + vector`.
128
135
pub fn ray ( & mut self , start : Vec3 , vector : Vec3 , color : Color ) {
129
- self . line ( start, start + vector, color) ;
136
+ self . ray_gradient ( start, vector, color, color) ;
137
+ }
138
+
139
+ /// Draw a line from `start` to `start + vector`.
140
+ pub fn ray_gradient (
141
+ & mut self ,
142
+ start : Vec3 ,
143
+ vector : Vec3 ,
144
+ start_color : Color ,
145
+ end_color : Color ,
146
+ ) {
147
+ self . line_gradient ( start, start + vector, start_color, end_color) ;
130
148
}
131
149
132
150
/// Draw a circle at `position` with the flat side facing `normal`.
@@ -189,14 +207,20 @@ impl DebugDraw {
189
207
. extend ( std:: iter:: repeat ( color. as_linear_rgba_f32 ( ) ) . take ( 24 ) )
190
208
}
191
209
192
- /// Draw an axis-aligned box .
193
- pub fn aab ( & mut self , position : Vec3 , size : Vec3 , color : Color ) {
194
- self . cuboid ( position , Quat :: IDENTITY , size , color) ;
210
+ /// Draw a line from `start` to `end` .
211
+ pub fn line_2d ( & mut self , start : Vec2 , end : Vec2 , color : Color ) {
212
+ self . line_gradient_2d ( start , end , color , color) ;
195
213
}
196
214
197
215
/// Draw a line from `start` to `end`.
198
- pub fn line_2d ( & mut self , start : Vec2 , end : Vec2 , color : Color ) {
199
- self . line ( start. extend ( 0. ) , end. extend ( 0. ) , color) ;
216
+ pub fn line_gradient_2d (
217
+ & mut self ,
218
+ start : Vec2 ,
219
+ end : Vec2 ,
220
+ start_color : Color ,
221
+ end_color : Color ,
222
+ ) {
223
+ self . line_gradient ( start. extend ( 0. ) , end. extend ( 0. ) , start_color, end_color) ;
200
224
}
201
225
202
226
/// Draw a line from `start` to `start + vector`.
0 commit comments