Clean up.

This commit is contained in:
NathanSweet 2014-04-28 17:51:17 +02:00
parent 04c0fec844
commit 5623631026
2 changed files with 8 additions and 18 deletions

View File

@ -219,13 +219,10 @@ namespace Spine {
MeshAttachment mesh = attachmentLoader.NewMeshAttachment(skin, name, path);
if (mesh == null) return null;
mesh.Path = path;
float[] uvs = GetFloatArray(map, "uvs", 1);
int[] triangles = GetIntArray(map, "triangles");
float[] vertices = GetFloatArray(map, "vertices", Scale);
mesh.vertices = vertices;
mesh.triangles = triangles;
mesh.regionUVs = uvs;
mesh.Path = path;
mesh.vertices = GetFloatArray(map, "vertices", Scale);
mesh.triangles = GetIntArray(map, "triangles");
mesh.regionUVs = GetFloatArray(map, "uvs", 1);
mesh.UpdateUVs();
if (map.ContainsKey("color")) {
@ -249,8 +246,6 @@ namespace Spine {
mesh.Path = path;
float[] uvs = GetFloatArray(map, "uvs", 1);
int[] triangles = GetIntArray(map, "triangles");
float[] vertices = GetFloatArray(map, "vertices", 1);
var weights = new List<float>(uvs.Length * 3 * 3);
var bones = new List<int>(uvs.Length * 3);
@ -268,7 +263,7 @@ namespace Spine {
}
mesh.bones = bones.ToArray();
mesh.weights = weights.ToArray();
mesh.triangles = triangles;
mesh.triangles = GetIntArray(map, "triangles");
mesh.regionUVs = uvs;
mesh.UpdateUVs();

View File

@ -205,17 +205,14 @@ public class SkeletonJson {
MeshAttachment mesh = attachmentLoader.newMeshAttachment(skin, name, path);
if (mesh == null) return null;
mesh.setPath(path);
float[] uvs = map.require("uvs").asFloatArray();
short[] triangles = map.require("triangles").asShortArray();
float[] vertices = map.require("vertices").asFloatArray();
if (scale != 1) {
for (int i = 0, n = vertices.length; i < n; i++)
vertices[i] *= scale;
}
mesh.setVertices(vertices);
mesh.setTriangles(triangles);
mesh.setRegionUVs(uvs);
mesh.setTriangles(map.require("triangles").asShortArray());
mesh.setRegionUVs(map.require("uvs").asFloatArray());
mesh.updateUVs();
if (map.has("hull")) mesh.setHullLength(map.require("hull").asInt() * 2);
@ -229,8 +226,6 @@ public class SkeletonJson {
if (mesh == null) return null;
mesh.setPath(path);
float[] uvs = map.require("uvs").asFloatArray();
short[] triangles = map.require("triangles").asShortArray();
float[] vertices = map.require("vertices").asFloatArray();
FloatArray weights = new FloatArray(uvs.length * 3 * 3);
IntArray bones = new IntArray(uvs.length * 3);
@ -247,7 +242,7 @@ public class SkeletonJson {
}
mesh.setBones(bones.toArray());
mesh.setWeights(weights.toArray());
mesh.setTriangles(triangles);
mesh.setTriangles(map.require("triangles").asShortArray());
mesh.setRegionUVs(uvs);
mesh.updateUVs();