renderstate: disallow line width < 1f

This commit is contained in:
Kirill Vainer 2016-04-02 16:28:00 -04:00
parent 13755fb75b
commit 3b5d1eebd8
2 changed files with 7 additions and 1 deletions

View File

@ -822,6 +822,9 @@ public class RenderState implements Cloneable, Savable {
* @param lineWidth the line width. * @param lineWidth the line width.
*/ */
public void setLineWidth(float lineWidth) { public void setLineWidth(float lineWidth) {
if (lineWidth < 1f) {
throw new IllegalArgumentException("lineWidth must be greater than or equal to 1.0");
}
this.lineWidth = lineWidth; this.lineWidth = lineWidth;
this.applyLineWidth = true; this.applyLineWidth = true;
cachedHashCode = -1; cachedHashCode = -1;

View File

@ -175,7 +175,7 @@ public class Mesh implements Savable, Cloneable, JmeCloneable {
private IntMap<VertexBuffer> buffers = new IntMap<VertexBuffer>(); private IntMap<VertexBuffer> buffers = new IntMap<VertexBuffer>();
private VertexBuffer[] lodLevels; private VertexBuffer[] lodLevels;
private float pointSize = 1; private float pointSize = 1;
private float lineWidth = -1; private float lineWidth = 1;
private transient int vertexArrayID = -1; private transient int vertexArrayID = -1;
@ -634,6 +634,9 @@ public class Mesh implements Savable, Cloneable, JmeCloneable {
*/ */
@Deprecated @Deprecated
public void setLineWidth(float lineWidth) { public void setLineWidth(float lineWidth) {
if (lineWidth < 1f) {
throw new IllegalArgumentException("lineWidth must be greater than or equal to 1.0");
}
this.lineWidth = lineWidth; this.lineWidth = lineWidth;
} }