コード例 #1
0
        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);
        }