Ver código fonte

Providing invalid parameters in cylinders generation throws an exception.

stophe 8 anos atrás
pai
commit
61c22d5709

+ 4 - 4
jme3-core/src/main/java/com/jme3/scene/shape/Cylinder.java

@@ -44,7 +44,7 @@ import com.jme3.util.BufferUtils;
 import java.io.IOException;
 
 /**
- * A simple cylinder, defined by its height and radius.
+ * A simple cylinder, defined by it's height and radius.
  * (Ported to jME3)
  *
  * @author Mark Powell
@@ -211,13 +211,13 @@ public class Cylinder extends Mesh {
     public void updateGeometry(int axisSamples, int radialSamples,
             float topRadius, float bottomRadius, float height, boolean closed, boolean inverted)
 	{
-		// Ensure there's at least two axis samples and 3 radial samples, and positive geometries.
+		// Ensure there's at least two axis samples and 3 radial samples, and positive dimensions.
 		if( axisSamples < 2
 			|| radialSamples < 3
 			|| topRadius <= 0
 			|| bottomRadius <= 0
 			|| height <= 0 )
-			return;
+			throw new IllegalArgumentException("Cylinders must have at least 2 axis samples and 3 radial samples, and positive dimensions.");
 		
 		this.axisSamples = axisSamples;
         this.radialSamples = radialSamples;
@@ -461,4 +461,4 @@ public class Cylinder extends Mesh {
         capsule.write(closed, "closed", false);
         capsule.write(inverted, "inverted", false);
     }
-}
+}