@@ -437,7 +437,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
437437}
438438
439439StaticString<MAX_PATH_LENGTH> res_locator (anim.name , " :" , gltf_path);
440- compiler.writeCompiledResource (res_locator, Span< u8 >(( u8 *) out.getData (), (int )out.getPos ()));
440+ compiler.writeCompiledResource (res_locator, Span ( out.data (), (u32 )out.size ()));
441441}
442442}
443443
@@ -475,7 +475,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
475475logError (" gltf" ) << " Could not create " << out_path;
476476continue ;
477477}
478- file.write (out.getData (), out.getPos ());
478+ file.write (out.data (), out.size ());
479479file.close ();
480480}
481481}
@@ -485,20 +485,20 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
485485FileSystem& fs = editor.getEngine ().getFileSystem ();
486486AssetCompiler& compiler = app.getAssetCompiler ();
487487
488- Array< u8 > content (editor.getAllocator ());
488+ OutputMemoryStream content (editor.getAllocator ());
489489if (!fs.getContentSync (Path (src), Ref (content))) {
490490logError (" gltf" ) << " Could not load " << src;
491491return false ;
492492}
493493
494494cgltf_data* gltf_data = nullptr ;
495495cgltf_options options = {};
496- if (cgltf_parse (&options, content.begin (), content.byte_size (), &gltf_data) != cgltf_result_success) {
496+ if (cgltf_parse (&options, content.data (), content.size (), &gltf_data) != cgltf_result_success) {
497497logError (" gltf" ) << " Failed to parse " << src;
498498return false ;
499499}
500500
501- Array<Array< u8 > > buffers (editor.getAllocator ());
501+ Array<OutputMemoryStream > buffers (editor.getAllocator ());
502502for (u32 i = 0 ; i < gltf_data->buffers_count ; ++i) {
503503buffers.emplace (editor.getAllocator ());
504504}
@@ -516,7 +516,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
516516
517517for (u32 i = 0 ; i < gltf_data->buffers_count ; ++i) {
518518ASSERT (!gltf_data->buffers [i].data );
519- gltf_data->buffers [i].data = buffers[i].begin ();
519+ gltf_data->buffers [i].data = buffers[i].getMutableData ();
520520}
521521
522522ModelWriter writer (src.c_str (), editor.getAllocator ());
@@ -534,7 +534,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
534534
535535cgltf_free (gltf_data);
536536
537- Span<u8 > compiled_data (( u8 *) writer.out .getData (), (int )writer.out .getPos ());
537+ Span<const u8 > compiled_data (writer.out .data (), (u32 )writer.out .size ());
538538return compiler.writeCompiledResource (src.c_str (), compiled_data);
539539}
540540
@@ -568,7 +568,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
568568FileSystem& fs = editor.getEngine ().getFileSystem ();
569569AssetCompiler& compiler = plugin->app .getAssetCompiler ();
570570
571- Array< u8 > content (editor.getAllocator ());
571+ OutputMemoryStream content (editor.getAllocator ());
572572if (!fs.getContentSync (Path (data->path ), Ref (content))) {
573573logError (" gltf" ) << " Could not load " << data->path ;
574574LUMIX_DELETE (editor.getAllocator (), data);
@@ -577,7 +577,7 @@ struct CompilerPlugin : AssetCompiler::IPlugin {
577577
578578cgltf_data* gltf_data = nullptr ;
579579cgltf_options options = {};
580- if (cgltf_parse (&options, content.begin (), content.byte_size (), &gltf_data) != cgltf_result_success) {
580+ if (cgltf_parse (&options, content.data (), content.size (), &gltf_data) != cgltf_result_success) {
581581logError (" gltf" ) << " Failed to parse " << data->path ;
582582LUMIX_DELETE (editor.getAllocator (), data);
583583return ;
0 commit comments