Skip to content

Commit 60709c5

Browse files
author
Torstein Grindvik
committed
Skip making cap if radius zero
Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
1 parent 7820b5e commit 60709c5

File tree

1 file changed

+5
-0
lines changed
  • crates/bevy_render/src/mesh/shape

1 file changed

+5
-0
lines changed

crates/bevy_render/src/mesh/shape/cone.rs

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ impl From<Cone> for Mesh {
4040
fn from(c: Cone) -> Self {
4141
debug_assert!(c.top_radius >= 0.0);
4242
debug_assert!(c.bottom_radius >= 0.0);
43+
debug_assert!(!(c.bottom_radius == 0.0 && c.top_radius == 0.0));
4344
debug_assert!(c.height > 0.0);
4445
debug_assert!(c.resolution > 2);
4546
debug_assert!(c.segments > 0);
@@ -107,6 +108,10 @@ impl From<Cone> for Mesh {
107108

108109
let radius = if top { c.top_radius } else { c.bottom_radius };
109110

111+
if radius == 0.0 {
112+
return;
113+
}
114+
110115
for i in 0..c.resolution {
111116
let theta = i as f32 * step_theta;
112117
let (sin, cos) = theta.sin_cos();

0 commit comments

Comments
 (0)