public static bool CreatePartMorphInfo(List <Vector3> vertices, RenderMeshPart part, float scale, out PartMorphInfo info) { var result = new PartMorphInfo(); var pointnsDict = new Dictionary <Vector3, int>(new VectorEqualityComparer()); foreach (var v in vertices) { if (!pointnsDict.ContainsKey(v)) { pointnsDict.Add(v, result.PointsMorph.Count); result.PointsMorph.Add(v); } } if (result.PointsMorph.Count != part.Points.Count) { info = null; return(false); } for (int i = 0; i < result.PointsMorph.Count; i++) { var index = part.Points[i].Indices[0]; var p = (part.BaseVertices ?? part.Vertices)[index].OriginalPosition; result.PointsMorph[i] = result.PointsMorph[i] - p / scale; } info = result; return(true); }
public static bool CreatePartMorphInfo(List<Vector3> vertices, RenderMeshPart part, float scale, out PartMorphInfo info) { var result = new PartMorphInfo(); var pointnsDict = new Dictionary<Vector3, int>(new VectorEqualityComparer()); foreach (var v in vertices) { if (!pointnsDict.ContainsKey(v)) { pointnsDict.Add(v, result.PointsMorph.Count); result.PointsMorph.Add(v); } } if (result.PointsMorph.Count != part.Points.Count) { info = null; return false; } for (var i = 0; i < result.PointsMorph.Count; i++) { var index = part.Points[i].Indices[0]; var p = (part.BaseVertices ?? part.Vertices)[index].OriginalPosition; result.PointsMorph[i] = result.PointsMorph[i] - p / scale; } info = result; return true; }