浏览代码

[unity] Fix default mesh bounds check.

John 8 年之前
父节点
当前提交
e781ad9ccd
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      spine-unity/Assets/spine-unity/Mesh Generation/SpineMesh.cs

+ 3 - 3
spine-unity/Assets/spine-unity/Mesh Generation/SpineMesh.cs

@@ -107,8 +107,8 @@ namespace Spine.Unity {
 			}
 			}
 		}
 		}
 
 
-		const float BoundsMinDefault = float.MaxValue;
-		const float BoundsMaxDefault = float.MinValue;
+		const float BoundsMinDefault = float.PositiveInfinity;
+		const float BoundsMaxDefault = float.NegativeInfinity;
 
 
 		[NonSerialized] readonly ExposedList<Vector3> vertexBuffer = new ExposedList<Vector3>(4);
 		[NonSerialized] readonly ExposedList<Vector3> vertexBuffer = new ExposedList<Vector3>(4);
 		[NonSerialized] readonly ExposedList<Vector2> uvBuffer = new ExposedList<Vector2>(4);
 		[NonSerialized] readonly ExposedList<Vector2> uvBuffer = new ExposedList<Vector2>(4);
@@ -940,7 +940,7 @@ namespace Spine.Unity {
 				mesh.uv = ubi;
 				mesh.uv = ubi;
 				mesh.colors32 = cbi;
 				mesh.colors32 = cbi;
 
 
-				if (meshBoundsMin.x == BoundsMinDefault) {
+				if (float.IsInfinity(meshBoundsMin.x)) { // meshBoundsMin.x == BoundsMinDefault // == doesn't work on float Infinity constants.
 					mesh.bounds = new Bounds();
 					mesh.bounds = new Bounds();
 				} else {
 				} else {
 					//mesh.bounds = ArraysMeshGenerator.ToBounds(meshBoundsMin, meshBoundsMax);
 					//mesh.bounds = ArraysMeshGenerator.ToBounds(meshBoundsMin, meshBoundsMax);