ソースを参照

renderstate: disallow line width < 1f

Kirill Vainer 9 年 前
コミット
3b5d1eebd8

+ 3 - 0
jme3-core/src/main/java/com/jme3/material/RenderState.java

@@ -822,6 +822,9 @@ public class RenderState implements Cloneable, Savable {
      * @param lineWidth the line width.
      */
     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.applyLineWidth = true;
         cachedHashCode = -1;

+ 4 - 1
jme3-core/src/main/java/com/jme3/scene/Mesh.java

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