(&mut self, cx: f64, cy: f64, cz: f64, radius: f64, r: f64, g: f64, b: f64, a: f64)
| 12598 | } |
| 12599 | |
| 12600 | pub fn draw_sphere_wires(&mut self, cx: f64, cy: f64, cz: f64, radius: f64, r: f64, g: f64, b: f64, a: f64) { |
| 12601 | let color = Self::color_to_f32(r, g, b, a); |
| 12602 | let (cx, cy, cz, radius) = (cx as f32, cy as f32, cz as f32, radius as f32); |
| 12603 | let segments = 16u32; |
| 12604 | |
| 12605 | for i in 0..segments { |
| 12606 | let a1 = (i as f32) / (segments as f32) * std::f32::consts::TAU; |
| 12607 | let a2 = ((i + 1) as f32) / (segments as f32) * std::f32::consts::TAU; |
| 12608 | // XY ring |
| 12609 | self.add_line_3d( |
| 12610 | [cx + radius * a1.cos(), cy + radius * a1.sin(), cz], |
| 12611 | [cx + radius * a2.cos(), cy + radius * a2.sin(), cz], |
| 12612 | color, 0.02, |
| 12613 | ); |
| 12614 | // XZ ring |
| 12615 | self.add_line_3d( |
| 12616 | [cx + radius * a1.cos(), cy, cz + radius * a1.sin()], |
| 12617 | [cx + radius * a2.cos(), cy, cz + radius * a2.sin()], |
| 12618 | color, 0.02, |
| 12619 | ); |
| 12620 | // YZ ring |
| 12621 | self.add_line_3d( |
| 12622 | [cx, cy + radius * a1.cos(), cz + radius * a1.sin()], |
| 12623 | [cx, cy + radius * a2.cos(), cz + radius * a2.sin()], |
| 12624 | color, 0.02, |
| 12625 | ); |
| 12626 | } |
| 12627 | } |
| 12628 | |
| 12629 | pub fn draw_cylinder(&mut self, x: f64, y: f64, z: f64, radius_top: f64, radius_bottom: f64, height: f64, r: f64, g: f64, b: f64, a: f64) { |
| 12630 | self.ensure_draw_state_3d(self.current_texture_3d); |
no test coverage detected