public Patch(MeshSorter owner, Triangle t) { this.owner = owner; indices = new HashSet<int>(); triangles = new HashSet<Triangle>(); if(t != null) AddTriangle(t); }
void CreateMeshData() { var vertices = m_sourceMesh.vertices; var uvs = m_sourceMesh.uv; var colors = m_sourceMesh.colors; var indices = m_sourceMesh.triangles; m_sortedIndices = new int[indices.Length]; m_meshSorter = new MeshSorter(vertices, uvs, colors, indices, sourceRenderer.transform, headSpheres); m_meshSorter.BuildNormalizedPatches(); m_meshSorter.SortIndices(Vector3.zero, m_sortedIndices, 0f); m_sortedMesh = new Mesh(); m_sortedMesh.vertices = vertices; m_sortedMesh.uv = uvs; m_sortedMesh.normals = m_sourceMesh.normals; m_sortedMesh.tangents = m_sourceMesh.tangents; m_sortedMesh.colors = m_meshSorter.staticPatchColors; m_sortedMesh.triangles = m_sortedIndices; m_sortedMesh.bindposes = m_sourceMesh.bindposes; m_sortedMesh.boneWeights = m_sourceMesh.boneWeights; m_sourceMesh.RecalculateBounds(); }
void CreateMeshData() { var vertices = m_sourceMesh.vertices; var uvs = m_sourceMesh.uv; var colors = m_sourceMesh.colors; var indices = m_sourceMesh.triangles; m_sortedIndices = new int[indices.Length]; m_meshSorter = new MeshSorter(vertices, uvs, colors, indices, sourceRenderer.transform, headSpheres); m_meshSorter.BuildNormalizedPatches(); m_meshSorter.SortIndices(Vector3.zero, m_sortedIndices, 0f); m_sortedMesh = new Mesh(); m_sortedMesh.name = "Sorted_" + m_sourceMesh.name; m_sortedMesh.vertices = vertices; m_sortedMesh.uv = uvs; m_sortedMesh.normals = m_sourceMesh.normals; m_sortedMesh.tangents = m_sourceMesh.tangents; m_sortedMesh.colors = m_meshSorter.staticPatchColors; m_sortedMesh.triangles = m_sortedIndices; m_sortedMesh.bindposes = m_sourceMesh.bindposes; m_sortedMesh.boneWeights = m_sourceMesh.boneWeights; m_sourceMesh.RecalculateBounds(); }