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

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

View File

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