You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
47 KiB
129 lines
47 KiB
2 years ago
|
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
|
||
|
|
||
|
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||
|
|
||
|
cachedTextDecoder.decode();
|
||
|
|
||
|
let cachegetUint8Memory0 = null;
|
||
|
function getUint8Memory0() {
|
||
|
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
||
|
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||
|
}
|
||
|
return cachegetUint8Memory0;
|
||
|
}
|
||
|
|
||
|
function getStringFromWasm0(ptr, len) {
|
||
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
||
|
}
|
||
|
|
||
|
const heap = new Array(32).fill(undefined);
|
||
|
|
||
|
heap.push(undefined, null, true, false);
|
||
|
|
||
|
let heap_next = heap.length;
|
||
|
|
||
|
function addHeapObject(obj) {
|
||
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||
|
const idx = heap_next;
|
||
|
heap_next = heap[idx];
|
||
|
|
||
|
heap[idx] = obj;
|
||
|
return idx;
|
||
|
}
|
||
|
|
||
|
function getObject(idx) { return heap[idx]; }
|
||
|
|
||
|
function dropObject(idx) {
|
||
|
if (idx < 36) return;
|
||
|
heap[idx] = heap_next;
|
||
|
heap_next = idx;
|
||
|
}
|
||
|
|
||
|
function takeObject(idx) {
|
||
|
const ret = getObject(idx);
|
||
|
dropObject(idx);
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
let cachegetFloat32Memory0 = null;
|
||
|
function getFloat32Memory0() {
|
||
|
if (cachegetFloat32Memory0 === null || cachegetFloat32Memory0.buffer !== wasm.memory.buffer) {
|
||
|
cachegetFloat32Memory0 = new Float32Array(wasm.memory.buffer);
|
||
|
}
|
||
|
return cachegetFloat32Memory0;
|
||
|
}
|
||
|
|
||
|
let WASM_VECTOR_LEN = 0;
|
||
|
|
||
|
function passArrayF32ToWasm0(arg, malloc) {
|
||
|
const ptr = malloc(arg.length * 4);
|
||
|
getFloat32Memory0().set(arg, ptr / 4);
|
||
|
WASM_VECTOR_LEN = arg.length;
|
||
|
return ptr;
|
||
|
}
|
||
|
|
||
|
let cachegetInt32Memory0 = null;
|
||
|
function getInt32Memory0() {
|
||
|
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
||
|
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||
|
}
|
||
|
return cachegetInt32Memory0;
|
||
|
}
|
||
|
|
||
|
function getArrayF32FromWasm0(ptr, len) {
|
||
|
return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
||
|
}
|
||
|
/**
|
||
|
* Generates vertex tangents for the given position/normal/texcoord attributes.
|
||
|
* @param {Float32Array} position
|
||
|
* @param {Float32Array} normal
|
||
|
* @param {Float32Array} texcoord
|
||
|
* @returns {Float32Array}
|
||
|
*/
|
||
|
export function generateTangents(position, normal, texcoord) {
|
||
|
try {
|
||
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||
|
var ptr0 = passArrayF32ToWasm0(position, wasm.__wbindgen_malloc);
|
||
|
var len0 = WASM_VECTOR_LEN;
|
||
|
var ptr1 = passArrayF32ToWasm0(normal, wasm.__wbindgen_malloc);
|
||
|
var len1 = WASM_VECTOR_LEN;
|
||
|
var ptr2 = passArrayF32ToWasm0(texcoord, wasm.__wbindgen_malloc);
|
||
|
var len2 = WASM_VECTOR_LEN;
|
||
|
wasm.generateTangents(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
||
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||
|
var v3 = getArrayF32FromWasm0(r0, r1).slice();
|
||
|
wasm.__wbindgen_free(r0, r1 * 4);
|
||
|
return v3;
|
||
|
} finally {
|
||
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export const __wbindgen_string_new = function(arg0, arg1) {
|
||
|
var ret = getStringFromWasm0(arg0, arg1);
|
||
|
return addHeapObject(ret);
|
||
|
};
|
||
|
|
||
|
export const __wbindgen_rethrow = function(arg0) {
|
||
|
throw takeObject(arg0);
|
||
|
};
|
||
|
|
||
|
//
|
||
|
|
||
|
const wasmDataURI = 'data:application/octet-stream;base64,AGFzbQEAAAABiQEWYAN/f38AYAJ/fwBgAn9/AX9gAX8AYAN/f38Bf2AEf39/fwBgAX8Bf2AFf39/f38Bf2ABfwF+YAV/f39/fwBgBH9/f38Bf2ACf38BfWAAAGAHf39/f39/fwBgBX9/fX1/AGACfn8Bf2ABfQF/YAN9fX0Bf2ADf39/AX5gAX8BfWAAAXxgAXwBfAJiAhkuL21pa2t0c3BhY2VfbW9kdWxlX2JnLmpzFV9fd2JpbmRnZW5fc3RyaW5nX25ldwACGS4vbWlra3RzcGFjZV9tb2R1bGVfYmcuanMSX193YmluZGdlbl9yZXRocm93AAMDeXgGAwkABQQCFAcCEwkVAgULBwUPAAAFAAAAAAABBQ4ADQABAQUAAAsBAAAABQIFAgUFAwEBAQEAAQUEERIHAAIAAAABAAAEAAMDAQADAAoGBgMDAwMDAwMBAgMBAwMBAQEKAQEEAgIAAQAMAgIGEAECBgIGCAgIAwEEBQFwASEhBQMBABEGCQF/AUGAgMAACwdlBQZtZW1vcnkCABBnZW5lcmF0ZVRhbmdlbnRzACEfX193YmluZGdlbl9hZGRfdG9fc3RhY2tfcG9pbnRlcgBuEV9fd2JpbmRnZW5fbWFsbG9jAFAPX193YmluZGdlbl9mcmVlAGQJJgEAQQELIHg6cXJ4MnN0eHhEYHh1eXhlD0B3Xh0kS2lddnVtbHh3CvXrAXiUUQQqfwN+Cn0BfCMAQeAGayIBJAAgACgCCCIIQQluIRMQCSE4AkACQAJA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AU3A5gGIAFBiAZqIAFB4ANqIAFBmAZqEBVBASEGAn8gAUG4BWpBBHIgASoCjAYiLyABKgKIBiIyXkEBcyAvIAEqApAGIi9eRXJFDQAaQQEhCyAvIDJeQQFzBEBBACEGIDEhLiABQbgFagwBC0EAIQsgMCEuQQAhBiABQcAFagsqAgAhMCABQaADaiAKQQEQOCABIAo2AtAFIAEgASkDoAM3A8gFIAFBmANqQYAQQQEQOCABQYAQNgLgBSABIAEpA5gDNwPYBSABQZADakGAEEEBEDggAUGAEDYC8AUgASABKQOQAzcD6AUgAUGIA2pBgBBBARA4IAFBgBA2AoAGIAEgASkDiAM3A/gFIAhBCU8EQCABQZgGakEAQQRBCCAGGyALG2ohByAFIQIgCiEDA0AgAUGAA2ogAigCABBhIAFBmAZqIAAgASgCgAMgASgChAMQMSAwIC4gByoCABA8IQQgAUHoBWooAgAgASgC8AUiESAETQ0WIARBAnRqIgQgBCgCAEEBajYCACACQQRqIQIgA0F/aiIDDQALCyABQdgFaigCACABKALgBUUNFUEAIQJBADYCAEEBIQQDQCABQfgCaiABQdgFahBjIAEoAvwCIgMgBEF/aiIHTQ0UIAEoAvgCIAJqKAIAIQMgAUHwAmogAUHoBWoQYyABKAL0AiINIAdNDRMgASgC8AIgAmooAgAhByABQdgFaigCACENIAEoAuAFIhEgBE0NEiACIA1qQQRqIAMgB2o2AgAgAkEEaiECIARBAWoiBEGAEEcNAAsgCEEJTwRAQQAhBCABQZgGakEAQQRBCCAGGyALG2ohCCAFIQMDQCABQegCaiADKAIAEGEgAUGYBmogACABKALoAiABKALsAhAxIDAgLiAIKgIAEDwhAiABQeACaiABQdgFahBjIAEoAuQCIgYgAk0NEiABQcgFaigCACABKALQBSINIAJBAnQiBiABKALgAmooAgAiC00NESABQdgCaiABQfgFahBjIAEoAtwCIg0gAk0NECALQQJ0aiABKALYAiAGaigCAEECdGogBDYCACABQfgFaigCACELIAEoAoAGIgcgAk0NDyAGIAtqIgIgAigCAEEBajYCACADQQRqIQMgCiAEQQFqIgRHDQALCyABQdACaiABQegFahBjIAEoAtQCRQ0MIAEoAtACKAIAIQNBBCECQQEhBANAIAFByAJqIAFB6AVqEGMgASgCzAIiCiAETQ0MIAMgASgCyAIgAmooAgBJBEAgAUHAAmogAUHoBWoQYyABKALEAiIDIARNDQwgASgCwAIgAmooAgAhAwsgAkEEaiECIARBAWoiBEGAEEcNAAsgAUHgA2oiAkIANwIAIAJBCGpCADcCACABQaAGaiABQegDaikDADcDACABIAEpA+ADNwOYBiABQYgGaiABQZgGaiADEEEgASgCiAYhCiABKAKQBiELQQAhBgNAIAFBuAJqIAFB2AVqEGMgASgCvAIiAyAGTQ0KIAFByAVqKAIAIQIgASgC0AUiBCAGQQJ0IgggASgCuAJqKAIAIgNNDQkgAUGwAmogAUHoBWoQYyABKAK0AiIEIAZNDQggASgCsAIgCGooAgAiCEECTwRAIAIgA0ECdGohBEEAIQMgCiECA0AgAUGoAmogBSAEKAIAIgdBAnRqKAIAEGEgAUGYBmogACABKAKoAiABKAKsAhAxIAMgC0YNCSACIAEoApgGNgIAIAJBBGogASgCnAY2AgAgASgCoAYhDSACQQxqIAc2AgAgAkEIaiANNgIAIARBBGohBCACQRBqIQIgCCADQQFqIgNHDQALIAUgCiAAQQAgCEF/ahAECyAGQQFqIgZBgBBHDQALIBNBASATQQFLGyEFIA5BPGohAyABQYgGahBSIAFB+AVqKAIAGiABQfgFahBWIAFB6AVqKAIAGiABQegFahBWIAFB2AVqKAIAGiABQdgFahBWIAFByAVqKAIAGiABQcgFahBWQQAhAkEAIQRBACEGQQAhBwNAIAFBoAJqIAFBwANqEGMgASgCpAIiCiAETQ0GIAEoAqACIAJqKAIAIQogAUGYAmogAUHAA2oQYyABKAKcAiILIARBAWpNDQUgASgCmAIgAmpBB
|
||
|
|
||
|
export let wasm;
|
||
|
|
||
|
export let isReady = false;
|
||
|
|
||
|
export const ready = fetch(wasmDataURI)
|
||
|
.then((res) => res.arrayBuffer())
|
||
|
.then((buffer) => WebAssembly.instantiate(buffer, {
|
||
|
'./mikktspace_module_bg.js': {__wbindgen_string_new, __wbindgen_rethrow}
|
||
|
}))
|
||
|
.then((result) => {
|
||
|
wasm = result.instance.exports;
|
||
|
isReady = true;
|
||
|
});
|