private void FindSnappedVertices(int offset, float threshold) { Vector3 a = this.clusterVertices[offset].Position; ClusterVertex v = this.clusterVertices[offset]; this.snappedVertices.Clear(); this.snappedVertices.Add(v); int clusterCount = this.clusterVertices.Count; v.Data = null; this.clusterVertices[offset] = v; for (++offset; offset < clusterCount; ++offset) { v = this.clusterVertices[offset]; if (v.Data == null) { continue; } if (Vector3.Distance(a, v.Position) <= threshold) { this.snappedVertices.Add(v); // Do not attempt to build additional vertex groups using `v` as seed! v.Data = null; this.clusterVertices[offset] = v; } } }
private void AddToCluster(MeshData data) { ClusterVertex clusterVertex = new ClusterVertex(data, 0); for (clusterVertex.Index = 0; clusterVertex.Index < data.Vertices.Length; ++clusterVertex.Index) { this.clusterVertices.Add(clusterVertex); } }