public static void CaptureMesh(AbcAPI.aeObject abc, Mesh mesh, Cloth cloth, MeshBuffer dst_buf) { dst_buf.indices = mesh.triangles; dst_buf.uvs = mesh.uv; if (cloth == null) { dst_buf.vertices = mesh.vertices; dst_buf.normals = mesh.normals; } else { dst_buf.vertices = cloth.vertices; dst_buf.normals = cloth.normals; } var data = new AbcAPI.aePolyMeshData(); data.indices = GetArrayPtr(dst_buf.indices); data.positions = GetArrayPtr(dst_buf.vertices); if (dst_buf.normals != null) { data.normals = GetArrayPtr(dst_buf.normals); } if (dst_buf.uvs != null) { data.uvs = GetArrayPtr(dst_buf.uvs); } data.positionCount = dst_buf.vertices.Length; data.indexCount = dst_buf.indices.Length; AbcAPI.aePolyMeshWriteSample(abc, ref data); }
public static void CaptureMesh(AbcAPI.aeObject abc, Mesh mesh, Cloth cloth, MeshBuffer dst_buf) { dst_buf.Clear(); dst_buf.indices.LockList(ls => mesh.GetTriangles(ls, 0)); dst_buf.uvs.LockList(ls => mesh.GetUVs(0, ls)); if (cloth == null) { dst_buf.vertices.LockList(ls => mesh.GetVertices(ls)); dst_buf.normals.LockList(ls => mesh.GetNormals(ls)); } else { dst_buf.vertices.Assign(cloth.vertices); dst_buf.normals.Assign(cloth.normals); } var data = new AbcAPI.aePolyMeshData(); data.indices = dst_buf.indices; data.positions = dst_buf.vertices; data.normals = dst_buf.normals; data.uvs = dst_buf.uvs; data.positionCount = dst_buf.vertices.Count; data.indexCount = dst_buf.indices.Count; AbcAPI.aePolyMeshWriteSample(abc, ref data); }