UNPKG

@realsee/five

Version:

Realsee Renderer SDK

261 lines • 65.4 kB
/**
 * @license
 * @realsee/five
 * Generated: 10/8/2026
 * Version: 6.9.2
 * Terms:
 * Realsee SDK License Agreement
 * Update: July 28, 2021
 * THIS LICENSE AGREEMENT BETWEEN YOU AND 【BEIKE REALSEE TECHNOLOGY (HK) 
 * LIMITED】(“Realsee”) FORMS A LEGALLY BINDING CONTRACT BETWEEN YOU AND REALSEE IN 
 * RELATION TO YOUR USE OF THE SDK. This License Agreement accompanies the Realsee 
 * Software Development Kit(s) for the software and related explanatory materials 
 * (the "SDK") and includes any upgrades, modified versions, updates, additions, 
 * and copies of the SDK licensed to You by Realsee.
 * BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE 
 * THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THIS AGREEMENT. YOU ARE 
 * AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO 
 * THE TERMS AND CONDITIONS STATED BELOW.
 * This Agreement applies to Your use of the SDK in the country in which You 
 * legally install it (“Territory”) and is subject to the laws of such Territory 
 * and further subject to Section 12 below. Different terms, conditions, and 
 * limitations may apply to the use of the SDK in any additional countries.
 * 1. DEFINITIONS.
 * “Agreement” means this Realsee SDK License Agreement.
 * “Developer”, “You” and “Your” means the person(s) or entity acquiring or using 
 * the SDK or otherwise exercising rights under the terms of this Agreement.
 * “Documentation” means the technical or other specifications or documentation 
 * that Realsee may provide to You for use in connection with the SDK.
 * “Integrated Product” means any software, website, or on-line service developed 
 * by You based on or using the SDK (collectively, the “Integrated Product”).
 * “Intellectual Property” means any patents, patent rights, trademarks, service 
 * marks, registered and unregistered designs, applications for any of the 
 * foregoing, copyright, and any other similar protected rights in any country and 
 * to the extent recognised by any relevant jurisdiction as intellectual property, 
 * trade secrets, know-how and confidential information. Realsee reserves all 
 * rights not expressly granted to You.
 * “Realsee” means [Beike Realsee Technology (HK) Limited, a company incorporated 
 * and validly existing under the laws of Hong Kong].
 * “SDK” means the Realsee-proprietary Software Development Kits (SDK) provided 
 * hereunder, includes all development tools (including any compiler and debugger), 
 * application programming interfaces (“APIs”), libraries, binary utilities, header 
 * files, Documentation, content, data, code samples, and other materials provided 
 * to You in connection with this Agreement, whether delivered through a download, 
 * or any other media or form, and is licensed, not sold, to You by Realsee for use 
 * only under the terms of this Agreement. The terms of this Agreement will govern 
 * any updates provided by Realsee that replace and/or supplement the original SDK 
 * delivered to You, unless such update is accompanied by a separate license, in 
 * which case the terms of such license will govern.
 * 2. LICENSED USES AND RESTRICTIONS.
 * 2.1 Subject to the restrictions contained in this Section 2, Realsee grants to 
 * You during the term, a limited, non-exclusive, revocable, non-sublicensable, 
 * non-transferable license to install and use the SDK within the Territory only 
 * for the purpose of internal development.
 * 2.2 Restrictions. You acknowledge and agree that, You shall not, and shall 
 * ensure that Your affiliates, employees, agents, representatives, officers, 
 * representatives, and subcontractors do not (directly or indirectly):
 * 2.2.1 decompile, reverse engineer, disassemble or attempt to derive the source 
 * code of, those components of the SDK provided in object code form, or any part 
 * thereof;
 * 2.2.2 remove, alter, or obscure any copyright notice or other proprietary rights 
 * notice on any part of the SDK;
 * 2.2.3 sell, assign, pledge, rent, lease, lend, upload to or host on any website 
 * or server for use by any third party except You, redistribute, or sublicense the 
 * SDK (or any part thereof), or operate the SDK (or any part thereof) in the 
 * capacity of a service bureau or other hosted services provider, in whole or in 
 * part, nor may You enable others to do so;
 * 2.2.4 or alter, modify, customize or improve the SDK, or any part thereof;
 * 2.2.5 use the SDK (or any part thereof) for any illegal purpose, in any manner 
 * that is inconsistent with the terms of this Agreement, or to engage in any 
 * illegal activity;
 * 2.2.6 use the SDK (or any part thereof) in any manner that may damage the 
 * operation of Realsee’s products or services; or
 * 2.2.7 use the SDK or any information contained therein or otherwise provided by 
 * Realsee for the purpose of developing, or having developed, any product 
 * competitive with any Realsee product or service, as determined by Realsee in its 
 * sole discretion;
 * 2.2.8 include any portion of the SDK in Your Developer products.
 * 2.3 Realsee has the right to impose reasonable conditions such as a reasonable 
 * fee for use of the SDK in Integrated Product in the future.
 * 2.4 You may make a limited number of copies of the SDK to be used by Your 
 * employees or consultants as provided herein, and not for general business 
 * purposes, and such employees or consultants shall be subject to the obligations 
 * and restrictions in this Agreement.
 * 2.5 All licenses not expressly granted in this Agreement are reserved and no 
 * other licenses, immunity, or rights, express or implied, are granted by Realsee, 
 * by implication, estoppel, or otherwise.
 * 3. CONFIDENTIALITY.
 * The SDK and all source code, Documentation, specifications, engineering details, 
 * and related information pertaining to the SDK, whether in oral, written, 
 * graphic, or electronic form, are and shall remain the confidential and 
 * proprietary information of Realsee or its licensors (collectively, the 
 * “Confidential Information”). You shall (i) disclose Confidential Information to 
 * only those directors and employees (collectively, “Affiliates”) whose duties 
 * justify their need to know such information and who have been clearly informed 
 * of their obligation to maintain the confidential, proprietary, and/or trade 
 * secret status of such Confidential Information; and (ii) use Confidential 
 * Information solely in accordance with the license granted hereunder. In any 
 * event, You and Your Affiliates shall treat Confidential Information as strictly 
 * confidential and shall use the same care to prevent disclosure of such 
 * information as You use with respect to Your own similar confidential and/or 
 * proprietary information, which shall not be less than the care a reasonable 
 * person would use under similar circumstances. All Confidential Information, and 
 * any copies thereof, shall be returned promptly to Realsee upon request. You 
 * shall ensure that Your Affiliates comply with the provisions of this Section 3, 
 * and You shall be liable for any breach of this Section 3 resulting from the act 
 * or omission of any of Your Affiliates. You shall not disclose Confidential 
 * Information to any third party, including, without limitation, any of Your 
 * subcontractors.
 * 4. PROPRIETARY RIGHTS.
 * 4.1 As between You and Realsee, Realsee and/or its licensors retain ownership of 
 * all right, title, and interest in, to, and under the SDK, including, without 
 * limitation, all patents, copyrights, trade secrets, trademarks and other 
 * intellectual property and other proprietary rights therein, and reserve all 
 * rights not expressly granted to You.
 * 4.2 The items contained in the SDK are the intellectual property of Realsee and 
 * its licensors and are protected by PRC copyright and patent law, international 
 * treaty provisions and applicable laws of the country in which it is being used. 
 * You agree to protect all copyright and other ownership interests of Realsee 
 * and/or its licensors in all items in the SDK supplied under this License 
 * Agreement. You agree that all copies of the items in the SDK, reproduced for any 
 * reason by You, contain the same copyright notices, and other proprietary notices 
 * as appropriate, as appear on or in the original items delivered by Realsee in 
 * the SDK. Realsee and/or its licensors retain title and ownership of the items in 
 * the SDK, the media on which it is loaded, and all subsequent copies, regardless 
 * of the form or media in or on which the original and other copies may exist. 
 * Except as stated above, this Agreement does not grant You any rights to patents, 
 * copyrights, trade secrets, trademarks or any other rights in respect to the 
 * items in the SDK.
 * 5. TERM AND TERMINATION.
 * 5.1 This Agreement is effective until terminated. Realsee has the right to 
 * terminate this Agreement immediately, without judicial intervention, if You fail 
 * to comply with any term herein. Upon any such termination You must remove all 
 * full and partial copies of the items in the SDK from Your computer and 
 * discontinue the use of the items in the SDK.
 * 5.2 Realsee may at any time, terminate the Agreement with You if: (A) You have 
 * breached any provision of the Agreement; or (B) Realsee is required to do so by 
 * law; or (C) Realsee decides to no longer provide the SDK or certain parts of the 
 * SDK to users in the country in which You are resident or from which You use the 
 * service, or the provision of the SDK or certain SDK services to You by Realsee 
 * is, in Realsee's sole discretion, no longer legally or commercially viable.
 * 5.3 When the Agreement comes to an end, all of the legal rights, obligations and 
 * liabilities that You and Realsee have benefited from, been subject to (or which 
 * have accrued over time whilst the Agreement has been in force) or which are 
 * expressed to continue indefinitely, shall be unaffected by this cessation, and 
 * the provisions of Section 3, 4, 6, 7 and 8 shall continue to apply to such 
 * rights, obligations and liabilities indefinitely.
 * 6. DISCLAIMER OF WARRANTY.
 * YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE 
 * LAW, USE OF THE SDK (OR ANY PART THEREOF) IS AT YOUR SOLE RISK AND THAT THE 
 * ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS 
 * WITH YOU. REALSEE LICENSES THE SDK TO YOU ONLY ON AN "AS-IS" BASIS. REALSEE 
 * MAKES NO REPRESENTATION WITH RESPECT TO THE ADEQUACY OF ANY ITEMS IN THE SDK, 
 * WHETHER OR NOT USED BY YOU IN THE DEVELOPMENT OF INTEGRATED PRODUCT, FOR ANY 
 * PARTICULAR PURPOSE OR WITH RESPECT TO THEIR ADEQUACY TO PRODUCE ANY PARTICULAR 
 * RESULT. REALSEE AND ITS LICENSORS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING 
 * OUT OF THIS AGREEMENT OR FROM THE DISTRIBUTION OR USE OF INTEGRATED PRODUCT 
 * CONTAINING PORTIONS OF THE SDK. REALSEE AND ITS LICENSORS DISCLAIM ALL 
 * WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED 
 * CONDITIONS OR WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * OR NONINFRINGEMENT OF ANY THIRD PARTY RIGHT IN RESPECT OF THE ITEMS IN THE SDK 
 * OR ANY SERVICES RELATED TO THE SDK.
 * REALSEE IS UNDER NO OBLIGATION TO PROVIDE ANY SUPPORT UNDER THIS LICENSE 
 * AGREEMENT, INCLUDING UPGRADES OR FUTURE VERSIONS OF THE SDK OR ANY PORTIONS 
 * THEREOF, TO YOU, END USER OR TO ANY OTHER PARTY.
 * 7. LIMITATION OF LIABILITY.
 * TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL REALSEE OR ITS 
 * LICENSORS BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, OR 
 * CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, 
 * LOSS OF BUSINESS, REVENUE, OR PROFITS, LOSS OF OPPORTUNITY (WHETHER DIRECT OR 
 * INDIRECT), CORRUPTION OR LOSS OF DATA, LOSS OF REPUTATION OR SAVINGS, DOWNTIME, 
 * OR DAMAGE TO, LOSS OF OR REPLACEMENT OF DATA OR TRANSACTIONS, COST OF 
 * PROCUREMENT OF SUBSTITUTE SERVICES, BUSINESS INTERRUPTION, OR ANY OTHER 
 * COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY 
 * TO USE THE SDK (OR ANY PART THEREOF), ANY INTEGRATED PRODUCT, OR ANY THIRD PARTY 
 * SOFTWARE, APPLICATIONS, OR SERVICES IN CONJUNCTION WITH THE SDK (OR ANY PART 
 * THEREOF), HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT, 
 * OR OTHERWISE) AND EVEN IF REALSEE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
 * DAMAGES. IN NO EVENT WILL REALSEE’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES 
 * EXCEED ONE HUNDRED DOLLARS ($100.00). THE FOREGOING LIMITATIONS WILL APPLY EVEN 
 * IF THE ABOVE STATED REMEDY FAILS OF ITS ESSENTIAL PURPOSE. THE LIMITATIONS 
 * CONTAINED IN SECTIONS 6 AND THIS SECTION 7 ARE A FUNDAMENTAL PART OF THE BASIS 
 * OF REALSEE’S BARGAIN HEREUNDER, AND REALSEE WOULD NOT ENTER INTO THIS AGREEMENT 
 * OR PROVIDE YOU WITH ACCESS TO THE SDK ABSENT SUCH LIMITATIONS.
 * 8. INDEMNIFICATION.
 * To the extent permitted by applicable law, You agree to indemnify, defend and 
 * hold harmless Realsee, its affiliates and each of their directors, officers, 
 * employees, independent contractors, and agents (each a “Realsee Indemnified 
 * Party”) from any and all claims, losses, liabilities, damages, expenses, and 
 * costs (including without limitation attorneys’ fees and court costs) incurred by 
 * a Realsee Indemnified Party as a result of: (i) Your non-compliance with any 
 * terms of this Agreement; (ii) Your use of the SDK (or any part thereof); or 
 * (iii) Your use of any Integrated Product, including any claim that Integrated 
 * Product infringes the copyright, trademark, trade secret or other intellectual 
 * property right of a third party.
 * 9. ACKNOWLEDGEMENTS.
 * Portions of the SDK may utilize or include third party software and other 
 * copyrighted material. Acknowledgments, licensing terms, and disclaimers for such 
 * material are contained in Documentation for the SDK or may otherwise accompany 
 * such material, and Your use of such materials governed by their respective 
 * terms. In the event of conflict between the terms of this Agreement and an 
 * applicable open source or third party agreement, the open source or third party 
 * agreement will control solely with respect to the open source software or third 
 * party software. Moreover, You shall not subject any items (including not limited 
 * to source code, object code, and any software)  included in the SDK to any open 
 * source license.
 * 10. NON-BLOCKING OF REALSEE DEVELOPMENT.
 * You acknowledge that Realsee is currently developing or may develop technologies 
 * and products in the future that have or may have design and/or functionality 
 * similar to Integrated Product that You may develop based on Your license herein. 
 * Nothing in this Agreement shall impair, limit or curtail Realsee's right to 
 * continue with its development, maintenance and/or distribution of Realsee's 
 * technology or products.
 * 11. GENERAL.
 * 11.1 Export Control. You may not use or otherwise export or re-export the SDK 
 * (or any part thereof) except as authorized by United States law and the laws of 
 * the jurisdiction(s) in which the SDK (or any part thereof) was obtained. In 
 * particular, but without limitation, the SDK may not be exported or re-exported 
 * (i) into any U.S. embargoed countries or (ii) to anyone on the U.S. Treasury 
 * Department's list of Specially Designated Nationals or the U.S. Department of 
 * Commerce Denied Person's List or Entity List. By using the SDK (or any part 
 * thereof), You represent and warrant that You are not located in any such country 
 * or on any such list.
 * 11.2 Governing Law. This Agreement and the rights of the parties hereunder shall 
 * be governed by and construed in accordance with the laws of People’s Republic of 
 * China (for purpose of this Agreement, excluding Hong Kong, Taiwan, and Macau), 
 * without reference to its conflict of laws principles. Any dispute, controversy 
 * or claim arising from or in connection with this Agreement, or the breach, 
 * termination or invalidity thereof, shall be submitted to China International 
 * Economic and Trade Arbitration Commission (“CIETAC”) for arbitration in Beijing 
 * which shall be conducted in accordance with the CIETAC's arbitration rules in 
 * effect at the time of applying for arbitration. The arbitral award is final and 
 * binding upon both parties.
 * 11.3 Severability. If any provision of this Agreement is held by a court of 
 * competent jurisdiction to be unenforceable for any reason, the remaining 
 * provisions hereof will be unaffected and remain in full force and effect.
 * 11.4. Modifications. Realsee reserves the right, from time to time, with or 
 * without notice to You, to make revisions to this Agreement in our sole and 
 * absolute discretion.  The most current version of this Agreement will supersede 
 * all previous versions and shall be made available on the website where the SDK 
 * is made available, or by such other means as Realsee may determine in its 
 * discretion. Any modified versions of this Agreement hereto shall take effect 
 * from the time that it is made available. You shall be responsible for regularly 
 * checking for notice of any such modifications. You agree that Your continued use 
 * of the SDK constitutes Your agreement to the modified Agreement.
 * 11.5 Relationship of the Parties. This Agreement will not be construed as 
 * creating an agency, partnership, joint venture, fiduciary duty, or any other 
 * form of legal association between You and Realsee, and You will not represent to 
 * the contrary, whether expressly, by implication, appearance, or otherwise.
 * 11.6 Entire Agreement; Governing Language. This Agreement constitutes the entire 
 * agreement between You and Realsee with respect to the use of the SDK licensed 
 * hereunder and supersedes all prior understandings regarding such subject matter. 
 * No amendment to or modification of this Agreement will be binding unless in 
 * writing and signed by Realsee. You and Realsee hereto confirm that this 
 * Agreement and all related documents shall be drafted in English.
*/(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`three`)):typeof define==`function`&&define.amd?define([`exports`,`three`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.FiveSDK_GLTFLoader={},e.THREE))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t,1);var l=(function(){function e(e){t.Loader.call(this,e),this.dracoLoader=null,this.ddsLoader=null}e.prototype=Object.assign(Object.create(t.Loader.prototype),{constructor:e,load:function(e,n,r,i){var a=this,o=this.resourcePath===``?this.path===``?t.LoaderUtils.extractUrlBase(e):this.path:this.resourcePath;a.manager.itemStart(e);var s=function(t){i?i(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},c=new t.FileLoader(a.manager);c.setPath(this.path),c.setResponseType(`arraybuffer`),c.setRequestHeader(this.requestHeader),a.crossOrigin===`use-credentials`&&c.setWithCredentials(!0),c.load(e,function(t){try{a.parse(t,o,function(t){n(t),a.manager.itemEnd(e)},s)}catch(e){s(e)}},r,s)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,n,u,d){var h,v={};if(typeof e==`string`)h=e;else if(t.LoaderUtils.decodeText(new Uint8Array(e,0,4))===l){try{v[r.KHR_BINARY_GLTF]=new f(e)}catch(e){d&&d(e);return}h=v[r.KHR_BINARY_GLTF].content}else h=t.LoaderUtils.decodeText(new Uint8Array(e));var b=JSON.parse(h);if(b.asset===void 0||b.asset.version[0]<2){d&&d(Error(`THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.`));return}if(b.extensionsUsed)for(var x=0;x<b.extensionsUsed.length;++x){var S=b.extensionsUsed[x],C=b.extensionsRequired||[];switch(S){case r.KHR_LIGHTS_PUNCTUAL:v[S]=new a(b);break;case r.KHR_MATERIALS_CLEARCOAT:v[S]=new s;break;case r.KHR_MATERIALS_TRANSMISSION:v[S]=new c;break;case r.KHR_MATERIALS_UNLIT:v[S]=new o;break;case r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:v[S]=new g;break;case r.KHR_DRACO_MESH_COMPRESSION:v[S]=new p(b,this.dracoLoader);break;case r.MSFT_TEXTURE_DDS:v[S]=new i(this.ddsLoader);break;case r.KHR_TEXTURE_TRANSFORM:v[S]=new m;break;case r.KHR_MESH_QUANTIZATION:v[S]=new _;break;case r.REALSEE_MATERIALS_LIGHTMAP:v[S]=new y;break;default:C.indexOf(S)>=0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+S+`".`)}}var w=new R(b,v,{path:n||this.resourcePath||``,crossOrigin:this.crossOrigin,manager:this.manager});w.fileLoader.setRequestHeader(this.requestHeader),w.parse(u,d)}});function n(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var r={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:`KHR_materials_pbrSpecularGlossiness`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,MSFT_TEXTURE_DDS:`MSFT_texture_dds`,REALSEE_MATERIALS_LIGHTMAP:`REALSEE_materials_lightmap`};function i(e){if(!e)throw Error(`THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader`);this.name=r.MSFT_TEXTURE_DDS,this.ddsLoader=e}function a(e){this.name=r.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[r.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}a.prototype.loadLight=function(e){var n=this.lightDefs[e],r,i=new t.Color(16777215);n.color!==void 0&&i.fromArray(n.color);var a=n.range===void 0?0:n.range;switch(n.type){case`directional`:r=new t.DirectionalLight(i),r.target.position.set(0,0,-1),r.add(r.target);break;case`point`:r=new t.PointLight(i),r.distance=a;break;case`spot`:r=new t.SpotLight(i),r.distance=a,n.spot=n.spot||{},n.spot.innerConeAngle=n.spot.innerConeAngle===void 0?0:n.spot.innerConeAngle,n.spot.outerConeAngle=n.spot.outerConeAngle===void 0?Math.PI/4:n.spot.outerConeAngle,r.angle=n.spot.outerConeAngle,r.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,r.target.position.set(0,0,-1),r.add(r.target);break;default:throw Error(`THREE.GLTFLoader: Unexpected light type, "`+n.type+`".`)}return r.position.set(0,0,0),r.decay=2,n.intensity!==void 0&&(r.intensity=n.intensity),r.name=n.name||`light_`+e,Promise.resolve(r)};function o(){this.name=r.KHR_MATERIALS_UNLIT}o.prototype.getMaterialType=function(){return t.MeshBasicMaterial},o.prototype.extendParams=function(e,n,r){var i=[];e.color=new t.Color(1,1,1),e.opacity=1;var a=n.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){var o=a.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}a.baseColorTexture!==void 0&&i.push(r.assignTexture(e,`map`,a.baseColorTexture))}return Promise.all(i)};function s(){this.name=r.KHR_MATERIALS_CLEARCOAT}s.prototype.getMaterialType=function(){return t.MeshPhysicalMaterial},s.prototype.extendParams=function(e,n,r){var i=[],a=n.extensions[this.name];if(a.clearcoatFactor!==void 0&&(e.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&i.push(r.assignTexture(e,`clearcoatMap`,a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&i.push(r.assignTexture(e,`clearcoatRoughnessMap`,a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(i.push(r.assignTexture(e,`clearcoatNormalMap`,a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){var o=a.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new t.Vector2(o,o)}return Promise.all(i)};function c(){this.name=r.KHR_MATERIALS_TRANSMISSION}c.prototype.getMaterialType=function(){return t.MeshPhysicalMaterial},c.prototype.extendParams=function(e,t,n){return t.extensions[this.name].transmissionFactor!==void 0&&(e.premultipliedAlpha=!0,e.transparent=!0,e.opacity=e.opacity===void 0?.5:e.opacity),Promise.all([])};var l=`glTF`,u=12,d={JSON:1313821514,BIN:5130562};function f(e){this.name=r.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(e,0,u);if(this.header={magic:t.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==l)throw Error(`THREE.GLTFLoader: Unsupported glTF-Binary header.`);if(this.header.version<2)throw Error(`THREE.GLTFLoader: Legacy binary file detected.`);for(var i=new DataView(e,u),a=0;a<i.byteLength;){var o=i.getUint32(a,!0);a+=4;var s=i.getUint32(a,!0);if(a+=4,s===d.JSON){var c=new Uint8Array(e,u+a,o);this.content=t.LoaderUtils.decodeText(c)}else if(s===d.BIN){var f=u+a;this.body=e.slice(f,f+o)}a+=o}if(this.content===null)throw Error(`THREE.GLTFLoader: JSON content not found.`)}function p(e,t){if(!t)throw Error(`THREE.GLTFLoader: No DRACOLoader instance provided.`);this.name=r.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}p.prototype.decodePrimitive=function(e,t){var n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(var l in a){var u=T[l]||l.toLowerCase();o[u]=a[l]}for(l in e.attributes){var u=T[l]||l.toLowerCase();if(a[l]!==void 0){var d=n.accessors[e.attributes[l]];c[u]=x[d.componentType],s[u]=d.normalized===!0}}return t.getDependency(`bufferView`,i).then(function(e){return new Promise(function(t){r.decodeDracoFile(e,function(e){for(var n in e.attributes){var r=e.attributes[n],i=s[n];i!==void 0&&(r.normalized=i)}t(e)},o,c)})})};function m(){this.name=r.KHR_TEXTURE_TRANSFORM}m.prototype.extendTexture=function(e,t){return e=e.clone(),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),t.texCoord!==void 0&&console.warn(`THREE.GLTFLoader: Custom UV sets in "`+this.name+`" extension not yet supported.`),e.needsUpdate=!0,e};function h(e){t.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var n=[`#ifdef USE_SPECULARMAP`,`	uniform sampler2D specularMap;`,`#endif`].join(`
`),r=[`#ifdef USE_GLOSSINESSMAP`,`	uniform sampler2D glossinessMap;`,`#endif`].join(`
`),i=[`vec3 specularFactor = specular;`,`#ifdef USE_SPECULARMAP`,`	vec4 texelSpecular = texture2D( specularMap, vUv );`,`	texelSpecular = sRGBToLinear( texelSpecular );`,`	// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture`,`	specularFactor *= texelSpecular.rgb;`,`#endif`].join(`
`),a=[`float glossinessFactor = glossiness;`,`#ifdef USE_GLOSSINESSMAP`,`	vec4 texelGlossiness = texture2D( glossinessMap, vUv );`,`	// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture`,`	glossinessFactor *= texelGlossiness.a;`,`#endif`].join(`
`),o=[`PhysicalMaterial material;`,`material.diffuseColor = diffuseColor.rgb;`,`vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );`,`float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );`,`material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.`,`material.specularRoughness += geometryRoughness;`,`material.specularRoughness = min( material.specularRoughness, 1.0 );`,`material.specularColor = specularFactor.rgb;`].join(`
`),s={specular:{value:new t.Color().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(e){for(var t in s)e.uniforms[t]=s[t];e.fragmentShader=e.fragmentShader.replace(`uniform float roughness;`,`uniform vec3 specular;`),e.fragmentShader=e.fragmentShader.replace(`uniform float metalness;`,`uniform float glossiness;`),e.fragmentShader=e.fragmentShader.replace(`#include <roughnessmap_pars_fragment>`,n),e.fragmentShader=e.fragmentShader.replace(`#include <metalnessmap_pars_fragment>`,r),e.fragmentShader=e.fragmentShader.replace(`#include <roughnessmap_fragment>`,i),e.fragmentShader=e.fragmentShader.replace(`#include <metalnessmap_fragment>`,a),e.fragmentShader=e.fragmentShader.replace(`#include <lights_physical_fragment>`,o)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(e){s.specular.value=e}},specularMap:{get:function(){return s.specularMap.value},set:function(e){s.specularMap.value=e}},glossiness:{get:function(){return s.glossiness.value},set:function(e){s.glossiness.value=e}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(e){s.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP=``,this.defines.USE_ROUGHNESSMAP=``):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}h.prototype=Object.create(t.MeshStandardMaterial.prototype),h.prototype.constructor=h,h.prototype.copy=function(e){return t.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this};function g(){return{name:r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:[`color`,`map`,`lightMap`,`lightMapIntensity`,`aoMap`,`aoMapIntensity`,`emissive`,`emissiveIntensity`,`emissiveMap`,`bumpMap`,`bumpScale`,`normalMap`,`normalMapType`,`displacementMap`,`displacementScale`,`displacementBias`,`specularMap`,`specular`,`glossinessMap`,`glossiness`,`alphaMap`,`envMap`,`envMapIntensity`,`refractionRatio`],getMaterialType:function(){return h},extendParams:function(e,n,r){var i=n.extensions[this.name];e.color=new t.Color(1,1,1),e.opacity=1;var a=[];if(Array.isArray(i.diffuseFactor)){var o=i.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(i.diffuseTexture!==void 0&&a.push(r.assignTexture(e,`map`,i.diffuseTexture)),e.emissive=new t.Color(0,0,0),e.glossiness=i.glossinessFactor===void 0?1:i.glossinessFactor,e.specular=new t.Color(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),i.specularGlossinessTexture!==void 0){var s=i.specularGlossinessTexture;a.push(r.assignTexture(e,`glossinessMap`,s)),a.push(r.assignTexture(e,`specularMap`,s))}return Promise.all(a)},createMaterial:function(e){var n=new h(e);return n.fog=!0,n.color=e.color,n.map=e.map===void 0?null:e.map,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=e.aoMap===void 0?null:e.aoMap,n.aoMapIntensity=1,n.emissive=e.emissive,n.emissiveIntensity=1,n.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,n.bumpMap=e.bumpMap===void 0?null:e.bumpMap,n.bumpScale=1,n.normalMap=e.normalMap===void 0?null:e.normalMap,n.normalMapType=t.TangentSpaceNormalMap,e.normalScale&&(n.normalScale=e.normalScale),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.specularMap=e.specularMap===void 0?null:e.specularMap,n.specular=e.specular,n.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,n.glossiness=e.glossiness,n.alphaMap=null,n.envMap=e.envMap===void 0?null:e.envMap,n.envMapIntensity=1,n.refractionRatio=.98,n}}}function _(){this.name=r.KHR_MESH_QUANTIZATION}function v(e,n,r,i){t.Interpolant.call(this,e,n,r,i)}v.prototype=Object.create(t.Interpolant.prototype),v.prototype.constructor=v,v.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,a=0;a!==r;a++)t[a]=n[i+a];return t},v.prototype.beforeStart_=v.prototype.copySampleValue_,v.prototype.afterEnd_=v.prototype.copySampleValue_,v.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=o*2,c=o*3,l=r-t,u=(n-t)/l,d=u*u,f=d*u,p=e*c,m=p-c,h=-2*f+3*d,g=f-d,_=1-h,v=g-d+u,y=0;y!==o;y++){var b=a[m+y+o],x=a[m+y+s]*l,S=a[p+y+o],C=a[p+y]*l;i[y]=_*b+v*x+h*S+g*C}return i};function y(e){this.parser=e,this.name=r.REALSEE_MATERIALS_LIGHTMAP}y.prototype.getMaterialType=function(e){return t.MeshPhongMaterial},y.prototype.extendParams=function(e,t,n){if(!t.extensions||!t.extensions[this.name])return Promise.resolve();var r=[],i=t.extensions[this.name];return i.lightMapTexture!==void 0&&r.push(n.assignTexture(e,`lightMap`,i.lightMapTexture)),i.lightMapIntensity!==void 0&&(e.lightMapIntensity=i.lightMapIntensity),Promise.all(r)};var b={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},x={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},S={9728:t.NearestFilter,9729:t.LinearFilter,9984:t.NearestMipmapNearestFilter,9985:t.LinearMipmapNearestFilter,9986:t.NearestMipmapLinearFilter,9987:t.LinearMipmapLinearFilter},C={33071:t.ClampToEdgeWrapping,33648:t.MirroredRepeatWrapping,10497:t.RepeatWrapping},w={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},T={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv2`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},E={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},D={CUBICSPLINE:void 0,LINEAR:t.InterpolateLinear,STEP:t.InterpolateDiscrete},O={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`},k={"image/png":t.RGBAFormat,"image/jpeg":t.RGBFormat};function A(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function j(e){return e.DefaultMaterial===void 0&&(e.DefaultMaterial=new t.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:t.FrontSide})),e.DefaultMaterial}function M(e,t,n){for(var r in n.extensions)e[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function N(e,t){t.extras!==void 0&&(typeof t.extras==`object`?Object.assign(e.userData,t.extras):console.warn(`THREE.GLTFLoader: Ignoring primitive type .extras, `+t.extras))}function P(e,t,n){for(var r=!1,i=!1,a=0,o=t.length;a<o;a++){var s=t[a];if(s.POSITION!==void 0&&(r=!0),s.NORMAL!==void 0&&(i=!0),r&&i)break}if(!r&&!i)return Promise.resolve(e);for(var c=[],l=[],a=0,o=t.length;a<o;a++){var s=t[a];if(r){var u=s.POSITION===void 0?e.attributes.position:n.getDependency(`accessor`,s.POSITION);c.push(u)}if(i){var u=s.NORMAL===void 0?e.attributes.normal:n.getDependency(`accessor`,s.NORMAL);l.push(u)}}return Promise.all([Promise.all(c),Promise.all(l)]).then(function(t){var n=t[0],a=t[1];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=a),e.morphTargetsRelative=!0,e})}function F(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(var n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(var n=0,r=i.length;n<r;n++)e.morphTargetDictionary[i[n]]=n}else console.warn(`THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.`)}}function I(e){var t=e.extensions&&e.extensions[r.KHR_DRACO_MESH_COMPRESSION];return t?`draco:`+t.bufferView+`:`+t.indices+`:`+L(t.attributes):e.indices+`:`+L(e.attributes)+`:`+e.mode}function L(e){for(var t=``,n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e[n[r]]+`;`;return t}function R(e,r,i){this.json=e||{},this.extensions=r||{},this.options=i||{},this.cache=new n,this.associations=new Map,this.primitiveCache={},this.textureLoader=new t.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new t.FileLoader(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}R.prototype.parse=function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies(`scene`),this.getDependencies(`animation`),this.getDependencies(`camera`)]).then(function(t){var a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};M(i,a,r),N(a,r),e(a)}).catch(t)},R.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r={},i={},a=0,o=t.length;a<o;a++)for(var s=t[a].joints,c=0,l=s.length;c<l;c++)e[s[c]].isBone=!0;for(var u=0,d=e.length;u<d;u++){var f=e[u];f.mesh!==void 0&&(r[f.mesh]===void 0&&(r[f.mesh]=i[f.mesh]=0),r[f.mesh]++,f.skin!==void 0&&(n[f.mesh].isSkinnedMesh=!0))}this.json.meshReferences=r,this.json.meshUses=i},R.prototype.getDependency=function(e,t){var n=e+`:`+t,i=this.cache.get(n);if(!i){switch(e){case`scene`:i=this.loadScene(t);break;case`node`:i=this.loadNode(t);break;case`mesh`:i=this.loadMesh(t);break;case`accessor`:i=this.loadAccessor(t);break;case`bufferView`:i=this.loadBufferView(t);break;case`buffer`:i=this.loadBuffer(t);break;case`material`:i=this.loadMaterial(t);break;case`texture`:i=this.loadTexture(t);break;case`skin`:i=this.loadSkin(t);break;case`animation`:i=this.loadAnimation(t);break;case`camera`:i=this.loadCamera(t);break;case`light`:i=this.extensions[r.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw Error(`Unknown type: `+e)}this.cache.add(n,i)}return i},R.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var n=this,r=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t},R.prototype.loadBuffer=function(e){var t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!==`arraybuffer`)throw Error(`THREE.GLTFLoader: `+t.type+` buffer type is not supported.`);if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[r.KHR_BINARY_GLTF].body);var i=this.options;return new Promise(function(e,r){n.load(A(t.uri,i.path),e,void 0,function(){r(Error(`THREE.GLTFLoader: Failed to load buffer "`+t.uri+`".`))})})},R.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})},R.prototype.loadAccessor=function(e){var n=this,r=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0)return Promise.resolve(null);var a=[];return i.bufferView===void 0?a.push(null):a.push(this.getDependency(`bufferView`,i.bufferView)),i.sparse!==void 0&&(a.push(this.getDependency(`bufferView`,i.sparse.indices.bufferView)),a.push(this.getDependency(`bufferView`,i.sparse.values.bufferView))),Promise.all(a).then(function(e){var a=e[0],o=w[i.type],s=x[i.componentType],c=s.BYTES_PER_ELEMENT,l=c*o,u=i.byteOffset||0,d=i.bufferView===void 0?void 0:r.bufferViews[i.bufferView].byteStride,f=i.normalized===!0,p,m;if(d&&d!==l){var h=Math.floor(u/d),g=`InterleavedBuffer:`+i.bufferView+`:`+i.componentType+`:`+h+`:`+i.count,_=n.cache.get(g);_||(p=new s(a,h*d,i.count*d/c),_=new t.InterleavedBuffer(p,d/c),n.cache.add(g,_)),m=new t.InterleavedBufferAttribute(_,o,u%d/c,f)}else p=a===null?new s(i.count*o):new s(a,u,i.count*o),m=new t.BufferAttribute(p,o,f);if(i.sparse!==void 0){var v=w.SCALAR,y=x[i.sparse.indices.componentType],b=i.sparse.indices.byteOffset||0,S=i.sparse.values.byteOffset||0,C=new y(e[1],b,i.sparse.count*v),T=new s(e[2],S,i.sparse.count*o);a!==null&&(m=new t.BufferAttribute(m.array.slice(),m.itemSize,m.normalized));for(var E=0,D=C.length;E<D;E++){var O=C[E];if(m.setX(O,T[E*o]),o>=2&&m.setY(O,T[E*o+1]),o>=3&&m.setZ(O,T[E*o+2]),o>=4&&m.setW(O,T[E*o+3]),o>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}}return m})},R.prototype.loadTexture=function(e){var n=this,i=this.json,a=this.options,o=this.textureLoader,s=self.URL||self.webkitURL,c=i.textures[e],l=c.extensions||{},u=l[r.MSFT_TEXTURE_DDS]?i.images[l[r.MSFT_TEXTURE_DDS].source]:i.images[c.source],d=u.uri,f=!1;return u.bufferView!==void 0&&(d=n.getDependency(`bufferView`,u.bufferView).then(function(e){f=!0;var t=new Blob([e],{type:u.mimeType});return d=s.createObjectURL(t),d})),Promise.resolve(d).then(function(e){var t=a.manager.getHandler(e);return t||(t=l[r.MSFT_TEXTURE_DDS]?n.extensions[r.MSFT_TEXTURE_DDS].ddsLoader:o),new Promise(function(n,r){t.load(A(e,a.path),n,void 0,r)})}).then(function(r){f===!0&&s.revokeObjectURL(d),r.flipY=!1,c.name&&(r.name=c.name),u.mimeType in k&&(r.format=k[u.mimeType]);var a=(i.samplers||{})[c.sampler]||{};return r.magFilter=S[a.magFilter]||t.LinearFilter,r.minFilter=S[a.minFilter]||t.LinearMipmapLinearFilter,r.wrapS=C[a.wrapS]||t.RepeatWrapping,r.wrapT=C[a.wrapT]||t.RepeatWrapping,n.associations.set(r,{type:`textures`,index:e}),r})},R.prototype.assignTexture=function(e,n,i){var a=this;return this.getDependency(`texture`,i.index).then(function(o){if(!o.isCompressedTexture)switch(n){case`aoMap`:case`emissiveMap`:case`metalnessMap`:case`normalMap`:case`roughnessMap`:o.format=t.RGBFormat;break}if(i.texCoord!==void 0&&i.texCoord!=0&&!(n===`aoMap`&&i.texCoord==1)&&console.warn(`THREE.GLTFLoader: Custom UV set `+i.texCoord+` for texture `+n+` not yet supported.`),a.extensions[r.KHR_TEXTURE_TRANSFORM]){var s=i.extensions===void 0?void 0:i.extensions[r.KHR_TEXTURE_TRANSFORM];if(s){var c=a.associations.get(o);o=a.extensions[r.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),a.associations.set(o,c)}}e[n]=o})},R.prototype.assignFinalMaterial=function(e){var n=e.geometry,r=e.material,i=n.attributes.tangent!==void 0,a=n.attributes.color!==void 0,o=n.attributes.normal===void 0,s=e.isSkinnedMesh===!0,c=Object.keys(n.morphAttributes).length>0,l=c&&n.morphAttributes.normal!==void 0;if(e.isPoints){var u=`PointsMaterial:`+r.uuid,d=this.cache.get(u);d||(d=new t.PointsMaterial,t.Material.prototype.copy.call(d,r),d.color.copy(r.color),d.map=r.map,d.sizeAttenuation=!1,this.cache.add(u,d)),r=d}else if(e.isLine){var u=`LineBasicMaterial:`+r.uuid,f=this.cache.get(u);f||(f=new t.LineBasicMaterial,t.Material.prototype.copy.call(f,r),f.color.copy(r.color),this.cache.add(u,f)),r=f}if(i||a||o||s||c){var u=`ClonedMaterial:`+r.uuid+`:`;r.isGLTFSpecularGlossinessMaterial&&(u+=`specular-glossiness:`),s&&(u+=`skinning:`),i&&(u+=`vertex-tangents:`),a&&(u+=`vertex-colors:`),o&&(u+=`flat-shading:`),c&&(u+=`morph-targets:`),l&&(u+=`morph-normals:`);var p=this.cache.get(u);p||(p=r.clone(),s&&(p.skinning=!0),i&&(p.vertexTangents=!0),a&&(p.vertexColors=!0),o&&(p.flatShading=!0),c&&(p.morphTargets=!0),l&&(p.morphNormals=!0),this.cache.add(u,p),this.associations.set(p,this.associations.get(r))),r=p}r.aoMap&&n.attributes.uv2===void 0&&n.attributes.uv!==void 0&&n.setAttribute(`uv2`,n.attributes.uv),r.normalScale&&!i&&(r.normalScale.y=-r.normalScale.y),r.clearcoatNormalScale&&!i&&(r.clearcoatNormalScale.y=-r.clearcoatNormalScale.y),e.material=r},R.prototype.loadMaterial=function(e){var n=this,i=this.json,a=this.extensions,o=i.materials[e],s,c={},l=o.extensions||{},u=[];if(l[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var d=a[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];s=d.getMaterialType(),u.push(d.extendParams(c,o,n))}else if(l[r.KHR_MATERIALS_UNLIT]){var f=a[r.KHR_MATERIALS_UNLIT];s=f.getMaterialType(),u.push(f.extendParams(c,o,n))}else{s=t.MeshStandardMaterial;var p=o.pbrMetallicRoughness||{};if(c.color=new t.Color(1,1,1),c.opacity=1,Array.isArray(p.baseColorFactor)){var m=p.baseColorFactor;c.color.fromArray(m),c.opacity=m[3]}p.baseColorTexture!==void 0&&u.push(n.assignTexture(c,`map`,p.baseColorTexture)),c.metalness=p.metallicFactor===void 0?1:p.metallicFactor,c.roughness=p.roughnessFactor===void 0?1:p.roughnessFactor,p.metallicRoughnessTexture!==void 0&&(u.push(n.assignTexture(c,`metalnessMap`,p.metallicRoughnessTexture)),u.push(n.assignTexture(c,`roughnessMap`,p.metallicRoughnessTexture)))}o.doubleSided===!0&&(c.side=t.DoubleSide);var g=o.alphaMode||O.OPAQUE;if(g===O.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,g===O.MASK&&(c.alphaTest=o.alphaCutoff===void 0?.5:o.alphaCutoff)),o.normalTexture!==void 0&&s!==t.MeshBasicMaterial&&(u.push(n.assignTexture(c,`normalMap`,o.normalTexture)),c.normalScale=new t.Vector2(1,1),o.normalTexture.scale!==void 0&&c.normalScale.set(o.normalTexture.scale,o.normalTexture.scale)),o.occlusionTexture!==void 0&&s!==t.MeshBasicMaterial&&(u.push(n.assignTexture(c,`aoMap`,o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&s!==t.MeshBasicMaterial&&(c.emissive=new t.Color().fromArray(o.emissiveFactor)),o.emissiveTexture!==void 0&&s!==t.MeshBasicMaterial&&u.push(n.assignTexture(c,`emissiveMap`,o.emissiveTexture)),l[r.KHR_MATERIALS_CLEARCOAT]){var _=a[r.KHR_MATERIALS_CLEARCOAT];s=_.getMaterialType(),u.push(_.extendParams(c,{extensions:l},n))}if(l[r.KHR_MATERIALS_TRANSMISSION]){var _=a[r.KHR_MATERIALS_TRANSMISSION];s=_.getMaterialType(),u.push(_.extendParams(c,{extensions:l},n))}if(l[r.REALSEE_MATERIALS_LIGHTMAP]){var v=a[r.REALSEE_MATERIALS_LIGHTMAP];s=v.getMaterialType(),u.push(v.extendParams(c,{extensions:l},n))}return Promise.all(u).then(function(){var i=s===h?a[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(c):new s(c);return o.name&&(i.name=o.name),i.map&&(i.map.encoding=t.sRGBEncoding),i.emissiveMap&&(i.emissiveMap.encoding=t.sRGBEncoding),N(i,o),n.associations.set(i,{type:`materials`,index:e}),o.extensions&&M(a,i,o),i})};function z(e,n,r){var i=n.attributes,a=new t.Box3;if(i.POSITION!==void 0){var o=r.json.accessors[i.POSITION],s=o.min,c=o.max;if(s!==void 0&&c!==void 0)a.set(new t.Vector3(s[0],s[1],s[2]),new t.Vector3(c[0],c[1],c[2]));else{console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`);return}}else return;var l=n.targets;if(l!==void 0){for(var u=new t.Vector3,d=new t.Vector3,f=0,p=l.length;f<p;f++){var m=l[f];if(m.POSITION!==void 0){var o=r.json.accessors[m.POSITION],s=o.min,c=o.max;s!==void 0&&c!==void 0?(d.setX(Math.max(Math.abs(s[0]),Math.abs(c[0]))),d.setY(Math.max(Math.abs(s[1]),Math.abs(c[1]))),d.setZ(Math.max(Math.abs(s[2]),Math.abs(c[2]))),u.max(d)):console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`)}}a.expandByVector(u)}e.boundingBox=a;var h=new t.Sphere;a.getCenter(h.center),h.radius=a.min.distanceTo(a.max)/2,e.boundingSphere=h}function B(e,t,n){var r=t.attributes,i=[];function a(t,r){return n.getDependency(`accessor`,t).then(function(t){e.setAttribute(r,t)})}for(var o in r){var s=T[o]||o.toLowerCase();s in e.attributes||i.push(a(r[o],s))}if(t.indices!==void 0&&!e.index){var c=n.getDependency(`accessor`,t.indices).then(function(t){e.setIndex(t)});i.push(c)}return N(e,t),z(e,t,n),Promise.all(i).then(function(){return t.targets===void 0?e:P(e,t.targets,n)})}function V(e,n){var r=e.getIndex();if(r===null){var i=[],a=e.getAttribute(`position`);if(a!==void 0){for(var o=0;o<a.count;o++)i.push(o);e.setIndex(i),r=e.getIndex()}else return console.error(`THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.`),e}var s=r.count-2,c=[];if(n===t.TriangleFanDrawMode)for(var o=1;o<=s;o++)c.push(r.getX(0)),c.push(r.getX(o)),c.push(r.getX(o+1));else for(var o=0;o<s;o++)o%2==0?(c.push(r.getX(o)),c.push(r.getX(o+1)),c.push(r.getX(o+2))):(c.push(r.getX(o+2)),c.push(r.getX(o+1)),c.push(r.getX(o)));c.length/3!==s&&console.error(`THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.`);var l=e.clone();return l.setIndex(c),l}return R.prototype.loadGeometries=function(e){var n=this,i=this.extensions,a=this.primitiveCache;function o(e){return i[r.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,n).then(function(t){return B(t,e,n)})}for(var s=[],c=0,l=e.length;c<l;c++){var u=e[c],d=I(u),f=a[d];if(f)s.push(f.promise);else{var p=u.extensions&&u.extensions[r.KHR_DRACO_MESH_COMPRESSION]?o(u):B(new t.BufferGeometry,u,n);a[d]={primitive:u,promise:p},s.push(p)}}return Promise.all(s)},R.prototype.loadMesh=function(e){for(var n=this,r=this.json.meshes[e],i=r.primitives,a=[],o=0,s=i.length;o<s;o++){var c=i[o].material===void 0?j(this.cache):this.getDependency(`material`,i[o].material);a.push(c)}return a.push(n.loadGeometries(i)),Promise.all(a).then(function(a){for(var o=a.slice(0,a.length-1),s=a[a.length-1],c=[],l=0,u=s.length;l<u;l++){var d=s[l],f=i[l],p,m=o[l];if(f.mode===b.TRIANGLES||f.mode===b.TRIANGLE_STRIP||f.mode===b.TRIANGLE_FAN||f.mode===void 0)p=r.isSkinnedMesh===!0?new t.SkinnedMesh(d,m):new t.Mesh(d,m),p.isSkinnedMesh===!0&&!p.geometry.attributes.skinWeight.normalized&&p.normalizeSkinWeights(),f.mode===b.TRIANGLE_STRIP?p.geometry=V(p.geometry,t.TriangleStripDrawMode):f.mode===b.TRIANGLE_FAN&&(p.geometry=V(p.geometry,t.TriangleFanDrawMode));else if(f.mode===b.LINES)p=new t.LineSegments(d,m);else if(f.mode===b.LINE_STRIP)p=new t.Line(d,m);else if(f.mode===b.LINE_LOOP)p=new t.LineLoop(d,m);else if(f.mode===b.POINTS)p=new t.Points(d,m);else throw Error(`THREE.GLTFLoader: Primitive mode unsupported: `+f.mode);Object.keys(p.geometry.morphAttributes).length>0&&F(p,r),p.name=r.name||`mesh_`+e,s.length>1&&(p.name+=`_`+l),N(p,r),n.assignFinalMaterial(p),c.push(p)}if(c.length===1)return c[0];for(var h=new t.Group,l=0,u=c.length;l<u;l++)h.add(c[l]);return h})},R.prototype.loadCamera=function(e){var n,r=this.json.cameras[e],i=r[r.type];if(!i){console.warn(`THREE.GLTFLoader: Missing camera parameters.`);return}return r.type===`perspective`?n=new t.PerspectiveCamera(t.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):r.type===`orthographic`&&(n=new t.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),r.name&&(n.name=r.name),N(n,r),Promise.resolve(n)},R.prototype.loadSkin=function(e){var t=this.json.skins[e],n={joints:t.joints};return t.inverseBindMatrices===void 0?Promise.resolve(n):this.getDependency(`accessor`,t.inverseBindMatrices).then(function(e){return n.inverseBindMatrices=e,n})},R.prototype.loadAnimation=function(e){for(var n=this.json.animations[e],r=[],i=[],a=[],o=[],s=[],c=0,l=n.channels.length;c<l;c++){var u=n.channels[c],d=n.samplers[u.sampler],f=u.target,p=f.node===void 0?f.id:f.node,m=n.parameters===void 0?d.input:n.parameters[d.input],h=n.parameters===void 0?d.output:n.parameters[d.output];r.push(this.getDependency(`node`,p)),i.push(this.getDependency(`accessor`,m)),a.push(this.getDependency(`accessor`,h)),o.push(d),s.push(f)}return Promise.all([Promise.all(r),Promise.all(i),Promise.all(a),Promise.all(o),Promise.all(s)]).then(function(r){for(var i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=[],u=0,d=i.length;u<d;u++){var f=i[u],p=a[u],m=o[u],h=s[u],g=c[u];if(f!==void 0){f.updateMatrix(),f.matrixAutoUpdate=!0;var _;switch(E[g.path]){case E.weights:_=t.NumberKeyframeTrack;break;case E.rotation:_=t.QuaternionKeyframeTrack;break;case E.position:case E.scale:default:_=t.VectorKeyframeTrack;break}var y=f.name?f.name:f.uuid,b=h.interpolation===void 0?t.InterpolateLinear:D[h.interpolation],x=[];E[g.path]===E.weights?f.traverse(function(e){e.isMesh===!0&&e.morphTargetInfluences&&x.push(e.name?e.name:e.uuid)}):x.push(y);var S=m.array;if(m.normalized){var C;if(S.constructor===Int8Array)C=1/127;else if(S.constructor===Uint8Array)C=1/255;else if(S.constructor==Int16Array)C=1/32767;else if(S.constructor===Uint16Array)C=1/65535;else throw Error(`THREE.GLTFLoader: Unsupported output accessor component type.`);for(var w=new Float32Array(S.length),T=0,O=S.length;T<O;T++)w[T]=S[T]*C;S=w}for(var T=0,O=x.length;T<O;T++){var k=new _(x[T]+`.`+E[g.path],p.array,S,b);h.interpolation===`CUBICSPLINE`&&(k.createInterpolant=function(e){return new v(this.times,this.values,this.getValueSize()/3,e)},k.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(k)}}}return new t.AnimationClip(n.name?n.name:`animation_`+e,void 0,l)})},R.prototype.loadNode=function(e){var n=this.json,i=this.extensions,a=this,o=n.meshReferences,s=n.meshUses,c=n.nodes[e];return function(){var e=[];return c.mesh!==void 0&&e.push(a.getDependency(`mesh`,c.mesh).then(function(e){var t;if(o[c.mesh]>1){var n=s[c.mesh]++;t=e.clone(),t.name+=`_instance_`+n}else t=e;return c.weights!==void 0&&t.traverse(function(e){if(e.isMesh)for(var t=0,n=c.weights.length;t<n;t++)e.morphTargetInfluences[t]=c.weights[t]}),t})),c.camera!==void 0&&e.push(a.getDependency(`camera`,c.camera)),c.extensions&&c.extensions[r.KHR_LIGHTS_PUNCTUAL]&&c.extensions[r.KHR_LIGHTS_PUNCTUAL].light!==void 0&&e.push(a.getDependency(`light`,c.extensions[r.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(e)}().then(function(n){var r=c.isBone===!0?new t.Bone:n.length>1?new t.Group:n.length===1?n[0]:new t.Object3D;if(r!==n[0])for(var o=0,s=n.length;o<s;o++)r.add(n[o]);if(c.name&&(r.userData.name=c.name,r.name=t.PropertyBinding.sanitizeNodeName(c.name)),N(r,c),c.extensions&&M(i,r,c),c.matrix!==void 0){var l=new t.Matrix4;l.fromArray(c.matrix),r.applyMatrix4(l)}else c.translation!==void 0&&r.position.fromArray(c.translation),c.rotation!==void 0&&r.quaternion.fromArray(c.rotation),c.scale!==void 0&&r.scale.fromArray(c.scale);return a.associations.set(r,{type:`nodes`,index:e}),r})},R.prototype.loadScene=function(){function e(n,r,i,a){var o=i.nodes[n];return a.getDependency(`node`,n).then(function(e){if(o.skin===void 0)return e;var n;return a.getDependency(`skin`,o.skin).then(function(e){n=e;for(var t=[],r=0,i=n.joints.length;r<i;r++)t.push(a.getDependency(`node`,n.joints[r]));return Promise.all(t)}).then(function(r){return e.traverse(function(e){if(e.isMesh){for(var i=[],a=[],o=0,s=r.length;o<s;o++){var c=r[o];if(c){i.push(c);var l=new t.Matrix4;n.inverseBindMatrices!==void 0&&l.fromArray(n.inverseBindMatrices.array,o*16),a.push(l)}else console.warn(`THREE.GLTFLoader: Joint "%s" could not be found.`,n.joints[o])}e.bind(new t.Skeleton(i,a),e.matrixWorld)}}),e})}).then(function(t){r.add(t);var n=[];if(o.children)for(var s=o.children,c=0,l=s.length;c<l;c++){var u=s[c];n.push(e(u,t,i,a))}return Promise.all(n)})}return function(n){var r=this.json,i=this.extensions,a=this.json.scenes[n],o=this,s=new t.Group;a.name&&(s.name=a.name),N(s,a),a.extensions&&M(i,s,a);for(var c=a.nodes||[],l=[],u=0,d=c.length;u<d;u++)l.push(e(c[u],s,r,o));return Promise.all(l).then(function(){return s})}}(),e})(),u=function(e){t.Loader.call(this,e),this.decoderPath=``,this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL=``,this.defaultAttributeIDs={position:`POSITION`,normal:`NORMAL`,color:`COLOR`,uv:`TEX_COORD`},this.defaultAttributeTypes={position:`Float32Array`,normal:`Float32Array`,color:`Float32Array`,uv:`Float32Array`}};u.prototype=Object.assign(Object.create(t.Loader.prototype),{constructor:u,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn(`THREE.DRACOLoader: The .setVerbosity() method has been removed.`)},setDrawMode:function(){console.warn(`THREE.DRACOLoader: The .setDrawMode() method has been removed.`)},setSkipDequantization:function(){console.warn(`THREE.DRACOLoader: The .setSkipDequantization() method has been removed.`)},load:function(e,n,r,i){var a=new t.FileLoader(this.manager);a.setPath(this.path),a.setResponseType(`arraybuffer`),this.crossOrigin===`use-credentials`&&a.setWithCredentials(!0),a.load(e,e=>{var t={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,t).then(n).catch(i)},r,i)},decodeDracoFile:function(e,t,n,r){var i={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)},decodeGeometry:function(e,t){for(var n in t.attributeTypes){var r=t.attributeTypes[n];r.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[n]=r.name)}var i=JSON.stringify(t);if(u.taskCache.has(e)){var a=u.taskCache.get(e);if(a.key===i)return a.promise;if(e.byteLength===0)throw Error(`THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.`)}var o,s=this.workerNextTaskID++,c=e.byteLength,l=this._getWorker(s,c).then(n=>(o=n,new Promise((n,r)=>{o._callbacks[s]={resolve:n,reject:r},o.postMessage({type:`decode`,id:s,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return l.catch(()=>!0).then(()=>{o&&s&&this._releaseTask(o,s)}),u.taskCache.set(e,{key:i,promise:l}),l},_createGeometry:function(e){var n=new t.BufferGeometry;e.index&&n.setIndex(new t.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var i=e.attributes[r],a=i.name,o=i.array,s=i.itemSize;n.setAttribute(a,new t.BufferAttribute(o,s))}return n},_loadLibrary:function(e,n){var r=new t.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(n),new Promise((t,n)=>{r.load(e,t,void 0,n)})},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e=typeof WebAssembly!=`object`||this.decoderConfig.type===`js`,t=[];return e?t.push(this._loadLibrary(`draco_decoder.js`,`text`)):(t.push(this._loadLibrary(`draco_wasm_wrapper.js`,`text`)),t.push(this._loadLibrary(`draco_decoder.wasm`,`arraybuffer`))),this.decoderPending=Promise.all(t).then(t=>{var n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var r=u.DRACOWorker.toString(),i=[`/* draco decoder */`,n,``,`/* worker */`,r.substring(r.indexOf(`{`)+1,r.lastIndexOf(`}`))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){var n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:`init`,decoderConfig:this.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case`decode`:n._callbacks[t.id].resolve(t);break;case`error`:n._callbacks[t.id].reject(t);break;default:console.error(`THREE.DRACOLoader: Unexpected message, "`+t.type+`"`)}},this.workerPool.push(n)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});var n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log(`Task load: `,this.workerPool.map(e=>e._taskLoad))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),u.DRACOWorker=function(){var e,t;onmessage=function(r){var i=r.data;switch(i.type){case`init`:e=i.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case`decode`:var a=i.buffer,o=i.taskConfig;t.then(e=>{var t=e.draco,r=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(a),a.byteLength);try{var c=n(t,r,s,o),l=c.attributes.map(e=>e.array.buffer);c.index&&l.push(c.index.array.buffer),self.postMessage({type:`decode`,id:i.id,geometry:c},l)}catch(e){console.error(e),self.postMessage({type:`error`,id:i.id,error:e.message})}finally{t.destroy(s),t.destroy(r)}});break}};function n(e,t,n,i){var a=i.attributeIDs,o=i.attributeTypes,s,c,l=t.GetEncodedGeometryType(n);if(l===e.TRIANGULAR_MESH)s=new e.Mesh,c=t.DecodeBufferToMesh(n,s);else if(l===e.POINT_CLOUD)s=new e.PointCloud,c=t.DecodeBufferToPointCloud(n,s);else throw Error(`THREE.DRACOLoader: Unexpected geometry type.`);if(!c.ok()||s.ptr===0)throw Error(`THREE.DRACOLoader: Decoding failed: `+c.error_msg());var u={index:null,attributes:[]};for(var d in a){var f=self[o[d]],p,m;if(i.useUniqueIDs)m=a[d],p=t.GetAttributeByUniqueId(s,m);else{if(m=t.GetAttributeId(s,e[a[d]]),m===-1)continue;p=t.GetAttribute(s,m)}u.attributes.push(r(e,t,s,d,f,p))}if(l===e.TRIANGULAR_MESH){for(var h=s.num_faces(),g=h*3,_=new Uint32Array(g),v=new e.DracoInt32Array,y=0;y<h;++y){t.GetFaceFromMesh(s,y,v);for(var b=0;b<3;++b)_[y*3+b]=v.GetValue(b)}u.index={array:_,itemSize:1},e.destroy(v)}return e.destroy(s),u}function r(e,t,n,r,i,a){var o=a.num_components(),s=n.num_points()*o,c,l;switch(i){case Float32Array:c=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(n,a,c),l=new Float32Array(s);break;case Int8Array:c=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(n,a,c),l=new Int8Array(s);break;case Int16Array:c=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(n,a,c),l=new Int16Array(s);break;case Int32Array:c=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(n,a,c),l=new Int32Array(s);break;case Uint8Array:c=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(n,a,c),l=new Uint8Array(s);break;case Uint16Array:c=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(n,a,c),l=new Uint16Array(s);break;case Uint32Array:c=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(n,a,c),l=new Uint32Array(s);break;default:throw Error(`THREE.DRACOLoader: Unexpected attribute type.`)}for(var u=0;u<s;u++)l[u]=c.GetValue(u);return e.destroy(c),{name:r,array:l,itemSize:o}}},u.taskCache=new WeakMap,u.setDecoderPath=function(){console.warn(`THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.`)},u.setDecoderConfig=function(){console.warn(`THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.`)},u.releaseDecoderModule=function(){console.warn(`THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.`)},u.getDecoderModule=function(){console.warn(`THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.`)};var d=function(e){t.CompressedTextureLoader.call(this,e)};d.prototype=Object.assign(Object.create(t.CompressedTextureLoader.prototype),{constructor:d,parse:function(e,n){var r={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},i=542327876,a=131072,o=512,s=1024,c=2048,l=4096,u=8192,d=16384,f=32768,p=4;function m(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function h(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}function g(e,t,n,r){for(var i=n*r*4,a=new Uint8Array(e,t,i),o=new Uint8Array(i),s=0,c=0,l=0;l<r;l++)for(var u=0;u<n;u++){var d=a[c];c++;var f=a[c];c++;var p=a[c];c++;var m=a[c];c++,o[s]=p,s++,o[s]=f,s++,o[s]=d,s++,o[s]=m,s++}return o}var _=m(`DXT1`),v=m(`DXT3`),y=m(`DXT5`),b=m(`ETC1`),x=31,S=0,C=1,w=2,T=3,E=4,D=7,O=20,k=21,A=22,j=23,M=24,N=25,P=26,F=28,I=new Int32Array(e,0,x);if(I[S]!==i)return console.error(`THREE.DDSLoader.parse: Invalid magic number in DDS header.`),r;if(!I[O]&p)return console.error(`THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code.`),r;var L,R=I[k],z=!1;switch(R){case _:L=8,r.format=t.RGB_S3TC_DXT1_Format;break;case v:L=16,r.format=t.RGBA_S3TC_DXT3_Format;break;case y:L=16,r.format=t.RGBA_S3TC_DXT5_Format;break;case b:L=8,r.format=t.RGB_ETC1_Format;break;default:if(I[A]===32&&I[j]&16711680&&I[M]&65280&&I[N]&255&&I[P]&4278190080)z=!0,L=64,r.format=t.RGBAFormat;else return console.error(`THREE.DDSLoader.parse: Unsupported FourCC code `,h(R)),r}r.mipmapCount=1,I[w]&a&&n!==!1&&(r.mipmapCount=Math.max(1,I[D]));var B=I[F];if(r.isCubemap=!!(B&o),r.isCubemap&&(!(B&s)||!(B&c)||!(B&l)||!(B&u)||!(B&d)||!(B&f)))return console.error(`THREE.DDSLoader.parse: Incomplete cubemap faces`),r;r.width=I[E],r.height=I[T];for(var V=I[C]+4,H=r.isCubemap?6:1,U=0;U<H;U++)for(var W=r.width,G=r.height,K=0;K<r.mipmapCount;K++){if(z)var q=g(e,V,W,G),J=q.length;else var J=Math.max(4,W)/4*Math.max(4,G)/4*L,q=new Uint8Array(e,V,J);var Y={data:q,width:W,height:G};r.mipmaps.push(Y),V+=J,W=Math.max(W>>1,1),G=Math.max(G>>1,1)}return r}});var f=class extends t.Group{constructor(e){super(),this.needsRender=!0,e&&e.children.length&&this.add(...e.children),this.mixer=new t.AnimationMixer(this)}clone(){let e=super.clone(!0);return e.mixer=new t.AnimationMixer(e),e.needsRender=!0,e}},p=`https://vr-public.realsee-cdn.cn/release/static/image/release/five/resource/draco/1.5.6/`,m=class extends l{static get version(){return`6.9.2`}constructor(e){super(e),this.ddsLoader=new d(e),this.dracoLoader=new u(e),this.dracoLoader.setDecoderPath(p)}load(e,t,n,r){return super.load(e,t,n,r)}parse(e,t,n,r){return super.parse(e,t,e=>{let t=new f(e.scene),r=e.scenes.map(n=>n===e.scene?t:new f(n));n(Object.assign(e,{scene:t,scenes:r}))},r)}};e.DDSLoader=d,e.DRACOLoader=u,e.GLTFLoader=m,e.GLTFObject=f,e.THREEGLTFLoader=l});