瀏覽代碼

Always use plugin embed

luboslenco 1 年之前
父節點
當前提交
13792bdf48
共有 36 個文件被更改,包括 88 次插入431 次删除
  1. 1 8
      armorforge/project.js
  2. 0 0
      armorlab/Assets/plugins/import_svg.js
  3. 0 57
      armorlab/Assets/plugins/wasm/import_svg.js
  4. 二進制
      armorlab/Assets/plugins/wasm/import_svg.wasm
  5. 0 1
      armorlab/project.js
  6. 0 0
      armorpaint/Assets/plugins/ammo/ammo.wasm.js
  7. 0 0
      armorpaint/Assets/plugins/ammo/ammo.wasm.wasm
  8. 0 0
      armorpaint/Assets/plugins/import_fbx.js
  9. 0 0
      armorpaint/Assets/plugins/import_gltf_glb.js
  10. 0 0
      armorpaint/Assets/plugins/import_svg.js
  11. 0 0
      armorpaint/Assets/plugins/import_usdc.js
  12. 0 0
      armorpaint/Assets/plugins/uv_unwrap.js
  13. 0 13
      armorpaint/Assets/plugins/wasm/import_gltf_glb.js
  14. 二進制
      armorpaint/Assets/plugins/wasm/import_gltf_glb.wasm
  15. 0 57
      armorpaint/Assets/plugins/wasm/import_svg.js
  16. 二進制
      armorpaint/Assets/plugins/wasm/import_svg.wasm
  17. 0 13
      armorpaint/Assets/plugins/wasm/import_usdc.js
  18. 二進制
      armorpaint/Assets/plugins/wasm/import_usdc.wasm
  19. 0 126
      armorpaint/Assets/plugins/wasm/uv_unwrap.js
  20. 二進制
      armorpaint/Assets/plugins/wasm/uv_unwrap.wasm
  21. 0 1
      armorpaint/Plugins/Sources/io_dds/build.sh
  22. 7 12
      armorpaint/Plugins/Sources/io_dds/tinyddsloader.cpp
  23. 16 24
      armorpaint/Plugins/Sources/io_fbx/io_fbx.c
  24. 0 1
      armorpaint/Plugins/Sources/io_gltf/build.sh
  25. 20 27
      armorpaint/Plugins/Sources/io_gltf/cgltf.c
  26. 0 1
      armorpaint/Plugins/Sources/io_svg/build.sh
  27. 9 16
      armorpaint/Plugins/Sources/io_svg/nanosvg.c
  28. 0 1
      armorpaint/Plugins/Sources/io_usd/build.sh
  29. 12 19
      armorpaint/Plugins/Sources/io_usd/io_usd.cc
  30. 0 1
      armorpaint/Plugins/Sources/proc_xatlas/build.sh
  31. 18 25
      armorpaint/Plugins/Sources/proc_xatlas/xatlas.cpp
  32. 1 8
      armorpaint/project.js
  33. 1 8
      armorsculpt/project.js
  34. 2 3
      base/Sources/BoxPreferences.ts
  35. 0 2
      base/Sources/Path.ts
  36. 1 7
      base/project.js

+ 1 - 8
armorforge/project.js

@@ -28,16 +28,9 @@ else if (flags.ios) {
 	project.addAssets("Assets/readme/readme_ios.txt", { destination: "{name}" });
 	project.addAssets("Assets/readme/readme_ios.txt", { destination: "{name}" });
 }
 }
 
 
-if (flags.plugin_embed) {
-	project.addAssets("Assets/plugins/embed/*", { destination: "data/plugins/{name}" });
-}
-else {
-	project.addAssets("Assets/plugins/wasm/*", { destination: "data/plugins/{name}" });
-}
-
 if (flags.physics) {
 if (flags.physics) {
 	project.addDefine("arm_physics");
 	project.addDefine("arm_physics");
-	project.addAssets("Assets/plugins/wasm/ammo/*", { destination: "data/plugins/{name}" });
+	project.addAssets("Assets/plugins/ammo/*", { destination: "data/plugins/{name}" });
 }
 }
 
 
 if (flags.raytrace) {
 if (flags.raytrace) {

+ 0 - 0
armorlab/Assets/plugins/embed/import_svg.js → armorlab/Assets/plugins/import_svg.js


+ 0 - 57
armorlab/Assets/plugins/wasm/import_svg.js

@@ -1,57 +0,0 @@
-
-let Module = {};
-Module["instantiateWasm"] = function(imports, successCallback) {
-	let wasmbin = Krom.loadBlob("data/plugins/import_svg.wasm");
-	let module = new WebAssembly.Module(wasmbin);
-	let inst = new WebAssembly.Instance(module, imports);
-	successCallback(inst);
-	return inst.exports;
-};
-Module.print = console.log;
-Module.printErr = console.log;
-
-// emscripten-generated glue
-var a;a||(a=typeof Module !== 'undefined' ? Module : {});var g={},h;for(h in a)a.hasOwnProperty(h)&&(g[h]=a[h]);var k;k=function(b){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(b));b=read(b,"binary");"object"===typeof b||m("Assertion failed: undefined");return b};"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);
-var n=a.print||console.log.bind(console),p=a.printErr||console.warn.bind(console);for(h in g)g.hasOwnProperty(h)&&(a[h]=g[h]);g=null;var q;a.wasmBinary&&(q=a.wasmBinary);var noExitRuntime;a.noExitRuntime&&(noExitRuntime=a.noExitRuntime);"object"!==typeof WebAssembly&&p("no native wasm support detected");var r,t=new WebAssembly.Table({initial:2,maximum:2,element:"anyfunc"}),u=!1,v,w,x;
-function y(b){v=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=x=new Int32Array(b);a.HEAPU8=w=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var z=a.INITIAL_MEMORY||16777216;a.wasmMemory?r=a.wasmMemory:r=new WebAssembly.Memory({initial:z/65536,maximum:32768});r&&(v=r.buffer);z=v.byteLength;y(v);x[1492]=5249008;
-function A(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var d=c.l;"number"===typeof d?void 0===c.j?a.dynCall_v(d):a.dynCall_vi(d,c.j):d(void 0===c.j?null:c.j)}}}var B=[],C=[],D=[],E=[];function F(){var b=a.preRun.shift();B.unshift(b)}var G=0,H=null,I=null;a.preloadedImages={};a.preloadedAudios={};function m(b){if(a.onAbort)a.onAbort(b);n(b);p(b);u=!0;throw new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");}
-function J(){var b=K;return String.prototype.startsWith?b.startsWith("data:application/octet-stream;base64,"):0===b.indexOf("data:application/octet-stream;base64,")}var K="import_svg.wasm";if(!J()){var L=K;K=a.locateFile?a.locateFile(L,""):""+L}function M(){return new Promise(function(b){a:{try{if(q){var c=new Uint8Array(q);break a}if(k){c=k(K);break a}throw"both async and sync fetching of the wasm failed";}catch(d){m(d)}c=void 0}b(c)})}C.push({l:function(){N()}});
-var O={b:function(b,c,d){w.copyWithin(b,c,c+d)},a:function(b){b>>>=0;var c=w.length;if(2147483648<b)return!1;for(var d=1;4>=d;d*=2){var f=c*(1+.2/d);f=Math.min(f,b+100663296);f=Math.max(16777216,b,f);0<f%65536&&(f+=65536-f%65536);a:{try{r.grow(Math.min(2147483648,f)-v.byteLength+65535>>>16);y(r.buffer);var e=1;break a}catch(l){}e=void 0}if(e)return!0}return!1},memory:r,table:t},P=function(){function b(e){a.asm=e.exports;G--;a.monitorRunDependencies&&a.monitorRunDependencies(G);0==G&&(null!==H&&(clearInterval(H),
-H=null),I&&(e=I,I=null,e()))}function c(e){b(e.instance)}function d(e){return M().then(function(l){return WebAssembly.instantiate(l,f)}).then(e,function(l){p("failed to asynchronously prepare wasm: "+l);m(l)})}var f={a:O};G++;a.monitorRunDependencies&&a.monitorRunDependencies(G);if(a.instantiateWasm)try{return a.instantiateWasm(f,b)}catch(e){return p("Module.instantiateWasm callback failed with error: "+e),!1}(function(){if(q||"function"!==typeof WebAssembly.instantiateStreaming||J()||"function"!==
-typeof fetch)return d(c);fetch(K,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,f).then(c,function(l){p("wasm streaming compile failed: "+l);p("falling back to ArrayBuffer instantiation");d(c)})})})();return{}}();a.asm=P;var N=a.___wasm_call_ctors=function(){return(N=a.___wasm_call_ctors=a.asm.c).apply(null,arguments)};a._init=function(){return(a._init=a.asm.d).apply(null,arguments)};a._parse=function(){return(a._parse=a.asm.e).apply(null,arguments)};
-a._get_pixels=function(){return(a._get_pixels=a.asm.f).apply(null,arguments)};a._get_pixels_w=function(){return(a._get_pixels_w=a.asm.g).apply(null,arguments)};a._get_pixels_h=function(){return(a._get_pixels_h=a.asm.h).apply(null,arguments)};a._destroy=function(){return(a._destroy=a.asm.i).apply(null,arguments)};a.asm=P;var Q;I=function R(){Q||S();Q||(I=R)};
-function S(){function b(){if(!Q&&(Q=!0,a.calledRun=!0,!u)){A(C);A(D);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();E.unshift(c)}A(E)}}if(!(0<G)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)F();A(B);0<G||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=S;
-if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();noExitRuntime=!0;S();
-//
-
-// Register as ArmorPaint plugin
-let import_svg = function(path, done) {
-	iron.Data.getBlob(path, function(b) {
-		let buf = new Uint8Array(r.buffer, a._init(b.byteLength + 1), b.byteLength + 1);
-		var bbuf = new Uint8Array(b);
-		for (let i = 0; i < b.byteLength; ++i) buf[i] = bbuf[i];
-		buf[b.byteLength] = 0;
-
-		a._parse();
-		let w = a._get_pixels_w();
-		let h = a._get_pixels_h();
-		let pixels = r.buffer.slice(a._get_pixels(), a._get_pixels() + w * h * 4);
-		let image = core.Image.fromBytes(pixels, w, h);
-		done(image);
-
-		a._destroy();
-		iron.Data.deleteBlob(path);
-	});
-}
-
-let plugin = new arm.Plugin();
-let formats = arm.Path.textureFormats;
-let importers = arm.Path.textureImporters;
-formats.push("svg");
-importers.h["svg"] = import_svg;
-
-plugin.delete = function() {
-	formats.splice(formats.indexOf("svg"), 1);
-	importers.h["svg"] = null;
-};
-

二進制
armorlab/Assets/plugins/wasm/import_svg.wasm


+ 0 - 1
armorlab/project.js

@@ -3,7 +3,6 @@ let flags = globalThis.flags;
 flags.name = 'ArmorLab';
 flags.name = 'ArmorLab';
 flags.package = 'org.armorlab';
 flags.package = 'org.armorlab';
 flags.with_onnx = true;
 flags.with_onnx = true;
-flags.with_plugin_embed = true;
 
 
 let project = new Project(flags.name);
 let project = new Project(flags.name);
 project.addDefine("is_lab");
 project.addDefine("is_lab");

+ 0 - 0
armorpaint/Assets/plugins/wasm/ammo/ammo.wasm.js → armorpaint/Assets/plugins/ammo/ammo.wasm.js


+ 0 - 0
armorpaint/Assets/plugins/wasm/ammo/ammo.wasm.wasm → armorpaint/Assets/plugins/ammo/ammo.wasm.wasm


+ 0 - 0
armorpaint/Assets/plugins/embed/import_fbx.js → armorpaint/Assets/plugins/import_fbx.js


+ 0 - 0
armorpaint/Assets/plugins/embed/import_gltf_glb.js → armorpaint/Assets/plugins/import_gltf_glb.js


+ 0 - 0
armorpaint/Assets/plugins/embed/import_svg.js → armorpaint/Assets/plugins/import_svg.js


+ 0 - 0
armorpaint/Assets/plugins/embed/import_usdc.js → armorpaint/Assets/plugins/import_usdc.js


+ 0 - 0
armorpaint/Assets/plugins/embed/uv_unwrap.js → armorpaint/Assets/plugins/uv_unwrap.js


File diff suppressed because it is too large
+ 0 - 13
armorpaint/Assets/plugins/wasm/import_gltf_glb.js


二進制
armorpaint/Assets/plugins/wasm/import_gltf_glb.wasm


+ 0 - 57
armorpaint/Assets/plugins/wasm/import_svg.js

@@ -1,57 +0,0 @@
-
-let Module = {};
-Module["instantiateWasm"] = function(imports, successCallback) {
-	let wasmbin = Krom.loadBlob("data/plugins/import_svg.wasm");
-	let module = new WebAssembly.Module(wasmbin);
-	let inst = new WebAssembly.Instance(module, imports);
-	successCallback(inst);
-	return inst.exports;
-};
-Module.print = console.log;
-Module.printErr = console.log;
-
-// emscripten-generated glue
-var a;a||(a=typeof Module !== 'undefined' ? Module : {});var g={},h;for(h in a)a.hasOwnProperty(h)&&(g[h]=a[h]);var k;k=function(b){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(b));b=read(b,"binary");"object"===typeof b||m("Assertion failed: undefined");return b};"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);
-var n=a.print||console.log.bind(console),p=a.printErr||console.warn.bind(console);for(h in g)g.hasOwnProperty(h)&&(a[h]=g[h]);g=null;var q;a.wasmBinary&&(q=a.wasmBinary);var noExitRuntime;a.noExitRuntime&&(noExitRuntime=a.noExitRuntime);"object"!==typeof WebAssembly&&p("no native wasm support detected");var r,t=new WebAssembly.Table({initial:2,maximum:2,element:"anyfunc"}),u=!1,v,w,x;
-function y(b){v=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=x=new Int32Array(b);a.HEAPU8=w=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var z=a.INITIAL_MEMORY||16777216;a.wasmMemory?r=a.wasmMemory:r=new WebAssembly.Memory({initial:z/65536,maximum:32768});r&&(v=r.buffer);z=v.byteLength;y(v);x[1492]=5249008;
-function A(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var d=c.l;"number"===typeof d?void 0===c.j?a.dynCall_v(d):a.dynCall_vi(d,c.j):d(void 0===c.j?null:c.j)}}}var B=[],C=[],D=[],E=[];function F(){var b=a.preRun.shift();B.unshift(b)}var G=0,H=null,I=null;a.preloadedImages={};a.preloadedAudios={};function m(b){if(a.onAbort)a.onAbort(b);n(b);p(b);u=!0;throw new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");}
-function J(){var b=K;return String.prototype.startsWith?b.startsWith("data:application/octet-stream;base64,"):0===b.indexOf("data:application/octet-stream;base64,")}var K="import_svg.wasm";if(!J()){var L=K;K=a.locateFile?a.locateFile(L,""):""+L}function M(){return new Promise(function(b){a:{try{if(q){var c=new Uint8Array(q);break a}if(k){c=k(K);break a}throw"both async and sync fetching of the wasm failed";}catch(d){m(d)}c=void 0}b(c)})}C.push({l:function(){N()}});
-var O={b:function(b,c,d){w.copyWithin(b,c,c+d)},a:function(b){b>>>=0;var c=w.length;if(2147483648<b)return!1;for(var d=1;4>=d;d*=2){var f=c*(1+.2/d);f=Math.min(f,b+100663296);f=Math.max(16777216,b,f);0<f%65536&&(f+=65536-f%65536);a:{try{r.grow(Math.min(2147483648,f)-v.byteLength+65535>>>16);y(r.buffer);var e=1;break a}catch(l){}e=void 0}if(e)return!0}return!1},memory:r,table:t},P=function(){function b(e){a.asm=e.exports;G--;a.monitorRunDependencies&&a.monitorRunDependencies(G);0==G&&(null!==H&&(clearInterval(H),
-H=null),I&&(e=I,I=null,e()))}function c(e){b(e.instance)}function d(e){return M().then(function(l){return WebAssembly.instantiate(l,f)}).then(e,function(l){p("failed to asynchronously prepare wasm: "+l);m(l)})}var f={a:O};G++;a.monitorRunDependencies&&a.monitorRunDependencies(G);if(a.instantiateWasm)try{return a.instantiateWasm(f,b)}catch(e){return p("Module.instantiateWasm callback failed with error: "+e),!1}(function(){if(q||"function"!==typeof WebAssembly.instantiateStreaming||J()||"function"!==
-typeof fetch)return d(c);fetch(K,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,f).then(c,function(l){p("wasm streaming compile failed: "+l);p("falling back to ArrayBuffer instantiation");d(c)})})})();return{}}();a.asm=P;var N=a.___wasm_call_ctors=function(){return(N=a.___wasm_call_ctors=a.asm.c).apply(null,arguments)};a._init=function(){return(a._init=a.asm.d).apply(null,arguments)};a._parse=function(){return(a._parse=a.asm.e).apply(null,arguments)};
-a._get_pixels=function(){return(a._get_pixels=a.asm.f).apply(null,arguments)};a._get_pixels_w=function(){return(a._get_pixels_w=a.asm.g).apply(null,arguments)};a._get_pixels_h=function(){return(a._get_pixels_h=a.asm.h).apply(null,arguments)};a._destroy=function(){return(a._destroy=a.asm.i).apply(null,arguments)};a.asm=P;var Q;I=function R(){Q||S();Q||(I=R)};
-function S(){function b(){if(!Q&&(Q=!0,a.calledRun=!0,!u)){A(C);A(D);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();E.unshift(c)}A(E)}}if(!(0<G)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)F();A(B);0<G||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=S;
-if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();noExitRuntime=!0;S();
-//
-
-// Register as ArmorPaint plugin
-let import_svg = function(path, done) {
-	iron.Data.getBlob(path, function(b) {
-		let buf = new Uint8Array(r.buffer, a._init(b.byteLength + 1), b.byteLength + 1);
-		let bbuf = new Uint8Array(b);
-		for (let i = 0; i < b.byteLength; ++i) buf[i] = bbuf[i];
-		buf[b.byteLength] = 0;
-
-		a._parse();
-		let w = a._get_pixels_w();
-		let h = a._get_pixels_h();
-		let pixels = r.buffer.slice(a._get_pixels(), a._get_pixels() + w * h * 4);
-		let image = core.Image.fromBytes(pixels, w, h);
-		done(image);
-
-		a._destroy();
-		iron.Data.deleteBlob(path);
-	});
-}
-
-let plugin = new arm.Plugin();
-let formats = arm.Path.textureFormats;
-let importers = arm.Path.textureImporters;
-formats.push("svg");
-importers.h["svg"] = import_svg;
-
-plugin.delete = function() {
-	formats.splice(formats.indexOf("svg"), 1);
-	importers.h["svg"] = null;
-};
-

二進制
armorpaint/Assets/plugins/wasm/import_svg.wasm


File diff suppressed because it is too large
+ 0 - 13
armorpaint/Assets/plugins/wasm/import_usdc.js


二進制
armorpaint/Assets/plugins/wasm/import_usdc.wasm


+ 0 - 126
armorpaint/Assets/plugins/wasm/uv_unwrap.js

@@ -1,126 +0,0 @@
-
-let Module = {};
-Module["instantiateWasm"] = function(imports, successCallback) {
-	let wasmbin = Krom.loadBlob("data/plugins/uv_unwrap.wasm");
-	let module = new WebAssembly.Module(wasmbin);
-	let inst = new WebAssembly.Instance(module, imports);
-	successCallback(inst);
-	return inst.exports;
-};
-Module.print = console.log;
-Module.printErr = console.log;
-
-// emscripten-generated glue
-var a;a||(a=typeof Module !== 'undefined' ? Module : {});var h={},k;for(k in a)a.hasOwnProperty(k)&&(h[k]=a[k]);var l;l=function(b){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(b));b=read(b,"binary");"object"===typeof b||m("Assertion failed: undefined");return b};"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);
-var n=a.print||console.log.bind(console),p=a.printErr||console.warn.bind(console);for(k in h)h.hasOwnProperty(k)&&(a[k]=h[k]);h=null;var q;a.wasmBinary&&(q=a.wasmBinary);var noExitRuntime;a.noExitRuntime&&(noExitRuntime=a.noExitRuntime);"object"!==typeof WebAssembly&&m("no native wasm support detected");var r,t=!1,v="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
-function w(b,c,e){var f=c+e;for(e=c;b[e]&&!(e>=f);)++e;if(16<e-c&&b.subarray&&v)return v.decode(b.subarray(c,e));for(f="";c<e;){var d=b[c++];if(d&128){var g=b[c++]&63;if(192==(d&224))f+=String.fromCharCode((d&31)<<6|g);else{var u=b[c++]&63;d=224==(d&240)?(d&15)<<12|g<<6|u:(d&7)<<18|g<<12|u<<6|b[c++]&63;65536>d?f+=String.fromCharCode(d):(d-=65536,f+=String.fromCharCode(55296|d>>10,56320|d&1023))}}else f+=String.fromCharCode(d)}return f}function x(b){return b?w(y,b,void 0):""}var z,y,A;
-function B(){var b=r.buffer;z=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=A=new Int32Array(b);a.HEAPU8=y=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var C,G=[],H=[],I=[],J=[];H.push({v:function(){K()}});function L(){var b=a.preRun.shift();G.unshift(b)}var M=0,N=null,O=null;a.preloadedImages={};a.preloadedAudios={};
-function m(b){if(a.onAbort)a.onAbort(b);p(b);t=!0;throw new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");}function P(){var b=Q;return String.prototype.startsWith?b.startsWith("data:application/octet-stream;base64,"):0===b.indexOf("data:application/octet-stream;base64,")}var Q="xatlas.wasm";if(!P()){var R=Q;Q=a.locateFile?a.locateFile(R,""):""+R}
-function T(){return Promise.resolve().then(function(){a:{var b=Q;try{if(b==Q&&q){var c=new Uint8Array(q);break a}if(l){c=l(b);break a}throw"both async and sync fetching of the wasm failed";}catch(e){m(e)}c=void 0}return c})}function U(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.v;"number"===typeof e?void 0===c.u?C.get(e)():C.get(e)(c.u):e(void 0===c.u?null:c.u)}}}
-var V=[null,[],[]],W={a:function(b,c,e,f){m("Assertion failed: "+x(b)+", at: "+[c?x(c):"unknown filename",e,f?x(f):"unknown function"])},d:function(b,c,e){y.copyWithin(b,c,c+e)},b:function(b){b>>>=0;var c=y.length;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var f=c*(1+.2/e);f=Math.min(f,b+100663296);f=Math.max(16777216,b,f);0<f%65536&&(f+=65536-f%65536);a:{try{r.grow(Math.min(2147483648,f)-z.byteLength+65535>>>16);B();var d=1;break a}catch(g){}d=void 0}if(d)return!0}return!1},c:function(b,c,e,
-f){for(var d=0,g=0;g<e;g++){for(var u=A[c+8*g>>2],S=A[c+(8*g+4)>>2],D=0;D<S;D++){var E=y[u+D],F=V[b];0===E||10===E?((1===b?n:p)(w(F,0)),F.length=0):F.push(E)}d+=S}A[f>>2]=d;return 0}};
-(function(){function b(d){a.asm=d.exports;r=a.asm.e;B();C=a.asm.f;M--;a.monitorRunDependencies&&a.monitorRunDependencies(M);0==M&&(null!==N&&(clearInterval(N),N=null),O&&(d=O,O=null,d()))}function c(d){b(d.instance)}function e(d){return T().then(function(g){return WebAssembly.instantiate(g,f)}).then(d,function(g){p("failed to asynchronously prepare wasm: "+g);m(g)})}var f={a:W};M++;a.monitorRunDependencies&&a.monitorRunDependencies(M);if(a.instantiateWasm)try{return a.instantiateWasm(f,b)}catch(d){return p("Module.instantiateWasm callback failed with error: "+
-d),!1}(function(){return q||"function"!==typeof WebAssembly.instantiateStreaming||P()||"function"!==typeof fetch?e(c):fetch(Q,{credentials:"same-origin"}).then(function(d){return WebAssembly.instantiateStreaming(d,f).then(c,function(g){p("wasm streaming compile failed: "+g);p("falling back to ArrayBuffer instantiation");return e(c)})})})();return{}})();var K=a.___wasm_call_ctors=function(){return(K=a.___wasm_call_ctors=a.asm.g).apply(null,arguments)};
-a._setVertexCount=function(){return(a._setVertexCount=a.asm.h).apply(null,arguments)};a._setIndexCount=function(){return(a._setIndexCount=a.asm.i).apply(null,arguments)};a._setPositions=function(){return(a._setPositions=a.asm.j).apply(null,arguments)};a._setNormals=function(){return(a._setNormals=a.asm.k).apply(null,arguments)};a._setIndices=function(){return(a._setIndices=a.asm.l).apply(null,arguments)};a._getVertexCount=function(){return(a._getVertexCount=a.asm.m).apply(null,arguments)};
-a._getIndexCount=function(){return(a._getIndexCount=a.asm.n).apply(null,arguments)};a._getPositions=function(){return(a._getPositions=a.asm.o).apply(null,arguments)};a._getNormals=function(){return(a._getNormals=a.asm.p).apply(null,arguments)};a._getUVs=function(){return(a._getUVs=a.asm.q).apply(null,arguments)};a._getIndices=function(){return(a._getIndices=a.asm.r).apply(null,arguments)};a._unwrap=function(){return(a._unwrap=a.asm.s).apply(null,arguments)};
-a._destroy=function(){return(a._destroy=a.asm.t).apply(null,arguments)};var X;O=function Y(){X||Z();X||(O=Y)};
-function Z(){function b(){if(!X&&(X=!0,a.calledRun=!0,!t)){U(H);U(I);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();J.unshift(c)}U(J)}}if(!(0<M)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)L();U(G);0<M||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Z;
-if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();noExitRuntime=!0;Z();
-//
-
-function unwrap_mesh(mesh) {
-	let positions = mesh.posa;
-	let normals = mesh.nora;
-	let indices = mesh.inda;
-	let vertexCount = positions.length / 4;
-	let indexCount = indices.length;
-
-	a._setVertexCount(vertexCount);
-	a._setIndexCount(indexCount);
-	let pa = new Float32Array(r.buffer, a._setPositions(), vertexCount * 3);
-	let na = new Float32Array(r.buffer, a._setNormals(), vertexCount * 3);
-	let ia = new Uint32Array(r.buffer, a._setIndices(), indexCount);
-
-	let inv = 1 / 32767;
-
-	for (let i = 0; i < vertexCount; i++) {
-		pa[i * 3    ] = positions[i * 4    ] * inv;
-		pa[i * 3 + 1] = positions[i * 4 + 1] * inv;
-		pa[i * 3 + 2] = positions[i * 4 + 2] * inv;
-		na[i * 3    ] = normals  [i * 2    ] * inv;
-		na[i * 3 + 1] = normals  [i * 2 + 1] * inv;
-		na[i * 3 + 2] = positions[i * 4 + 3] * inv;
-	}
-	for (let i = 0; i < indexCount; i++) {
-		ia[i] = indices[i];
-	}
-
-	a._unwrap();
-
-	vertexCount = a._getVertexCount();
-	indexCount = a._getIndexCount();
-	pa = new Float32Array(r.buffer, a._getPositions(), vertexCount * 3);
-	na = new Float32Array(r.buffer, a._getNormals(), vertexCount * 3);
-	let ua = new Float32Array(r.buffer, a._getUVs(), vertexCount * 2);
-	ia = new Uint32Array(r.buffer, a._getIndices(), indexCount);
-
-	let pa16 = new Int16Array(vertexCount * 4);
-	let na16 = new Int16Array(vertexCount * 2);
-	let ua16 = new Int16Array(vertexCount * 2);
-	let ia32 = new Uint32Array(indexCount);
-
-	for (let i = 0; i < vertexCount; i++) {
-		pa16[i * 4    ] = pa[i * 3    ] / inv;
-		pa16[i * 4 + 1] = pa[i * 3 + 1] / inv;
-		pa16[i * 4 + 2] = pa[i * 3 + 2] / inv;
-		pa16[i * 4 + 3] = na[i * 3 + 2] / inv;
-		na16[i * 2    ] = na[i * 3    ] / inv;
-		na16[i * 2 + 1] = na[i * 3 + 1] / inv;
-		ua16[i * 2    ] = ua[i * 2    ] / inv;
-		ua16[i * 2 + 1] = ua[i * 2 + 1] / inv;
-	}
-	for (let i = 0; i < indexCount; i++) {
-		ia32[i] = ia[i];
-	}
-
-	mesh.posa = pa16;
-	mesh.nora = na16;
-	mesh.texa = ua16;
-	mesh.inda = ia32;
-
-	a._destroy();
-}
-
-let plugin = new arm.Plugin();
-let h1 = new zui.Handle();
-plugin.drawUI = function(ui) {
-	if (ui.panel(h1, "UV Unwrap")) {
-		if (ui.button("Unwrap Mesh")) {
-			for (const po of arm.Project.paintObjects) {
-				let raw = po.data.raw;
-				var mesh = {
-					posa: raw.vertex_arrays[0].values,
-					nora: raw.vertex_arrays[1].values,
-					texa: null,
-					inda: raw.index_arrays[0].values
-				};
-				unwrap_mesh(mesh);
-				raw.vertex_arrays[0].values = mesh.posa;
-				raw.vertex_arrays[1].values = mesh.nora;
-				raw.vertex_arrays[2].values = mesh.texa;
-				raw.index_arrays[0].values = mesh.inda;
-				let geom = po.data.geom;
-				geom.indices[0] = mesh.inda;
-				geom.ready = false;
-				geom.build();
-			}
-			arm.UtilMesh.mergeMesh();
-		}
-	}
-}
-
-let unwrappers = arm.UtilMesh.unwrappers;
-unwrappers.h["uv_unwrap.js"] = unwrap_mesh;
-plugin.delete = function() {
-	unwrappers.h["uv_unwrap.js"] = null;
-};

二進制
armorpaint/Assets/plugins/wasm/uv_unwrap.wasm


+ 0 - 1
armorpaint/Plugins/Sources/io_dds/build.sh

@@ -1 +0,0 @@
-emcc tinyddsloader.cpp -o import_dds.js -O3 --closure 1 -s ENVIRONMENT='shell' -s WASM_OBJECT_FILES=0 --llvm-lto 1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ALLOW_MEMORY_GROWTH=1 -fno-rtti -fno-exceptions

+ 7 - 12
armorpaint/Plugins/Sources/io_dds/tinyddsloader.cpp

@@ -1,10 +1,5 @@
 #define TINYDDSLOADER_IMPLEMENTATION
 #define TINYDDSLOADER_IMPLEMENTATION
 #include "tinyddsloader.h"
 #include "tinyddsloader.h"
-#ifdef WITH_PLUGIN_EMBED
-#define EMSCRIPTEN_KEEPALIVE
-#else
-#include <emscripten.h>
-#endif
 using namespace tinyddsloader;
 using namespace tinyddsloader;
 
 
 static void *buf; /* Pointer to dds file data */
 static void *buf; /* Pointer to dds file data */
@@ -15,13 +10,13 @@ static uint32_t w;
 static uint32_t h;
 static uint32_t h;
 static uint32_t format;
 static uint32_t format;
 
 
-EMSCRIPTEN_KEEPALIVE uint8_t *io_dds_init(int bufSize) {
+uint8_t *io_dds_init(int bufSize) {
 	size = bufSize;
 	size = bufSize;
 	buf = (uint8_t *)malloc(sizeof(uint8_t) * bufSize);
 	buf = (uint8_t *)malloc(sizeof(uint8_t) * bufSize);
 	return (uint8_t *)buf;
 	return (uint8_t *)buf;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE void io_dds_parse() {
+void io_dds_parse() {
 	if (pixels != NULL) {
 	if (pixels != NULL) {
 		free(pixels);
 		free(pixels);
 	}
 	}
@@ -44,12 +39,12 @@ EMSCRIPTEN_KEEPALIVE void io_dds_parse() {
 	pixels = (uint8_t *)dds.GetImageData(0, 0)->m_mem;
 	pixels = (uint8_t *)dds.GetImageData(0, 0)->m_mem;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE void io_dds_destroy() {
+void io_dds_destroy() {
 	free(buf);
 	free(buf);
 	free(pixels);
 	free(pixels);
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE uint8_t *io_dds_get_pixels() { return pixels; }
-EMSCRIPTEN_KEEPALIVE uint32_t io_dds_get_pixels_w() { return w; }
-EMSCRIPTEN_KEEPALIVE uint32_t io_dds_get_pixels_h() { return h; }
-EMSCRIPTEN_KEEPALIVE uint32_t io_dds_get_pixels_format() { return format; }
+uint8_t *io_dds_get_pixels() { return pixels; }
+uint32_t io_dds_get_pixels_w() { return w; }
+uint32_t io_dds_get_pixels_h() { return h; }
+uint32_t io_dds_get_pixels_format() { return format; }

+ 16 - 24
armorpaint/Plugins/Sources/io_fbx/io_fbx.c

@@ -2,12 +2,6 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <math.h>
 #include <math.h>
 
 
-#ifdef WITH_PLUGIN_EMBED
-#define EMSCRIPTEN_KEEPALIVE
-#else
-#include <emscripten.h>
-#endif
-
 static uint8_t *buffer = NULL;
 static uint8_t *buffer = NULL;
 static uint32_t bufferLength = 0;
 static uint32_t bufferLength = 0;
 static int bufOff; /* Pointer to fbx file data */
 static int bufOff; /* Pointer to fbx file data */
@@ -26,19 +20,17 @@ static float transform[16];
 static bool has_next = false;
 static bool has_next = false;
 static int current_node;
 static int current_node;
 
 
-EMSCRIPTEN_KEEPALIVE uint8_t *io_fbx_getBuffer() { return buffer; }
-EMSCRIPTEN_KEEPALIVE uint32_t io_fbx_getBufferLength() { return bufferLength; }
+uint8_t *io_fbx_getBuffer() { return buffer; }
+uint32_t io_fbx_getBufferLength() { return bufferLength; }
 
 
 static int allocate(int size) {
 static int allocate(int size) {
-	#ifdef WITH_PLUGIN_EMBED
 	size += size % 4; // Byte align
 	size += size % 4; // Byte align
-	#endif
 	bufferLength += size;
 	bufferLength += size;
 	buffer = buffer == NULL ? (uint8_t *)malloc(bufferLength) : (uint8_t *)realloc(buffer, bufferLength);
 	buffer = buffer == NULL ? (uint8_t *)malloc(bufferLength) : (uint8_t *)realloc(buffer, bufferLength);
 	return bufferLength - size;
 	return bufferLength - size;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE int io_fbx_init(int bufSize) {
+int io_fbx_init(int bufSize) {
 	if (!has_next) {
 	if (!has_next) {
 		current_node = 0;
 		current_node = 0;
 		scale_pos = 0;
 		scale_pos = 0;
@@ -166,7 +158,7 @@ void io_fbx_parse_mesh(ufbx_mesh *mesh) {
 	else colaOff = 0;
 	else colaOff = 0;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE void io_fbx_parse() {
+void io_fbx_parse() {
 	void *buf = &buffer[bufOff];
 	void *buf = &buffer[bufOff];
 	ufbx_load_opts opts = { .generate_missing_normals = true };
 	ufbx_load_opts opts = { .generate_missing_normals = true };
 	ufbx_scene *scene = ufbx_load_memory(buf, size, &opts, NULL);
 	ufbx_scene *scene = ufbx_load_memory(buf, size, &opts, NULL);
@@ -218,19 +210,19 @@ EMSCRIPTEN_KEEPALIVE void io_fbx_parse() {
 	}
 	}
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE void io_fbx_destroy() {
+void io_fbx_destroy() {
 	free(buffer);
 	free(buffer);
 	buffer = NULL;
 	buffer = NULL;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE int io_fbx_get_index_count() { return index_count; }
-EMSCRIPTEN_KEEPALIVE int io_fbx_get_vertex_count() { return vertex_count; }
-EMSCRIPTEN_KEEPALIVE float io_fbx_get_scale_pos() { return scale_pos; }
-EMSCRIPTEN_KEEPALIVE int io_fbx_get_indices() { return indaOff; }
-EMSCRIPTEN_KEEPALIVE int io_fbx_get_positions() { return posaOff; }
-EMSCRIPTEN_KEEPALIVE int io_fbx_get_normals() { return noraOff; }
-EMSCRIPTEN_KEEPALIVE int io_fbx_get_uvs() { return texaOff; }
-EMSCRIPTEN_KEEPALIVE int io_fbx_get_colors() { return colaOff; }
-EMSCRIPTEN_KEEPALIVE char *io_fbx_get_name() { return &name[0]; }
-EMSCRIPTEN_KEEPALIVE float *io_fbx_get_transform() { return &transform[0]; }
-EMSCRIPTEN_KEEPALIVE int io_fbx_has_next() { return has_next; }
+int io_fbx_get_index_count() { return index_count; }
+int io_fbx_get_vertex_count() { return vertex_count; }
+float io_fbx_get_scale_pos() { return scale_pos; }
+int io_fbx_get_indices() { return indaOff; }
+int io_fbx_get_positions() { return posaOff; }
+int io_fbx_get_normals() { return noraOff; }
+int io_fbx_get_uvs() { return texaOff; }
+int io_fbx_get_colors() { return colaOff; }
+char *io_fbx_get_name() { return &name[0]; }
+float *io_fbx_get_transform() { return &transform[0]; }
+int io_fbx_has_next() { return has_next; }

+ 0 - 1
armorpaint/Plugins/Sources/io_gltf/build.sh

@@ -1 +0,0 @@
-emcc cgltf.c -o import_gltf.js -O3 --closure 1 -s ENVIRONMENT='shell' -s WASM_OBJECT_FILES=0 --llvm-lto 1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ALLOW_MEMORY_GROWTH=1 -fno-rtti -fno-exceptions

+ 20 - 27
armorpaint/Plugins/Sources/io_gltf/cgltf.c

@@ -2,11 +2,6 @@
 
 
 #define CGLTF_IMPLEMENTATION
 #define CGLTF_IMPLEMENTATION
 #include "cgltf.h"
 #include "cgltf.h"
-#ifdef WITH_PLUGIN_EMBED
-#define EMSCRIPTEN_KEEPALIVE
-#else
-#include <emscripten.h>
-#endif
 #include <math.h>
 #include <math.h>
 
 
 static uint8_t *buffer = NULL;
 static uint8_t *buffer = NULL;
@@ -24,13 +19,11 @@ static int noraOff = 0;
 static int texaOff = 0;
 static int texaOff = 0;
 static float scale_pos;
 static float scale_pos;
 
 
-EMSCRIPTEN_KEEPALIVE uint8_t *io_gltf_getBuffer() { return buffer; }
-EMSCRIPTEN_KEEPALIVE uint32_t io_gltf_getBufferLength() { return bufferLength; }
+uint8_t *io_gltf_getBuffer() { return buffer; }
+uint32_t io_gltf_getBufferLength() { return bufferLength; }
 
 
 static int allocate(int size) {
 static int allocate(int size) {
-	#ifdef WITH_PLUGIN_EMBED
 	size += size % 4; // Byte align
 	size += size % 4; // Byte align
-	#endif
 	bufferLength += size;
 	bufferLength += size;
 	buffer = buffer == NULL ? (uint8_t *)malloc(bufferLength) : (uint8_t *)realloc(buffer, bufferLength);
 	buffer = buffer == NULL ? (uint8_t *)malloc(bufferLength) : (uint8_t *)realloc(buffer, bufferLength);
 	return bufferLength - size;
 	return bufferLength - size;
@@ -40,7 +33,7 @@ int io_gltf_read_u8_array(cgltf_accessor *a) {
 	cgltf_buffer_view *v = a->buffer_view;
 	cgltf_buffer_view *v = a->buffer_view;
 	unsigned char *ar = (unsigned char *)v->buffer->data + v->offset;
 	unsigned char *ar = (unsigned char *)v->buffer->data + v->offset;
 	int resOff = allocate(sizeof(unsigned int) * v->size);
 	int resOff = allocate(sizeof(unsigned int) * v->size);
-	unsigned int *res = &buffer[resOff];
+	unsigned int *res = (unsigned int *)&buffer[resOff];
 	for (int i = 0; i < v->size; ++i) {
 	for (int i = 0; i < v->size; ++i) {
 		res[i] = ar[i];
 		res[i] = ar[i];
 	}
 	}
@@ -51,7 +44,7 @@ int io_gltf_read_u16_array(cgltf_accessor *a) {
 	cgltf_buffer_view *v = a->buffer_view;
 	cgltf_buffer_view *v = a->buffer_view;
 	unsigned short *ar = (unsigned short *)v->buffer->data + v->offset / 2;
 	unsigned short *ar = (unsigned short *)v->buffer->data + v->offset / 2;
 	int resOff = allocate(sizeof(unsigned int) * v->size / 2);
 	int resOff = allocate(sizeof(unsigned int) * v->size / 2);
-	unsigned int *res = &buffer[resOff];
+	unsigned int *res = (unsigned int *)&buffer[resOff];
 	for (int i = 0; i < v->size / 2; ++i) {
 	for (int i = 0; i < v->size / 2; ++i) {
 		res[i] = ar[i];
 		res[i] = ar[i];
 	}
 	}
@@ -62,7 +55,7 @@ int io_gltf_read_u32_array(cgltf_accessor *a) {
 	cgltf_buffer_view *v = a->buffer_view;
 	cgltf_buffer_view *v = a->buffer_view;
 	unsigned int *ar = (unsigned int *)v->buffer->data + v->offset / 4;
 	unsigned int *ar = (unsigned int *)v->buffer->data + v->offset / 4;
 	int resOff = allocate(sizeof(unsigned int) * v->size / 4);
 	int resOff = allocate(sizeof(unsigned int) * v->size / 4);
-	unsigned int *res = &buffer[resOff];
+	unsigned int *res = (unsigned int *)&buffer[resOff];
 	for (int i = 0; i < v->size / 4; ++i) {
 	for (int i = 0; i < v->size / 4; ++i) {
 		res[i] = ar[i];
 		res[i] = ar[i];
 	}
 	}
@@ -79,15 +72,15 @@ float *io_gltf_read_f32_array_malloc(cgltf_accessor *a) {
 	return res;
 	return res;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE int io_gltf_init(int bufSize) {
+int io_gltf_init(int bufSize) {
 	size = bufSize;
 	size = bufSize;
 	bufOff = allocate(sizeof(char) * bufSize);
 	bufOff = allocate(sizeof(char) * bufSize);
 	return bufOff;
 	return bufOff;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE void io_gltf_parse() {
+void io_gltf_parse() {
 	cgltf_options options = {0};
 	cgltf_options options = {0};
-	char *buf = &buffer[bufOff];
+	char *buf = (char *)&buffer[bufOff];
 	cgltf_result result = cgltf_parse(&options, buf, size, &data);
 	cgltf_result result = cgltf_parse(&options, buf, size, &data);
 	if (result != cgltf_result_success) { return; }
 	if (result != cgltf_result_success) { return; }
 	cgltf_load_buffers(&options, data, NULL);
 	cgltf_load_buffers(&options, data, NULL);
@@ -137,7 +130,7 @@ EMSCRIPTEN_KEEPALIVE void io_gltf_parse() {
 
 
 	// Pack into 16bit
 	// Pack into 16bit
 	posaOff = allocate(sizeof(short) * vertex_count * 4);
 	posaOff = allocate(sizeof(short) * vertex_count * 4);
-	short *posa = &buffer[posaOff];
+	short *posa = (short *)&buffer[posaOff];
 	for (int i = 0; i < vertex_count; ++i) {
 	for (int i = 0; i < vertex_count; ++i) {
 		posa[i * 4    ] = posa32[i * 3    ] * 32767 * inv;
 		posa[i * 4    ] = posa32[i * 3    ] * 32767 * inv;
 		posa[i * 4 + 1] = posa32[i * 3 + 1] * 32767 * inv;
 		posa[i * 4 + 1] = posa32[i * 3 + 1] * 32767 * inv;
@@ -145,7 +138,7 @@ EMSCRIPTEN_KEEPALIVE void io_gltf_parse() {
 	}
 	}
 
 
 	noraOff = allocate(sizeof(short) * vertex_count * 2);
 	noraOff = allocate(sizeof(short) * vertex_count * 2);
-	short *nora = &buffer[noraOff];
+	short *nora = (short *)&buffer[noraOff];
 	if (nora32 != NULL) {
 	if (nora32 != NULL) {
 		for (int i = 0; i < vertex_count; ++i) {
 		for (int i = 0; i < vertex_count; ++i) {
 			nora[i * 2    ] = nora32[i * 3    ] * 32767;
 			nora[i * 2    ] = nora32[i * 3    ] * 32767;
@@ -156,7 +149,7 @@ EMSCRIPTEN_KEEPALIVE void io_gltf_parse() {
 	}
 	}
 	else {
 	else {
 		// Calc normals
 		// Calc normals
-		int *inda = &buffer[indaOff];
+		int *inda = (int *)&buffer[indaOff];
 		for (int i = 0; i < index_count / 3; ++i) {
 		for (int i = 0; i < index_count / 3; ++i) {
 			int i1 = inda[i * 3    ];
 			int i1 = inda[i * 3    ];
 			int i2 = inda[i * 3 + 1];
 			int i2 = inda[i * 3 + 1];
@@ -193,7 +186,7 @@ EMSCRIPTEN_KEEPALIVE void io_gltf_parse() {
 
 
 	if (texa32 != NULL) {
 	if (texa32 != NULL) {
 		texaOff = allocate(sizeof(short) * vertex_count * 2);
 		texaOff = allocate(sizeof(short) * vertex_count * 2);
-		short *texa = &buffer[texaOff];
+		short *texa = (short *)&buffer[texaOff];
 		for (int i = 0; i < vertex_count; ++i) {
 		for (int i = 0; i < vertex_count; ++i) {
 			texa[i * 2    ] = texa32[i * 2    ] * 32767;
 			texa[i * 2    ] = texa32[i * 2    ] * 32767;
 			texa[i * 2 + 1] = texa32[i * 2 + 1] * 32767;
 			texa[i * 2 + 1] = texa32[i * 2 + 1] * 32767;
@@ -202,16 +195,16 @@ EMSCRIPTEN_KEEPALIVE void io_gltf_parse() {
 	}
 	}
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE void io_gltf_destroy() {
+void io_gltf_destroy() {
 	cgltf_free(data);
 	cgltf_free(data);
 	free(buffer);
 	free(buffer);
 	buffer = NULL;
 	buffer = NULL;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE int io_gltf_get_index_count() { return index_count; }
-EMSCRIPTEN_KEEPALIVE int io_gltf_get_vertex_count() { return vertex_count; }
-EMSCRIPTEN_KEEPALIVE float io_gltf_get_scale_pos() { return scale_pos; }
-EMSCRIPTEN_KEEPALIVE int io_gltf_get_indices() { return indaOff; }
-EMSCRIPTEN_KEEPALIVE int io_gltf_get_positions() { return posaOff; }
-EMSCRIPTEN_KEEPALIVE int io_gltf_get_normals() { return noraOff; }
-EMSCRIPTEN_KEEPALIVE int io_gltf_get_uvs() { return texaOff; }
+int io_gltf_get_index_count() { return index_count; }
+int io_gltf_get_vertex_count() { return vertex_count; }
+float io_gltf_get_scale_pos() { return scale_pos; }
+int io_gltf_get_indices() { return indaOff; }
+int io_gltf_get_positions() { return posaOff; }
+int io_gltf_get_normals() { return noraOff; }
+int io_gltf_get_uvs() { return texaOff; }

+ 0 - 1
armorpaint/Plugins/Sources/io_svg/build.sh

@@ -1 +0,0 @@
-emcc nanosvg.c -o import_svg.js -O3 --closure 1 -s ENVIRONMENT='shell' -s WASM_OBJECT_FILES=0 --llvm-lto 1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ALLOW_MEMORY_GROWTH=1 -fno-rtti -fno-exceptions

+ 9 - 16
armorpaint/Plugins/Sources/io_svg/nanosvg.c

@@ -9,11 +9,6 @@
 #include "nanosvg.h"
 #include "nanosvg.h"
 #define NANOSVGRAST_IMPLEMENTATION
 #define NANOSVGRAST_IMPLEMENTATION
 #include "nanosvgrast.h"
 #include "nanosvgrast.h"
-#ifdef WITH_PLUGIN_EMBED
-#define EMSCRIPTEN_KEEPALIVE
-#else
-#include <emscripten.h>
-#endif
 
 
 static uint8_t *buffer = NULL;
 static uint8_t *buffer = NULL;
 static uint32_t bufferLength = 0;
 static uint32_t bufferLength = 0;
@@ -22,25 +17,23 @@ static int pixelsOff; /* Rasterized pixel output */
 static int w;
 static int w;
 static int h;
 static int h;
 
 
-EMSCRIPTEN_KEEPALIVE uint8_t *io_svg_getBuffer() { return buffer; }
-EMSCRIPTEN_KEEPALIVE uint32_t io_svg_getBufferLength() { return bufferLength; }
+uint8_t *io_svg_getBuffer() { return buffer; }
+uint32_t io_svg_getBufferLength() { return bufferLength; }
 
 
 static int allocate(int size) {
 static int allocate(int size) {
-	#ifdef WITH_PLUGIN_EMBED
 	size += size % 4; // Byte align
 	size += size % 4; // Byte align
-	#endif
 	bufferLength += size;
 	bufferLength += size;
 	buffer = buffer == NULL ? (uint8_t *)malloc(bufferLength) : (uint8_t *)realloc(buffer, bufferLength);
 	buffer = buffer == NULL ? (uint8_t *)malloc(bufferLength) : (uint8_t *)realloc(buffer, bufferLength);
 	return bufferLength - size;
 	return bufferLength - size;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE int io_svg_init(int buf_size) {
+int io_svg_init(int buf_size) {
 	bufOff = allocate(sizeof(char) * buf_size);
 	bufOff = allocate(sizeof(char) * buf_size);
 	return bufOff;
 	return bufOff;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE void io_svg_parse() {
-	char *buf = &buffer[bufOff];
+void io_svg_parse() {
+	char *buf = (char *)&buffer[bufOff];
 	NSVGimage *image = nsvgParse(buf, "px", 96.0f);
 	NSVGimage *image = nsvgParse(buf, "px", 96.0f);
 	w = (int)image->width;
 	w = (int)image->width;
 	h = (int)image->height;
 	h = (int)image->height;
@@ -53,11 +46,11 @@ EMSCRIPTEN_KEEPALIVE void io_svg_parse() {
 	nsvgDeleteRasterizer(rast);
 	nsvgDeleteRasterizer(rast);
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE int io_svg_get_pixels() { return pixelsOff; }
-EMSCRIPTEN_KEEPALIVE int io_svg_get_pixels_w() { return w; }
-EMSCRIPTEN_KEEPALIVE int io_svg_get_pixels_h() { return h; }
+int io_svg_get_pixels() { return pixelsOff; }
+int io_svg_get_pixels_w() { return w; }
+int io_svg_get_pixels_h() { return h; }
 
 
-EMSCRIPTEN_KEEPALIVE void io_svg_destroy() {
+void io_svg_destroy() {
 	free(buffer);
 	free(buffer);
 	buffer = NULL;
 	buffer = NULL;
 }
 }

+ 0 - 1
armorpaint/Plugins/Sources/io_usd/build.sh

@@ -1 +0,0 @@
-emcc io_usd.cc tinyusdz/tinyusdz.cc tinyusdz/integerCoding.cpp tinyusdz/lz4-compression.cc tinyusdz/pxrLZ4/lz4.cpp -o import_usd.js -O3 --closure 1 -DLZ4_DISABLE_DEPRECATE_WARNINGS -s ENVIRONMENT='shell' -s WASM_OBJECT_FILES=0 --llvm-lto 1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ALLOW_MEMORY_GROWTH=1 -fno-rtti -fno-exceptions

+ 12 - 19
armorpaint/Plugins/Sources/io_usd/io_usd.cc

@@ -1,10 +1,5 @@
 #include "tinyusdz/tinyusdz.hh"
 #include "tinyusdz/tinyusdz.hh"
 #include <math.h>
 #include <math.h>
-#ifdef WITH_PLUGIN_EMBED
-#define EMSCRIPTEN_KEEPALIVE
-#else
-#include <emscripten.h>
-#endif
 
 
 static uint8_t *buffer = NULL;
 static uint8_t *buffer = NULL;
 static uint32_t bufferLength = 0;
 static uint32_t bufferLength = 0;
@@ -19,25 +14,23 @@ static int noraOff;
 static int texaOff;
 static int texaOff;
 static float scale_pos;
 static float scale_pos;
 
 
-extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *io_usd_getBuffer() { return buffer; }
-extern "C" EMSCRIPTEN_KEEPALIVE uint32_t io_usd_getBufferLength() { return bufferLength; }
+extern "C" uint8_t *io_usd_getBuffer() { return buffer; }
+extern "C" uint32_t io_usd_getBufferLength() { return bufferLength; }
 
 
 static int allocate(int size) {
 static int allocate(int size) {
-	#ifdef WITH_PLUGIN_EMBED
 	size += size % 4; // Byte align
 	size += size % 4; // Byte align
-	#endif
 	bufferLength += size;
 	bufferLength += size;
 	buffer = buffer == NULL ? (uint8_t *)malloc(bufferLength) : (uint8_t *)realloc(buffer, bufferLength);
 	buffer = buffer == NULL ? (uint8_t *)malloc(bufferLength) : (uint8_t *)realloc(buffer, bufferLength);
 	return bufferLength - size;
 	return bufferLength - size;
 }
 }
 
 
-extern "C" EMSCRIPTEN_KEEPALIVE int io_usd_init(int bufSize) {
+extern "C" int io_usd_init(int bufSize) {
 	size = bufSize;
 	size = bufSize;
 	bufOff = allocate(sizeof(uint8_t) * bufSize);
 	bufOff = allocate(sizeof(uint8_t) * bufSize);
 	return bufOff;
 	return bufOff;
 }
 }
 
 
-extern "C" EMSCRIPTEN_KEEPALIVE void io_usd_parse() {
+extern "C" void io_usd_parse() {
 	tinyusdz::Scene scene;
 	tinyusdz::Scene scene;
 	std::string warn;
 	std::string warn;
 	std::string err;
 	std::string err;
@@ -160,15 +153,15 @@ extern "C" EMSCRIPTEN_KEEPALIVE void io_usd_parse() {
 	}
 	}
 }
 }
 
 
-extern "C" EMSCRIPTEN_KEEPALIVE void io_usd_destroy() {
+extern "C" void io_usd_destroy() {
 	free(buffer);
 	free(buffer);
 	buffer = NULL;
 	buffer = NULL;
 }
 }
 
 
-extern "C" EMSCRIPTEN_KEEPALIVE int io_usd_get_index_count() { return index_count; }
-extern "C" EMSCRIPTEN_KEEPALIVE int io_usd_get_vertex_count() { return vertex_count; }
-extern "C" EMSCRIPTEN_KEEPALIVE float io_usd_get_scale_pos() { return scale_pos; }
-extern "C" EMSCRIPTEN_KEEPALIVE int io_usd_get_indices() { return indaOff; }
-extern "C" EMSCRIPTEN_KEEPALIVE int io_usd_get_positions() { return posaOff; }
-extern "C" EMSCRIPTEN_KEEPALIVE int io_usd_get_normals() { return noraOff; }
-extern "C" EMSCRIPTEN_KEEPALIVE int io_usd_get_uvs() { return texaOff; }
+extern "C" int io_usd_get_index_count() { return index_count; }
+extern "C" int io_usd_get_vertex_count() { return vertex_count; }
+extern "C" float io_usd_get_scale_pos() { return scale_pos; }
+extern "C" int io_usd_get_indices() { return indaOff; }
+extern "C" int io_usd_get_positions() { return posaOff; }
+extern "C" int io_usd_get_normals() { return noraOff; }
+extern "C" int io_usd_get_uvs() { return texaOff; }

+ 0 - 1
armorpaint/Plugins/Sources/proc_xatlas/build.sh

@@ -1 +0,0 @@
-emcc xatlas.cpp -o xatlas.js -std=c++11 -O3 --closure 1 -s ENVIRONMENT='shell' -s WASM_OBJECT_FILES=0 --llvm-lto 1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ALLOW_MEMORY_GROWTH=1 -fno-rtti -fno-exceptions

+ 18 - 25
armorpaint/Plugins/Sources/proc_xatlas/xatlas.cpp

@@ -33,12 +33,7 @@ https://github.com/brandonpelfrey/Fast-BVH
 MIT License
 MIT License
 Copyright (c) 2012 Brandon Pelfrey
 Copyright (c) 2012 Brandon Pelfrey
 */
 */
-#ifdef WITH_PLUGIN_EMBED
-#define EMSCRIPTEN_KEEPALIVE
 #define XA_MULTITHREADED 1
 #define XA_MULTITHREADED 1
-#else
-#include <emscripten.h>
-#endif
 #include "xatlas.h"
 #include "xatlas.h"
 #ifndef XATLAS_C_API
 #ifndef XATLAS_C_API
 #define XATLAS_C_API 0
 #define XATLAS_C_API 0
@@ -10063,31 +10058,29 @@ static uint8_t *buffer = NULL;
 static uint32_t bufferLength = 0;
 static uint32_t bufferLength = 0;
 static int vertexCount = 0;
 static int vertexCount = 0;
 static int indexCount = 0;
 static int indexCount = 0;
-static int positionsOff = NULL;
-static int normalsOff = NULL;
-static int indicesOff = NULL;
+static int positionsOff = 0;
+static int normalsOff = 0;
+static int indicesOff = 0;
 
 
 static int allocate(int size) {
 static int allocate(int size) {
-	#ifdef WITH_PLUGIN_EMBED
 	size += size % 4; // Byte align
 	size += size % 4; // Byte align
-	#endif
 	bufferLength += size;
 	bufferLength += size;
 	buffer = buffer == NULL ? (uint8_t *)malloc(bufferLength) : (uint8_t *)realloc(buffer, bufferLength);
 	buffer = buffer == NULL ? (uint8_t *)malloc(bufferLength) : (uint8_t *)realloc(buffer, bufferLength);
 	return bufferLength - size;
 	return bufferLength - size;
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE void proc_xatlas_setVertexCount(int i) {
+void proc_xatlas_setVertexCount(int i) {
 	vertexCount = i;
 	vertexCount = i;
 	positionsOff = allocate(sizeof(float) * vertexCount * 3);
 	positionsOff = allocate(sizeof(float) * vertexCount * 3);
 	normalsOff = allocate(sizeof(float) * vertexCount * 3);
 	normalsOff = allocate(sizeof(float) * vertexCount * 3);
 }
 }
-EMSCRIPTEN_KEEPALIVE void proc_xatlas_setIndexCount(int i) {
+void proc_xatlas_setIndexCount(int i) {
 	indexCount = i;
 	indexCount = i;
 	indicesOff = allocate(sizeof(unsigned int) * indexCount);
 	indicesOff = allocate(sizeof(unsigned int) * indexCount);
 }
 }
-EMSCRIPTEN_KEEPALIVE int proc_xatlas_setPositions() { return positionsOff; }
-EMSCRIPTEN_KEEPALIVE int proc_xatlas_setNormals() { return normalsOff; }
-EMSCRIPTEN_KEEPALIVE int proc_xatlas_setIndices() { return indicesOff; }
+int proc_xatlas_setPositions() { return positionsOff; }
+int proc_xatlas_setNormals() { return normalsOff; }
+int proc_xatlas_setIndices() { return indicesOff; }
 
 
 static int vertexCountOut = 0;
 static int vertexCountOut = 0;
 static int indexCountOut = 0;
 static int indexCountOut = 0;
@@ -10096,16 +10089,16 @@ static int normalsOutOff = 0;
 static int uvsOutOff = 0;
 static int uvsOutOff = 0;
 static int indicesOutOff = 0;
 static int indicesOutOff = 0;
 
 
-EMSCRIPTEN_KEEPALIVE uint8_t *proc_xatlas_getBuffer() { return buffer; }
-EMSCRIPTEN_KEEPALIVE uint32_t proc_xatlas_getBufferLength() { return bufferLength; }
-EMSCRIPTEN_KEEPALIVE int proc_xatlas_getVertexCount() { return vertexCountOut; }
-EMSCRIPTEN_KEEPALIVE int proc_xatlas_getIndexCount() { return indexCountOut; }
-EMSCRIPTEN_KEEPALIVE int proc_xatlas_getPositions() { return positionsOutOff; }
-EMSCRIPTEN_KEEPALIVE int proc_xatlas_getNormals() { return normalsOutOff; }
-EMSCRIPTEN_KEEPALIVE int proc_xatlas_getUVs() { return uvsOutOff; }
-EMSCRIPTEN_KEEPALIVE int proc_xatlas_getIndices() { return indicesOutOff; }
+uint8_t *proc_xatlas_getBuffer() { return buffer; }
+uint32_t proc_xatlas_getBufferLength() { return bufferLength; }
+int proc_xatlas_getVertexCount() { return vertexCountOut; }
+int proc_xatlas_getIndexCount() { return indexCountOut; }
+int proc_xatlas_getPositions() { return positionsOutOff; }
+int proc_xatlas_getNormals() { return normalsOutOff; }
+int proc_xatlas_getUVs() { return uvsOutOff; }
+int proc_xatlas_getIndices() { return indicesOutOff; }
 
 
-EMSCRIPTEN_KEEPALIVE void proc_xatlas_unwrap() {
+void proc_xatlas_unwrap() {
     atlas = xatlas::Create();
     atlas = xatlas::Create();
 	xatlas::MeshDecl meshDecl;
 	xatlas::MeshDecl meshDecl;
 	meshDecl.vertexCount = vertexCount;
 	meshDecl.vertexCount = vertexCount;
@@ -10149,7 +10142,7 @@ EMSCRIPTEN_KEEPALIVE void proc_xatlas_unwrap() {
 	memcpy(buffer + indicesOutOff, mesh.indexArray, sizeof(unsigned int) * indexCountOut);
 	memcpy(buffer + indicesOutOff, mesh.indexArray, sizeof(unsigned int) * indexCountOut);
 }
 }
 
 
-EMSCRIPTEN_KEEPALIVE void proc_xatlas_destroy() {
+void proc_xatlas_destroy() {
 	xatlas::Destroy(atlas);
 	xatlas::Destroy(atlas);
 	free(buffer);
 	free(buffer);
 	buffer = NULL;
 	buffer = NULL;

+ 1 - 8
armorpaint/project.js

@@ -25,16 +25,9 @@ else if (flags.ios) {
 	project.addAssets("Assets/readme/readme_ios.txt", { destination: "{name}" });
 	project.addAssets("Assets/readme/readme_ios.txt", { destination: "{name}" });
 }
 }
 
 
-if (flags.plugin_embed) {
-	project.addAssets("Assets/plugins/embed/*", { destination: "data/plugins/{name}" });
-}
-else {
-	project.addAssets("Assets/plugins/wasm/*", { destination: "data/plugins/{name}" });
-}
-
 if (flags.physics) {
 if (flags.physics) {
 	// project.addDefine("arm_physics");
 	// project.addDefine("arm_physics");
-	// project.addAssets("Assets/plugins/wasm/ammo/*", { destination: "data/plugins/{name}" });
+	// project.addAssets("Assets/plugins/ammo/*", { destination: "data/plugins/{name}" });
 }
 }
 
 
 if (flags.raytrace) {
 if (flags.raytrace) {

+ 1 - 8
armorsculpt/project.js

@@ -25,16 +25,9 @@ else if (flags.ios) {
 	project.addAssets("Assets/readme/readme_ios.txt", { destination: "{name}" });
 	project.addAssets("Assets/readme/readme_ios.txt", { destination: "{name}" });
 }
 }
 
 
-if (flags.plugin_embed) {
-	project.addAssets("Assets/plugins/embed/*", { destination: "data/plugins/{name}" });
-}
-else {
-	project.addAssets("Assets/plugins/wasm/*", { destination: "data/plugins/{name}" });
-}
-
 if (flags.physics) {
 if (flags.physics) {
 	project.addDefine("arm_physics");
 	project.addDefine("arm_physics");
-	project.addAssets("Assets/plugins/wasm/ammo/*", { destination: "data/plugins/{name}" });
+	project.addAssets("Assets/plugins/ammo/*", { destination: "data/plugins/{name}" });
 }
 }
 
 
 resolve(project);
 resolve(project);

+ 2 - 3
base/Sources/BoxPreferences.ts

@@ -589,7 +589,7 @@ plugin.drawUI = (ui) { =>
 					});
 					});
 				}
 				}
 				if (ui.button(tr("Import"))) {
 				if (ui.button(tr("Import"))) {
-					UIFiles.show("js,wasm,zip", false, false, (path: string) => {
+					UIFiles.show("js,zip", false, false, (path: string) => {
 						ImportPlugin.run(path);
 						ImportPlugin.run(path);
 					});
 					});
 				}
 				}
@@ -603,8 +603,7 @@ plugin.drawUI = (ui) { =>
 				let h = Zui.handle("boxpreferences_56", { selected: false });
 				let h = Zui.handle("boxpreferences_56", { selected: false });
 				for (let f of BoxPreferences.filesPlugin) {
 				for (let f of BoxPreferences.filesPlugin) {
 					let isJs = f.endsWith(".js");
 					let isJs = f.endsWith(".js");
-					let isWasm = false; //f.endsWith(".wasm");
-					if (!isJs && !isWasm) continue;
+					if (!isJs) continue;
 					let enabled = Config.raw.plugins.indexOf(f) >= 0;
 					let enabled = Config.raw.plugins.indexOf(f) >= 0;
 					h.selected = enabled;
 					h.selected = enabled;
 					let tag = isJs ? f.split(".")[0] : f;
 					let tag = isJs ? f.split(".")[0] : f;

+ 0 - 2
base/Sources/Path.ts

@@ -105,8 +105,6 @@ class Path {
 	static isPlugin = (path: string): bool => {
 	static isPlugin = (path: string): bool => {
 		let p = path.toLowerCase();
 		let p = path.toLowerCase();
 		return p.endsWith(".js");
 		return p.endsWith(".js");
-			   // p.endsWith(".wasm") ||
-			   // p.endsWith(".zip");
 	}
 	}
 
 
 	static isJson = (path: string): bool => {
 	static isJson = (path: string): bool => {

+ 1 - 7
base/project.js

@@ -7,7 +7,6 @@ flags.vulkan = process.argv.indexOf("vulkan") >= 0;
 flags.metal = process.argv.indexOf("metal") >= 0;
 flags.metal = process.argv.indexOf("metal") >= 0;
 flags.raytrace = flags.d3d12 || flags.vulkan || flags.metal;
 flags.raytrace = flags.d3d12 || flags.vulkan || flags.metal;
 flags.snapshot = process.argv.indexOf("--snapshot") >= 0;
 flags.snapshot = process.argv.indexOf("--snapshot") >= 0;
-flags.plugin_embed = true; // flags.ios;
 flags.physics = !flags.ios;
 flags.physics = !flags.ios;
 flags.voxels = !flags.raytrace && !flags.android && !flags.ios;
 flags.voxels = !flags.raytrace && !flags.android && !flags.ios;
 
 
@@ -28,9 +27,6 @@ flags.on_c_project_created = async function(c_project, platform, graphics) {
 		c_project.addDefine("KORE_VKRT");
 		c_project.addDefine("KORE_VKRT");
 		await c_project.addProject("../" + dir + "/glsl_to_spirv");
 		await c_project.addProject("../" + dir + "/glsl_to_spirv");
 	}
 	}
-	// if (platform === "ios") {
-		flags.with_plugin_embed = true;
-	// }
 
 
 	if (flags.with_onnx) {
 	if (flags.with_onnx) {
 		c_project.addDefine("WITH_ONNX");
 		c_project.addDefine("WITH_ONNX");
@@ -56,9 +52,7 @@ flags.on_c_project_created = async function(c_project, platform, graphics) {
 		}
 		}
 	}
 	}
 
 
-	if (flags.with_plugin_embed) {
-		await c_project.addProject("../" + dir + "/Plugins");
-	}
+	await c_project.addProject("../" + dir + "/Plugins");
 };
 };
 
 
 let project = new Project("Base");
 let project = new Project("Base");

Some files were not shown because too many files changed in this diff