diff --git a/spine-flutter/example/pubspec.lock b/spine-flutter/example/pubspec.lock index 07bd0c63b..61325d7bd 100644 --- a/spine-flutter/example/pubspec.lock +++ b/spine-flutter/example/pubspec.lock @@ -42,7 +42,7 @@ packages: path: ".." relative: true source: path - version: "0.0.4" + version: "4.2.5" ffi: dependency: transitive description: diff --git a/spine-flutter/src/main.cpp b/spine-flutter/src/main.cpp index eeccd478c..311fbe988 100644 --- a/spine-flutter/src/main.cpp +++ b/spine-flutter/src/main.cpp @@ -14,9 +14,37 @@ int main(int argc, char** argv) { spine_atlas atlas = spine_atlas_load((const utf8*)cstringAtlas); spine_skeleton_data_result result = spine_skeleton_data_load_binary(atlas, data, dataLength); spine_skeleton_drawable drawable = spine_skeleton_drawable_create(spine_skeleton_data_result_get_data(result)); + spine_skeleton skeleton = spine_skeleton_drawable_get_skeleton(drawable); + spine_skeleton_update_world_transform(skeleton); spine_render_command cmd = spine_skeleton_drawable_render(drawable); - while (cmd) { - uint16_t *indices = spine_render_command_get_indices(cmd); - cmd = spine_render_command_get_next(cmd); + int numVertices = spine_render_command_get_num_vertices(cmd); + int numIndices = spine_render_command_get_num_indices(cmd); + float* positions = spine_render_command_get_positions(cmd); + float* uvs = spine_render_command_get_uvs(cmd); + int32_t *colors = spine_render_command_get_colors(cmd); + uint16_t *indices = spine_render_command_get_indices(cmd); + String str; + str.append(numVertices); + str.append("\n"); + str.append(numIndices); + str.append("\n"); + for (int i = 0; i < numVertices * 2; i++) { + str.append(positions[i]); + str.append("\n"); } + for (int i = 0; i < numVertices * 2; i++) { + str.append(uvs[i]); + str.append("\n"); + } + for (int i = 0; i < numVertices; i++) { + str.append(colors[i]); + str.append("\n"); + } + for (int i = 0; i < numIndices; i++) { + str.append(indices[i]); + str.append("\n"); + } + FILE *file = fopen("/Users/badlogic/Desktop/spineboy.mesh", "w"); + fwrite(str.buffer(), str.length(), 1, file); + fclose(file); } \ No newline at end of file