UNPKG

three-stdlib

Version:

stand-alone library of threejs examples

1 lines 21.7 kB
{"version":3,"file":"DRACOLoader.cjs","sources":["../../src/loaders/DRACOLoader.js"],"sourcesContent":["import { BufferAttribute, BufferGeometry, FileLoader, Loader } from 'three'\n\nconst _taskCache = new WeakMap()\n\nclass DRACOLoader extends Loader {\n constructor(manager) {\n super(manager)\n\n this.decoderPath = ''\n this.decoderConfig = {}\n this.decoderBinary = null\n this.decoderPending = null\n\n this.workerLimit = 4\n this.workerPool = []\n this.workerNextTaskID = 1\n this.workerSourceURL = ''\n\n this.defaultAttributeIDs = {\n position: 'POSITION',\n normal: 'NORMAL',\n color: 'COLOR',\n uv: 'TEX_COORD',\n }\n this.defaultAttributeTypes = {\n position: 'Float32Array',\n normal: 'Float32Array',\n color: 'Float32Array',\n uv: 'Float32Array',\n }\n }\n\n setDecoderPath(path) {\n this.decoderPath = path\n\n return this\n }\n\n setDecoderConfig(config) {\n this.decoderConfig = config\n\n return this\n }\n\n setWorkerLimit(workerLimit) {\n this.workerLimit = workerLimit\n\n return this\n }\n\n load(url, onLoad, onProgress, onError) {\n const loader = new FileLoader(this.manager)\n\n loader.setPath(this.path)\n loader.setResponseType('arraybuffer')\n loader.setRequestHeader(this.requestHeader)\n loader.setWithCredentials(this.withCredentials)\n\n loader.load(\n url,\n (buffer) => {\n const taskConfig = {\n attributeIDs: this.defaultAttributeIDs,\n attributeTypes: this.defaultAttributeTypes,\n useUniqueIDs: false,\n }\n\n this.decodeGeometry(buffer, taskConfig).then(onLoad).catch(onError)\n },\n onProgress,\n onError,\n )\n }\n\n /** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */\n decodeDracoFile(buffer, callback, attributeIDs, attributeTypes) {\n const taskConfig = {\n attributeIDs: attributeIDs || this.defaultAttributeIDs,\n attributeTypes: attributeTypes || this.defaultAttributeTypes,\n useUniqueIDs: !!attributeIDs,\n }\n\n this.decodeGeometry(buffer, taskConfig).then(callback)\n }\n\n decodeGeometry(buffer, taskConfig) {\n // TODO: For backward-compatibility, support 'attributeTypes' objects containing\n // references (rather than names) to typed array constructors. These must be\n // serialized before sending them to the worker.\n for (const attribute in taskConfig.attributeTypes) {\n const type = taskConfig.attributeTypes[attribute]\n\n if (type.BYTES_PER_ELEMENT !== undefined) {\n taskConfig.attributeTypes[attribute] = type.name\n }\n }\n\n //\n\n const taskKey = JSON.stringify(taskConfig)\n\n // Check for an existing task using this buffer. A transferred buffer cannot be transferred\n // again from this thread.\n if (_taskCache.has(buffer)) {\n const cachedTask = _taskCache.get(buffer)\n\n if (cachedTask.key === taskKey) {\n return cachedTask.promise\n } else if (buffer.byteLength === 0) {\n // Technically, it would be possible to wait for the previous task to complete,\n // transfer the buffer back, and decode again with the second configuration. That\n // is complex, and I don't know of any reason to decode a Draco buffer twice in\n // different ways, so this is left unimplemented.\n throw new Error(\n 'THREE.DRACOLoader: Unable to re-decode a buffer with different ' +\n 'settings. Buffer has already been transferred.',\n )\n }\n }\n\n //\n\n let worker\n const taskID = this.workerNextTaskID++\n const taskCost = buffer.byteLength\n\n // Obtain a worker and assign a task, and construct a geometry instance\n // when the task completes.\n const geometryPending = this._getWorker(taskID, taskCost)\n .then((_worker) => {\n worker = _worker\n\n return new Promise((resolve, reject) => {\n worker._callbacks[taskID] = { resolve, reject }\n\n worker.postMessage({ type: 'decode', id: taskID, taskConfig, buffer }, [buffer])\n\n // this.debug();\n })\n })\n .then((message) => this._createGeometry(message.geometry))\n\n // Remove task from the task list.\n // Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416)\n geometryPending\n .catch(() => true)\n .then(() => {\n if (worker && taskID) {\n this._releaseTask(worker, taskID)\n\n // this.debug();\n }\n })\n\n // Cache the task result.\n _taskCache.set(buffer, {\n key: taskKey,\n promise: geometryPending,\n })\n\n return geometryPending\n }\n\n _createGeometry(geometryData) {\n const geometry = new BufferGeometry()\n\n if (geometryData.index) {\n geometry.setIndex(new BufferAttribute(geometryData.index.array, 1))\n }\n\n for (let i = 0; i < geometryData.attributes.length; i++) {\n const attribute = geometryData.attributes[i]\n const name = attribute.name\n const array = attribute.array\n const itemSize = attribute.itemSize\n\n geometry.setAttribute(name, new BufferAttribute(array, itemSize))\n }\n\n return geometry\n }\n\n _loadLibrary(url, responseType) {\n const loader = new FileLoader(this.manager)\n loader.setPath(this.decoderPath)\n loader.setResponseType(responseType)\n loader.setWithCredentials(this.withCredentials)\n\n return new Promise((resolve, reject) => {\n loader.load(url, resolve, undefined, reject)\n })\n }\n\n preload() {\n this._initDecoder()\n\n return this\n }\n\n _initDecoder() {\n if (this.decoderPending) return this.decoderPending\n\n const useJS = typeof WebAssembly !== 'object' || this.decoderConfig.type === 'js'\n const librariesPending = []\n\n if (useJS) {\n librariesPending.push(this._loadLibrary('draco_decoder.js', 'text'))\n } else {\n librariesPending.push(this._loadLibrary('draco_wasm_wrapper.js', 'text'))\n librariesPending.push(this._loadLibrary('draco_decoder.wasm', 'arraybuffer'))\n }\n\n this.decoderPending = Promise.all(librariesPending).then((libraries) => {\n const jsContent = libraries[0]\n\n if (!useJS) {\n this.decoderConfig.wasmBinary = libraries[1]\n }\n\n const fn = DRACOWorker.toString()\n\n const body = [\n '/* draco decoder */',\n jsContent,\n '',\n '/* worker */',\n fn.substring(fn.indexOf('{') + 1, fn.lastIndexOf('}')),\n ].join('\\n')\n\n this.workerSourceURL = URL.createObjectURL(new Blob([body]))\n })\n\n return this.decoderPending\n }\n\n _getWorker(taskID, taskCost) {\n return this._initDecoder().then(() => {\n if (this.workerPool.length < this.workerLimit) {\n const worker = new Worker(this.workerSourceURL)\n\n worker._callbacks = {}\n worker._taskCosts = {}\n worker._taskLoad = 0\n\n worker.postMessage({ type: 'init', decoderConfig: this.decoderConfig })\n\n worker.onmessage = function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'decode':\n worker._callbacks[message.id].resolve(message)\n break\n\n case 'error':\n worker._callbacks[message.id].reject(message)\n break\n\n default:\n console.error('THREE.DRACOLoader: Unexpected message, \"' + message.type + '\"')\n }\n }\n\n this.workerPool.push(worker)\n } else {\n this.workerPool.sort(function (a, b) {\n return a._taskLoad > b._taskLoad ? -1 : 1\n })\n }\n\n const worker = this.workerPool[this.workerPool.length - 1]\n worker._taskCosts[taskID] = taskCost\n worker._taskLoad += taskCost\n return worker\n })\n }\n\n _releaseTask(worker, taskID) {\n worker._taskLoad -= worker._taskCosts[taskID]\n delete worker._callbacks[taskID]\n delete worker._taskCosts[taskID]\n }\n\n debug() {\n console.log(\n 'Task load: ',\n this.workerPool.map((worker) => worker._taskLoad),\n )\n }\n\n dispose() {\n for (let i = 0; i < this.workerPool.length; ++i) {\n this.workerPool[i].terminate()\n }\n\n this.workerPool.length = 0\n\n return this\n }\n}\n\n/* WEB WORKER */\n\nfunction DRACOWorker() {\n let decoderConfig\n let decoderPending\n\n onmessage = function (e) {\n const message = e.data\n\n switch (message.type) {\n case 'init':\n decoderConfig = message.decoderConfig\n decoderPending = new Promise(function (resolve /*, reject*/) {\n decoderConfig.onModuleLoaded = function (draco) {\n // Module is Promise-like. Wrap before resolving to avoid loop.\n resolve({ draco: draco })\n }\n\n DracoDecoderModule(decoderConfig)\n })\n break\n\n case 'decode':\n const buffer = message.buffer\n const taskConfig = message.taskConfig\n decoderPending.then((module) => {\n const draco = module.draco\n const decoder = new draco.Decoder()\n const decoderBuffer = new draco.DecoderBuffer()\n decoderBuffer.Init(new Int8Array(buffer), buffer.byteLength)\n\n try {\n const geometry = decodeGeometry(draco, decoder, decoderBuffer, taskConfig)\n\n const buffers = geometry.attributes.map((attr) => attr.array.buffer)\n\n if (geometry.index) buffers.push(geometry.index.array.buffer)\n\n self.postMessage({ type: 'decode', id: message.id, geometry }, buffers)\n } catch (error) {\n console.error(error)\n\n self.postMessage({ type: 'error', id: message.id, error: error.message })\n } finally {\n draco.destroy(decoderBuffer)\n draco.destroy(decoder)\n }\n })\n break\n }\n }\n\n function decodeGeometry(draco, decoder, decoderBuffer, taskConfig) {\n const attributeIDs = taskConfig.attributeIDs\n const attributeTypes = taskConfig.attributeTypes\n\n let dracoGeometry\n let decodingStatus\n\n const geometryType = decoder.GetEncodedGeometryType(decoderBuffer)\n\n if (geometryType === draco.TRIANGULAR_MESH) {\n dracoGeometry = new draco.Mesh()\n decodingStatus = decoder.DecodeBufferToMesh(decoderBuffer, dracoGeometry)\n } else if (geometryType === draco.POINT_CLOUD) {\n dracoGeometry = new draco.PointCloud()\n decodingStatus = decoder.DecodeBufferToPointCloud(decoderBuffer, dracoGeometry)\n } else {\n throw new Error('THREE.DRACOLoader: Unexpected geometry type.')\n }\n\n if (!decodingStatus.ok() || dracoGeometry.ptr === 0) {\n throw new Error('THREE.DRACOLoader: Decoding failed: ' + decodingStatus.error_msg())\n }\n\n const geometry = { index: null, attributes: [] }\n\n // Gather all vertex attributes.\n for (const attributeName in attributeIDs) {\n const attributeType = self[attributeTypes[attributeName]]\n\n let attribute\n let attributeID\n\n // A Draco file may be created with default vertex attributes, whose attribute IDs\n // are mapped 1:1 from their semantic name (POSITION, NORMAL, ...). Alternatively,\n // a Draco file may contain a custom set of attributes, identified by known unique\n // IDs. glTF files always do the latter, and `.drc` files typically do the former.\n if (taskConfig.useUniqueIDs) {\n attributeID = attributeIDs[attributeName]\n attribute = decoder.GetAttributeByUniqueId(dracoGeometry, attributeID)\n } else {\n attributeID = decoder.GetAttributeId(dracoGeometry, draco[attributeIDs[attributeName]])\n\n if (attributeID === -1) continue\n\n attribute = decoder.GetAttribute(dracoGeometry, attributeID)\n }\n\n geometry.attributes.push(decodeAttribute(draco, decoder, dracoGeometry, attributeName, attributeType, attribute))\n }\n\n // Add index.\n if (geometryType === draco.TRIANGULAR_MESH) {\n geometry.index = decodeIndex(draco, decoder, dracoGeometry)\n }\n\n draco.destroy(dracoGeometry)\n\n return geometry\n }\n\n function decodeIndex(draco, decoder, dracoGeometry) {\n const numFaces = dracoGeometry.num_faces()\n const numIndices = numFaces * 3\n const byteLength = numIndices * 4\n\n const ptr = draco._malloc(byteLength)\n decoder.GetTrianglesUInt32Array(dracoGeometry, byteLength, ptr)\n const index = new Uint32Array(draco.HEAPF32.buffer, ptr, numIndices).slice()\n draco._free(ptr)\n\n return { array: index, itemSize: 1 }\n }\n\n function decodeAttribute(draco, decoder, dracoGeometry, attributeName, attributeType, attribute) {\n const numComponents = attribute.num_components()\n const numPoints = dracoGeometry.num_points()\n const numValues = numPoints * numComponents\n const byteLength = numValues * attributeType.BYTES_PER_ELEMENT\n const dataType = getDracoDataType(draco, attributeType)\n\n const ptr = draco._malloc(byteLength)\n decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, attribute, dataType, byteLength, ptr)\n const array = new attributeType(draco.HEAPF32.buffer, ptr, numValues).slice()\n draco._free(ptr)\n\n return {\n name: attributeName,\n array: array,\n itemSize: numComponents,\n }\n }\n\n function getDracoDataType(draco, attributeType) {\n switch (attributeType) {\n case Float32Array:\n return draco.DT_FLOAT32\n case Int8Array:\n return draco.DT_INT8\n case Int16Array:\n return draco.DT_INT16\n case Int32Array:\n return draco.DT_INT32\n case Uint8Array:\n return draco.DT_UINT8\n case Uint16Array:\n return draco.DT_UINT16\n case Uint32Array:\n return draco.DT_UINT32\n }\n }\n}\n\nexport { DRACOLoader }\n"],"names":["Loader","FileLoader","BufferGeometry","BufferAttribute","worker","module"],"mappings":";;;AAEA,MAAM,aAAa,oBAAI,QAAS;AAEhC,MAAM,oBAAoBA,MAAAA,OAAO;AAAA,EAC/B,YAAY,SAAS;AACnB,UAAM,OAAO;AAEb,SAAK,cAAc;AACnB,SAAK,gBAAgB,CAAE;AACvB,SAAK,gBAAgB;AACrB,SAAK,iBAAiB;AAEtB,SAAK,cAAc;AACnB,SAAK,aAAa,CAAE;AACpB,SAAK,mBAAmB;AACxB,SAAK,kBAAkB;AAEvB,SAAK,sBAAsB;AAAA,MACzB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,IAAI;AAAA,IACL;AACD,SAAK,wBAAwB;AAAA,MAC3B,UAAU;AAAA,MACV,QAAQ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