Providing invalid parameters in cylinders generation throws an exception.
This commit is contained in:
parent
edf279a06d
commit
61c22d5709
@ -44,7 +44,7 @@ import com.jme3.util.BufferUtils;
|
|||||||
import java.io.IOException;
|
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)
|
* (Ported to jME3)
|
||||||
*
|
*
|
||||||
* @author Mark Powell
|
* @author Mark Powell
|
||||||
@ -211,13 +211,13 @@ public class Cylinder extends Mesh {
|
|||||||
public void updateGeometry(int axisSamples, int radialSamples,
|
public void updateGeometry(int axisSamples, int radialSamples,
|
||||||
float topRadius, float bottomRadius, float height, boolean closed, boolean inverted)
|
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
|
if( axisSamples < 2
|
||||||
|| radialSamples < 3
|
|| radialSamples < 3
|
||||||
|| topRadius <= 0
|
|| topRadius <= 0
|
||||||
|| bottomRadius <= 0
|
|| bottomRadius <= 0
|
||||||
|| height <= 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.axisSamples = axisSamples;
|
||||||
this.radialSamples = radialSamples;
|
this.radialSamples = radialSamples;
|
||||||
@ -461,4 +461,4 @@ public class Cylinder extends Mesh {
|
|||||||
capsule.write(closed, "closed", false);
|
capsule.write(closed, "closed", false);
|
||||||
capsule.write(inverted, "inverted", false);
|
capsule.write(inverted, "inverted", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user