@xeokit/xeokit-sdk 2.6.69 → 2.6.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/xeokit-sdk.cjs.js +4332 -207
- package/dist/xeokit-sdk.es.js +4332 -208
- package/dist/xeokit-sdk.es5.js +221 -204
- package/dist/xeokit-sdk.min.cjs.js +10 -4
- package/dist/xeokit-sdk.min.es.js +11 -5
- package/dist/xeokit-sdk.min.es5.js +10 -4
- package/package.json +3 -1
- package/src/extras/ContextMenu/ContextMenu.js +11 -9
- package/src/plugins/AnnotationsPlugin/Annotation.js +28 -16
- package/src/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.js +86 -0
- package/src/plugins/CxConverterIFCLoaderPlugin/index.js +1 -0
- package/src/plugins/LASLoaderPlugin/LASDefaultDataSource.js +13 -1
- package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +89 -43
- package/src/plugins/NavCubePlugin/CubeTextureCanvas.js +2 -2
- package/src/plugins/NavCubePlugin/NavCubePlugin.js +10 -10
- package/src/plugins/SectionPlanesPlugin/Control.js +2 -2
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +4 -3
- package/src/plugins/ZonesPlugin/ZonesPlugin.js +6 -151
- package/src/plugins/index.js +1 -0
- package/src/plugins/lib/ui/index.js +592 -34
- package/src/viewer/scene/geometry/ReadableGeometry.js +60 -0
- package/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +1 -1
- package/src/viewer/scene/math/math.js +14 -2
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +1 -24
- package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +2 -19
- package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +1 -24
- package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +1 -19
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js +1 -24
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +2 -19
- package/src/viewer/scene/scene/Scene.js +2 -3
- package/src/viewer/scene/sectionCaps/SectionCaps.js +46 -65
- package/types/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.d.ts +36 -0
- package/types/plugins/CxConverterIFCLoaderPlugin/index.d.ts +1 -0
- package/types/plugins/NavCubePlugin/NavCubePlugin.d.ts +1 -1
- package/types/plugins/index.d.ts +1 -0
- package/types/viewer/scene/ImagePlane/ImagePlane.d.ts +397 -0
- package/types/viewer/scene/ImagePlane/index.d.ts +1 -0
- package/types/viewer/scene/geometry/builders/index.d.ts +1 -0
- package/types/viewer/scene/index.d.ts +1 -0
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* xeokit-sdk v2.6.71
|
|
3
|
+
* Commit: 7443626ab66b3eab0018b1ed0ee05d3bfa9f8eae
|
|
4
|
+
* Built: 2025-03-21T09:02:29.217Z
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
var _globalThis$loaders3,_DRACO_EXTERNAL_LIBRA,_DEFAULT_SAMPLER_PARA;var _marked=/*#__PURE__*/_regeneratorRuntime().mark(makeStringIterator),_marked2=/*#__PURE__*/_regeneratorRuntime().mark(makeArrayBufferIterator),_marked3=/*#__PURE__*/_regeneratorRuntime().mark(makeMeshPrimitiveIterator);function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map():undefined;_wrapNativeSuper=function _wrapNativeSuper(Class){if(Class===null||!_isNativeFunction(Class))return Class;if(typeof Class!=="function"){throw new TypeError("Super expression must either be null or a function");}if(typeof _cache!=="undefined"){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper);}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor);}Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(Wrapper,Class);};return _wrapNativeSuper(Class);}function _construct(Parent,args,Class){if(_isNativeReflectConstruct()){_construct=Reflect.construct.bind();}else{_construct=function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor();if(Class)_setPrototypeOf(instance,Class.prototype);return instance;};}return _construct.apply(null,arguments);}function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1;}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return exports;};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key];}try{define({},"");}catch(err){define=function define(obj,key,value){return obj[key]=value;};}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult();}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult;}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg);}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done};}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg);}};}(innerFn,self,context),generator;}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)};}catch(err){return{type:"throw",arg:err};}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this;});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg);});});}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject);},function(err){invoke("throw",err,resolve,reject);}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result);},function(error){return invoke("throw",error,resolve,reject);});}reject(record.arg);}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();};}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(undefined===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator["return"]&&(context.method="return",context.arg=undefined,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method");}return ContinueSentinel;}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=undefined),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel);}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry);}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record;}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0);}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;){if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;}return next.value=undefined,next.done=!0,next;};return next.next=next;}}return{next:doneResult};}function doneResult(){return{value:undefined,done:!0};}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name));},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun;},exports.awrap=function(arg){return{__await:arg};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this;}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next();});},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this;}),define(Gp,"toString",function(){return"[object Generator]";}),exports.keys=function(object){var keys=[];for(var key in object){keys.push(key);}return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next;}return next.done=!0,next;};},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this){"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=undefined);}},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval;},dispatchException:function dispatchException(exception){if(this.done)throw exception;var context=this;function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=undefined),!!caught;}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}else if(hasCatch){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);}else{if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}}}},abrupt:function abrupt(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break;}}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record);},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel;},finish:function finish(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel;}},"catch":function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry);}return thrown;}}throw new Error("illegal catch attempt");},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=undefined),ContinueSentinel;}},exports;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e14){throw _e14;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e15){didErr=true;err=_e15;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _awaitAsyncGenerator(value){return new _AwaitValue(value);}function _wrapAsyncGenerator(fn){return function(){return new _AsyncGenerator(fn.apply(this,arguments));};}function _AsyncGenerator(gen){var front,back;function send(key,arg){return new Promise(function(resolve,reject){var request={key:key,arg:arg,resolve:resolve,reject:reject,next:null};if(back){back=back.next=request;}else{front=back=request;resume(key,arg);}});}function resume(key,arg){try{var result=gen[key](arg);var value=result.value;var wrappedAwait=value instanceof _AwaitValue;Promise.resolve(wrappedAwait?value.wrapped:value).then(function(arg){if(wrappedAwait){resume(key==="return"?"return":"next",arg);return;}settle(result.done?"return":"normal",arg);},function(err){resume("throw",err);});}catch(err){settle("throw",err);}}function settle(type,value){switch(type){case"return":front.resolve({value:value,done:true});break;case"throw":front.reject(value);break;default:front.resolve({value:value,done:false});break;}front=front.next;if(front){resume(front.key,front.arg);}else{back=null;}}this._invoke=send;if(typeof gen["return"]!=="function"){this["return"]=undefined;}}_AsyncGenerator.prototype[typeof Symbol==="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this;};_AsyncGenerator.prototype.next=function(arg){return this._invoke("next",arg);};_AsyncGenerator.prototype["throw"]=function(arg){return this._invoke("throw",arg);};_AsyncGenerator.prototype["return"]=function(arg){return this._invoke("return",arg);};function _AwaitValue(value){this.wrapped=value;}function _asyncIterator(iterable){var method,async,sync,retry=2;for("undefined"!=typeof Symbol&&(async=Symbol.asyncIterator,sync=Symbol.iterator);retry--;){if(async&&null!=(method=iterable[async]))return method.call(iterable);if(sync&&null!=(method=iterable[sync]))return new AsyncFromSyncIterator(method.call(iterable));async="@@asyncIterator",sync="@@iterator";}throw new TypeError("Object is not async iterable");}function AsyncFromSyncIterator(s){function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r)return Promise.reject(new TypeError(r+" is not an object."));var done=r.done;return Promise.resolve(r.value).then(function(value){return{value:value,done:done};});}return AsyncFromSyncIterator=function AsyncFromSyncIterator(s){this.s=s,this.n=s.next;},AsyncFromSyncIterator.prototype={s:null,n:null,next:function next(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments));},"return":function _return(value){var ret=this.s["return"];return void 0===ret?Promise.resolve({value:value,done:!0}):AsyncFromSyncIteratorContinuation(ret.apply(this.s,arguments));},"throw":function _throw(value){var thr=this.s["return"];return void 0===thr?Promise.reject(value):AsyncFromSyncIteratorContinuation(thr.apply(this.s,arguments));}},new AsyncFromSyncIterator(s);}/** @private */var Map$1=/*#__PURE__*/function(){function Map$1(items,baseId){_classCallCheck(this,Map$1);this.items=items||[];this._lastUniqueId=(baseId||0)+1;}/**
|
|
2
8
|
* Usage:
|
|
3
9
|
*
|
|
@@ -513,9 +519,7 @@ var doublePrecision=true;var FloatArrayType=doublePrecision?Float64Array:Float32
|
|
|
513
519
|
* @param mat3 3x3 matrix
|
|
514
520
|
* @static
|
|
515
521
|
* @returns {Number[]}
|
|
516
|
-
*/mat4ToMat3:function mat4ToMat3(mat4
|
|
517
|
-
//return new FloatArrayType(values || 9);
|
|
518
|
-
},/**
|
|
522
|
+
*/mat4ToMat3:function mat4ToMat3(mat4){var mat3=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new FloatArrayType(9);mat3[0]=mat4[0];mat3[1]=mat4[1];mat3[2]=mat4[2];mat3[3]=mat4[4];mat3[4]=mat4[5];mat3[5]=mat4[6];mat3[6]=mat4[8];mat3[7]=mat4[9];mat3[8]=mat4[10];return mat3;},/**
|
|
519
523
|
* Converts a list of double-precision values to a list of high-part floats and a list of low-part floats.
|
|
520
524
|
* @param doubleVals
|
|
521
525
|
* @param floatValsHigh
|
|
@@ -15267,7 +15271,7 @@ var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(
|
|
|
15267
15271
|
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(batchingLayer);//=============================================================
|
|
15268
15272
|
// TODO: Use drawElements count and offset to draw only one entity
|
|
15269
15273
|
//=============================================================
|
|
15270
|
-
state.indicesBuf.bind();gl.drawElements(gl.TRIANGLES,state.indicesBuf.numItems,state.indicesBuf.itemType,0);state.indicesBuf.unbind();}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(TrianglesSnapInitRenderer$1.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("out float isPerspective;");}src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");src.push("flat out vec4 vPickColor;");src.push("out vec4 vWorldPosition;");if(clipping){src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15274
|
+
state.indicesBuf.bind();gl.drawElements(gl.TRIANGLES,state.indicesBuf.numItems,state.indicesBuf.itemType,0);state.indicesBuf.unbind();gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(TrianglesSnapInitRenderer$1.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("out float isPerspective;");}src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");src.push("flat out vec4 vPickColor;");src.push("out vec4 vWorldPosition;");if(clipping){src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15271
15275
|
// renderPass = PICK
|
|
15272
15276
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
15273
15277
|
src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push(" relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");src.push(" vWorldPosition = worldPosition;");if(clipping){src.push(" vFlags = flags;");}src.push("vPickColor = pickColor;");src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");{src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push(" }");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");{src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int layerNumber;");src.push("uniform vec3 coordinateScaler;");src.push("in vec4 vWorldPosition;");src.push("flat in vec4 vPickColor;");if(clipping){src.push("in float vFlags;");for(var _i220=0;_i220<sectionPlanesState.getNumAllocatedSectionPlanes();_i220++){src.push("uniform bool sectionPlaneActive"+_i220+";");src.push("uniform vec3 sectionPlanePos"+_i220+";");src.push("uniform vec3 sectionPlaneDir"+_i220+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("layout(location = 0) out highp ivec4 outCoords;");src.push("layout(location = 1) out highp ivec4 outNormal;");src.push("layout(location = 2) out lowp uvec4 outPickColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var i=0;i<sectionPlanesState.getNumAllocatedSectionPlanes();i++){src.push(" if (sectionPlaneActive"+i+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+i+".xyz, vWorldPosition.xyz - sectionPlanePos"+i+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}{src.push(" float dx = dFdx(vFragDepth);");src.push(" float dy = dFdy(vFragDepth);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);");src.push("vec3 xTangent = dFdx( vWorldPosition.xyz );");src.push("vec3 yTangent = dFdy( vWorldPosition.xyz );");src.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );");src.push("outNormal = ivec4(worldNormal * float(".concat(math.MAX_INT,"), 1.0);"));src.push("outPickColor = uvec4(vPickColor);");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return TrianglesSnapInitRenderer$1;}(VBORenderer);var tempVec3a$A=math.vec3();var tempVec3b$w=math.vec3();var tempVec3c$r=math.vec3();var tempVec3d$b=math.vec3();var tempMat4a$p=math.mat4();/**
|
|
@@ -15278,7 +15282,7 @@ gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUnif
|
|
|
15278
15282
|
// TODO: Use drawElements count and offset to draw only one entity
|
|
15279
15283
|
//=============================================================
|
|
15280
15284
|
if(frameCtx.snapMode==="edge"){if(state.edgeIndicesBuf){state.edgeIndicesBuf.bind();gl.drawElements(gl.LINES,state.edgeIndicesBuf.numItems,state.edgeIndicesBuf.itemType,0);state.edgeIndicesBuf.unbind();// needed?
|
|
15281
|
-
}}else{gl.drawArrays(gl.POINTS,0,state.positionsBuf.numItems);}}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(TrianglesSnapRenderer$1.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;scene.pointsMaterial._state;var src=[];src.push('#version 300 es');src.push("// SnapBatchingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15285
|
+
}}else{gl.drawArrays(gl.POINTS,0,state.positionsBuf.numItems);}gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(TrianglesSnapRenderer$1.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;scene.pointsMaterial._state;var src=[];src.push('#version 300 es');src.push("// SnapBatchingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15282
15286
|
// renderPass = PICK
|
|
15283
15287
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(2.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
15284
15288
|
src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push("relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");{src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("gl_PointSize = 1.0;");// Windows needs this?
|
|
@@ -15604,8 +15608,7 @@ var lightsState=scene._lightsState;var sectionPlanesState=scene._sectionPlanesSt
|
|
|
15604
15608
|
src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(colorTexel.rgb * ambient, opacity);");}else{src.push(" outColor = vec4(colorTexel.rgb, opacity);");}if(gammaOutput){src.push("outColor = linearToGamma(outColor, gammaFactor);");}if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);return TrianglesColorTextureRenderer;}(TrianglesInstancingRenderer);var tempVec3a$y=math.vec3();var tempVec3b$u=math.vec3();var tempVec3c$p=math.vec3();var tempVec3d$9=math.vec3();var tempMat4a$o=math.mat4();/**
|
|
15605
15609
|
* @private
|
|
15606
15610
|
*/var TrianglesSnapInitRenderer=/*#__PURE__*/function(_VBORenderer5){_inherits(TrianglesSnapInitRenderer,_VBORenderer5);var _super87=_createSuper(TrianglesSnapInitRenderer);function TrianglesSnapInitRenderer(scene){_classCallCheck(this,TrianglesSnapInitRenderer);return _super87.call(this,scene,false,{instancing:true});}_createClass(TrianglesSnapInitRenderer,[{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}var model=instancingLayer.model;var scene=model.scene;var gl=scene.canvas.gl;var camera=scene.camera;var state=instancingLayer._state;var origin=instancingLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix;var aabb=instancingLayer.aabb;// Per-layer AABB for best RTC accuracy
|
|
15607
|
-
var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(instancingLayer)){gl.bindVertexArray(this._vaoCache.get(instancingLayer));}else{this._vaoCache.set(instancingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$y;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;var rtcCameraEye;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$u;if(origin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$p);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$o);rtcCameraEye=tempVec3d$9;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;rtcCameraEye=camera.eye;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrix,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);
|
|
15608
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,0);if(this._aFlags){gl.vertexAttribDivisor(this._aFlags.location,0);}if(this._aOffset){gl.vertexAttribDivisor(this._aOffset.location,0);}}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(TrianglesSnapInitRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
15611
|
+
var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(instancingLayer)){gl.bindVertexArray(this._vaoCache.get(instancingLayer));}else{this._vaoCache.set(instancingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$y;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;var rtcCameraEye;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$u;if(origin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$p);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$o);rtcCameraEye=tempVec3d$9;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;rtcCameraEye=camera.eye;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrix,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);state.indicesBuf.bind();gl.drawElementsInstanced(gl.TRIANGLES,state.indicesBuf.numItems,state.indicesBuf.itemType,0,state.numInstances);state.indicesBuf.unbind();gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(TrianglesSnapInitRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
15609
15612
|
src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");src.push("flat out vec4 vPickColor;");src.push("out vec4 vWorldPosition;");if(clipping){src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15610
15613
|
// renderPass = PICK
|
|
15611
15614
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
@@ -15613,9 +15616,8 @@ src.push("} else {");src.push(" vec4 worldPosition = positionsDecodeMatrix * ve
|
|
|
15613
15616
|
* @private
|
|
15614
15617
|
*/var TrianglesSnapRenderer=/*#__PURE__*/function(_VBORenderer6){_inherits(TrianglesSnapRenderer,_VBORenderer6);var _super88=_createSuper(TrianglesSnapRenderer);function TrianglesSnapRenderer(scene){_classCallCheck(this,TrianglesSnapRenderer);return _super88.call(this,scene,false,{instancing:true});}_createClass(TrianglesSnapRenderer,[{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){if(!this._program){this._allocate(instancingLayer);if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}var model=instancingLayer.model;var scene=model.scene;var camera=scene.camera;var gl=scene.canvas.gl;var state=instancingLayer._state;var origin=instancingLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix;var aabb=instancingLayer.aabb;// Per-layer AABB for best RTC accuracy
|
|
15615
15618
|
var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(instancingLayer)){gl.bindVertexArray(this._vaoCache.get(instancingLayer));}else{this._vaoCache.set(instancingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$x;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;var rtcCameraEye;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$t;if(origin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$o);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$n);rtcCameraEye=tempVec3d$8;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;rtcCameraEye=camera.eye;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrix,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);// TODO: Far from pick project matrix
|
|
15616
|
-
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);
|
|
15617
|
-
}}else{gl.drawArraysInstanced(gl.POINTS,0,state.positionsBuf.numItems,state.numInstances);}//
|
|
15618
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,0);gl.vertexAttribDivisor(this._aFlags.location,0);if(this._aOffset){gl.vertexAttribDivisor(this._aOffset.location,0);}}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(TrianglesSnapRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
15619
|
+
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);if(frameCtx.snapMode==="edge"){if(state.edgeIndicesBuf){state.edgeIndicesBuf.bind();gl.drawElementsInstanced(gl.LINES,state.edgeIndicesBuf.numItems,state.edgeIndicesBuf.itemType,0,state.numInstances);state.edgeIndicesBuf.unbind();// needed?
|
|
15620
|
+
}}else{gl.drawArraysInstanced(gl.POINTS,0,state.positionsBuf.numItems,state.numInstances);}gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(TrianglesSnapRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
15619
15621
|
src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15620
15622
|
// renderPass = PICK
|
|
15621
15623
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(2.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
@@ -15773,7 +15775,7 @@ var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(
|
|
|
15773
15775
|
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(batchingLayer);//=============================================================
|
|
15774
15776
|
// TODO: Use drawElements count and offset to draw only one entity
|
|
15775
15777
|
//=============================================================
|
|
15776
|
-
state.indicesBuf.bind();gl.drawElements(gl.LINES,state.indicesBuf.numItems,state.indicesBuf.itemType,0);state.indicesBuf.unbind();}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOBatchingLinesSnapInitRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("out float isPerspective;");}src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");src.push("flat out vec4 vPickColor;");src.push("out vec4 vWorldPosition;");if(clipping){src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15778
|
+
state.indicesBuf.bind();gl.drawElements(gl.LINES,state.indicesBuf.numItems,state.indicesBuf.itemType,0);state.indicesBuf.unbind();gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOBatchingLinesSnapInitRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("out float isPerspective;");}src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");src.push("flat out vec4 vPickColor;");src.push("out vec4 vWorldPosition;");if(clipping){src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15777
15779
|
// renderPass = PICK
|
|
15778
15780
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
15779
15781
|
src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push(" relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");src.push(" vWorldPosition = worldPosition;");if(clipping){src.push(" vFlags = flags;");}src.push("vPickColor = pickColor;");src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");{src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push(" }");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");{src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int layerNumber;");src.push("uniform vec3 coordinateScaler;");src.push("in vec4 vWorldPosition;");src.push("flat in vec4 vPickColor;");if(clipping){src.push("in float vFlags;");for(var _i287=0;_i287<sectionPlanesState.getNumAllocatedSectionPlanes();_i287++){src.push("uniform bool sectionPlaneActive"+_i287+";");src.push("uniform vec3 sectionPlanePos"+_i287+";");src.push("uniform vec3 sectionPlaneDir"+_i287+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("layout(location = 0) out highp ivec4 outCoords;");src.push("layout(location = 1) out highp ivec4 outNormal;");src.push("layout(location = 2) out lowp uvec4 outPickColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var i=0;i<sectionPlanesState.getNumAllocatedSectionPlanes();i++){src.push(" if (sectionPlaneActive"+i+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+i+".xyz, vWorldPosition.xyz - sectionPlanePos"+i+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}{src.push(" float dx = dFdx(vFragDepth);");src.push(" float dy = dFdy(vFragDepth);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);");src.push("vec3 xTangent = dFdx( vWorldPosition.xyz );");src.push("vec3 yTangent = dFdy( vWorldPosition.xyz );");src.push("vec3 worldNormal = normalize( cross( xTangent, yTangent ) );");src.push("outNormal = ivec4(worldNormal * float(".concat(math.MAX_INT,"), 1.0);"));src.push("outPickColor = uvec4(vPickColor);");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return VBOBatchingLinesSnapInitRenderer;}(VBORenderer);var tempVec3a$u=math.vec3();var tempVec3b$q=math.vec3();var tempVec3c$l=math.vec3();var tempVec3d$5=math.vec3();var tempMat4a$l=math.mat4();/**
|
|
@@ -15784,7 +15786,7 @@ gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUnif
|
|
|
15784
15786
|
// TODO: Use drawElements count and offset to draw only one entity
|
|
15785
15787
|
//=============================================================
|
|
15786
15788
|
if(frameCtx.snapMode==="edge"){state.indicesBuf.bind();gl.drawElements(gl.LINES,state.indicesBuf.numItems,state.indicesBuf.itemType,0);state.indicesBuf.unbind();// needed?
|
|
15787
|
-
}else{gl.drawArrays(gl.POINTS,0,state.positionsBuf.numItems);}}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOBatchingLinesSnapRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;scene.pointsMaterial._state;var src=[];src.push('#version 300 es');src.push("// SnapBatchingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15789
|
+
}else{gl.drawArrays(gl.POINTS,0,state.positionsBuf.numItems);}gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOBatchingLinesSnapRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;scene.pointsMaterial._state;var src=[];src.push('#version 300 es');src.push("// SnapBatchingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15788
15790
|
// renderPass = PICK
|
|
15789
15791
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(2.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
15790
15792
|
src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push("relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");{src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("gl_PointSize = 1.0;");// Windows needs this?
|
|
@@ -15866,8 +15868,7 @@ src.push("int silhouetteFlag = int(flags) >> 4 & 0xF;");src.push("if (silhouette
|
|
|
15866
15868
|
src.push("} else {");src.push("vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); ");src.push("worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// Lines instancing silhouette fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i299=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i299<len;_i299++){src.push("uniform bool sectionPlaneActive"+_i299+";");src.push("uniform vec3 sectionPlanePos"+_i299+";");src.push("uniform vec3 sectionPlaneDir"+_i299+";");}}src.push("uniform vec4 color;");src.push("out vec4 outColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i300=0,_len61=sectionPlanesState.getNumAllocatedSectionPlanes();_i300<_len61;_i300++){src.push("if (sectionPlaneActive"+_i300+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i300+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i300+".xyz), 0.0, 1000.0);");src.push("}");}src.push("if (dist > 0.0) { discard; }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("outColor = color;");src.push("}");return src;}}]);return VBOInstancingLinesSilhouetteRenderer;}(VBOInstancingLinesRenderer);var tempVec3a$t=math.vec3();var tempVec3b$p=math.vec3();var tempVec3c$k=math.vec3();math.vec3();var tempMat4a$k=math.mat4();/**
|
|
15867
15869
|
* @private
|
|
15868
15870
|
*/var VBOInstancingLinesSnapInitRenderer=/*#__PURE__*/function(_VBORenderer11){_inherits(VBOInstancingLinesSnapInitRenderer,_VBORenderer11);var _super97=_createSuper(VBOInstancingLinesSnapInitRenderer);function VBOInstancingLinesSnapInitRenderer(scene){_classCallCheck(this,VBOInstancingLinesSnapInitRenderer);return _super97.call(this,scene,false,{instancing:true});}_createClass(VBOInstancingLinesSnapInitRenderer,[{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}var model=instancingLayer.model;var scene=model.scene;var gl=scene.canvas.gl;var camera=scene.camera;var state=instancingLayer._state;var origin=instancingLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix;var aabb=instancingLayer.aabb;// Per-layer AABB for best RTC accuracy
|
|
15869
|
-
var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(instancingLayer)){gl.bindVertexArray(this._vaoCache.get(instancingLayer));}else{this._vaoCache.set(instancingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$t;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$p;if(origin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$k);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$k);frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrix,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);
|
|
15870
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,0);if(this._aFlags){gl.vertexAttribDivisor(this._aFlags.location,0);}if(this._aOffset){gl.vertexAttribDivisor(this._aOffset.location,0);}}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOInstancingLinesSnapInitRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
15871
|
+
var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(instancingLayer)){gl.bindVertexArray(this._vaoCache.get(instancingLayer));}else{this._vaoCache.set(instancingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$t;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$p;if(origin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$k);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$k);frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrix,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);state.indicesBuf.bind();gl.drawElementsInstanced(gl.LINES,state.indicesBuf.numItems,state.indicesBuf.itemType,0,state.numInstances);state.indicesBuf.unbind();gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOInstancingLinesSnapInitRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
15871
15872
|
src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");src.push("flat out vec4 vPickColor;");src.push("out vec4 vWorldPosition;");if(clipping){src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15872
15873
|
// renderPass = PICK
|
|
15873
15874
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
@@ -15879,9 +15880,8 @@ src.push("layout(location = 2) out lowp uvec4 outPickColor;");src.push("void mai
|
|
|
15879
15880
|
* @private
|
|
15880
15881
|
*/var VBOInstancingLinesSnapRenderer=/*#__PURE__*/function(_VBORenderer12){_inherits(VBOInstancingLinesSnapRenderer,_VBORenderer12);var _super98=_createSuper(VBOInstancingLinesSnapRenderer);function VBOInstancingLinesSnapRenderer(scene){_classCallCheck(this,VBOInstancingLinesSnapRenderer);return _super98.call(this,scene,false,{instancing:true});}_createClass(VBOInstancingLinesSnapRenderer,[{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){if(!this._program){this._allocate(instancingLayer);if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}var model=instancingLayer.model;var scene=model.scene;var camera=scene.camera;var gl=scene.canvas.gl;var state=instancingLayer._state;var origin=instancingLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix;var aabb=instancingLayer.aabb;// Per-layer AABB for best RTC accuracy
|
|
15881
15882
|
var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(instancingLayer)){gl.bindVertexArray(this._vaoCache.get(instancingLayer));}else{this._vaoCache.set(instancingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$s;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$o;if(origin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$j);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$j);frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrix,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);// TODO: Far from pick project matrix
|
|
15882
|
-
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);
|
|
15883
|
-
}else{gl.drawArraysInstanced(gl.POINTS,0,state.positionsBuf.numItems,state.numInstances);}//
|
|
15884
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,0);gl.vertexAttribDivisor(this._aFlags.location,0);if(this._aOffset){gl.vertexAttribDivisor(this._aOffset.location,0);}}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOInstancingLinesSnapRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
15883
|
+
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);if(frameCtx.snapMode==="edge"){state.indicesBuf.bind();gl.drawElementsInstanced(gl.LINES,state.indicesBuf.numItems,state.indicesBuf.itemType,0,state.numInstances);state.indicesBuf.unbind();// needed?
|
|
15884
|
+
}else{gl.drawArraysInstanced(gl.POINTS,0,state.positionsBuf.numItems,state.numInstances);}gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOInstancingLinesSnapRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
15885
15885
|
src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
15886
15886
|
// renderPass = PICK
|
|
15887
15887
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(2.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
@@ -16015,7 +16015,7 @@ var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(
|
|
|
16015
16015
|
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(batchingLayer);//=============================================================
|
|
16016
16016
|
// TODO: Use drawElements count and offset to draw only one entity
|
|
16017
16017
|
//=============================================================
|
|
16018
|
-
gl.drawArrays(gl.POINTS,0,state.positionsBuf.numItems);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOBatchingPointsSnapInitRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");this._uPointSize=program.getLocation("pointSize");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// VBOBatchingPointsSnapInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");src.push("uniform float pointSize;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("out float isPerspective;");}src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");src.push("flat out vec4 vPickColor;");src.push("out vec4 vWorldPosition;");if(clipping){src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
16018
|
+
gl.drawArrays(gl.POINTS,0,state.positionsBuf.numItems);gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOBatchingPointsSnapInitRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");this._uPointSize=program.getLocation("pointSize");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// VBOBatchingPointsSnapInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");src.push("uniform float pointSize;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("out float isPerspective;");}src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");src.push("flat out vec4 vPickColor;");src.push("out vec4 vWorldPosition;");if(clipping){src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
16019
16019
|
// renderPass = PICK
|
|
16020
16020
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
16021
16021
|
src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push(" relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");src.push(" vWorldPosition = worldPosition;");if(clipping){src.push(" vFlags = flags;");}src.push("vPickColor = pickColor;");src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");{src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("gl_PointSize = pointSize;");src.push(" }");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// VBOBatchingPointsSnapInitRenderer fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");{src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int layerNumber;");src.push("uniform vec3 coordinateScaler;");src.push("in vec4 vWorldPosition;");src.push("flat in vec4 vPickColor;");if(clipping){src.push("in float vFlags;");for(var _i312=0;_i312<sectionPlanesState.getNumAllocatedSectionPlanes();_i312++){src.push("uniform bool sectionPlaneActive"+_i312+";");src.push("uniform vec3 sectionPlanePos"+_i312+";");src.push("uniform vec3 sectionPlaneDir"+_i312+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("layout(location = 0) out highp ivec4 outCoords;");src.push("layout(location = 1) out highp ivec4 outNormal;");src.push("layout(location = 2) out lowp uvec4 outPickColor;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var i=0;i<sectionPlanesState.getNumAllocatedSectionPlanes();i++){src.push(" if (sectionPlaneActive"+i+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+i+".xyz, vWorldPosition.xyz - sectionPlanePos"+i+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}{src.push(" float dx = dFdx(vFragDepth);");src.push(" float dy = dFdy(vFragDepth);");src.push(" float diff = sqrt(dx*dx+dy*dy);");src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);");// src.push("vec3 xTangent = dFdx( vWorldPosition.xyz );");
|
|
@@ -16028,7 +16028,7 @@ var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(
|
|
|
16028
16028
|
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(batchingLayer);//=============================================================
|
|
16029
16029
|
// TODO: Use drawElements count and offset to draw only one entity
|
|
16030
16030
|
//=============================================================
|
|
16031
|
-
gl.drawArrays(gl.POINTS,0,state.positionsBuf.numItems);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOBatchingPointsSnapRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;scene.pointsMaterial._state;var src=[];src.push('#version 300 es');src.push("// VBOBatchingPointsSnapRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
16031
|
+
gl.drawArrays(gl.POINTS,0,state.positionsBuf.numItems);gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOBatchingPointsSnapRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;scene.pointsMaterial._state;var src=[];src.push('#version 300 es');src.push("// VBOBatchingPointsSnapRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
16032
16032
|
// renderPass = PICK
|
|
16033
16033
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
16034
16034
|
src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push("relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");{src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("gl_PointSize = 1.0;");// Windows needs this?
|
|
@@ -16143,8 +16143,7 @@ if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = log2( vFragDept
|
|
|
16143
16143
|
src.push("} else {");src.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); ");src.push(" worldPosition = vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push(" vec4 viewPosition = shadowViewMatrix * worldPosition; ");if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push(" gl_Position = shadowProjMatrix * viewPosition;");src.push("}");src.push("gl_PointSize = pointSize;");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// Instancing geometry depth drawing fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i329=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i329<len;_i329++){src.push("uniform bool sectionPlaneActive"+_i329+";");src.push("uniform vec3 sectionPlanePos"+_i329+";");src.push("uniform vec3 sectionPlaneDir"+_i329+";");}}src.push("in vec3 vViewNormal;");src.push("vec3 packNormalToRGB( const in vec3 normal ) {");src.push(" return normalize( normal ) * 0.5 + 0.5;");src.push("}");src.push("out vec4 outColor;");src.push("void main(void) {");src.push(" vec2 cxy = 2.0 * gl_PointCoord - 1.0;");src.push(" float r = dot(cxy, cxy);");src.push(" if (r > 1.0) {");src.push(" discard;");src.push(" }");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i330=0,_len65=sectionPlanesState.getNumAllocatedSectionPlanes();_i330<_len65;_i330++){src.push("if (sectionPlaneActive"+_i330+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i330+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i330+".xyz), 0.0, 1000.0);");src.push("}");}src.push("if (dist > 0.0) { discard; }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" outColor = vec4(packNormalToRGB(vViewNormal), 1.0); ");src.push("}");return src;}}]);return VBOInstancingPointsShadowRenderer;}(VBOInstancingPointsRenderer);var tempVec3a$p=math.vec3();var tempVec3b$l=math.vec3();var tempVec3c$g=math.vec3();math.vec3();var tempMat4a$g=math.mat4();/**
|
|
16144
16144
|
* @private
|
|
16145
16145
|
*/var VBOInstancingPointsSnapInitRenderer=/*#__PURE__*/function(_VBORenderer17){_inherits(VBOInstancingPointsSnapInitRenderer,_VBORenderer17);var _super115=_createSuper(VBOInstancingPointsSnapInitRenderer);function VBOInstancingPointsSnapInitRenderer(scene){_classCallCheck(this,VBOInstancingPointsSnapInitRenderer);return _super115.call(this,scene,false,{instancing:true});}_createClass(VBOInstancingPointsSnapInitRenderer,[{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}var model=instancingLayer.model;var scene=model.scene;var gl=scene.canvas.gl;var camera=scene.camera;var state=instancingLayer._state;var origin=instancingLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix;var aabb=instancingLayer.aabb;// Per-layer AABB for best RTC accuracy
|
|
16146
|
-
var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(instancingLayer)){gl.bindVertexArray(this._vaoCache.get(instancingLayer));}else{this._vaoCache.set(instancingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$p;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$l;if(origin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$g);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$g);frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrix,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);
|
|
16147
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,0);if(this._aFlags){gl.vertexAttribDivisor(this._aFlags.location,0);}if(this._aOffset){gl.vertexAttribDivisor(this._aOffset.location,0);}}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOInstancingPointsSnapInitRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
16146
|
+
var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(instancingLayer)){gl.bindVertexArray(this._vaoCache.get(instancingLayer));}else{this._vaoCache.set(instancingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$p;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$l;if(origin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$g);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$g);frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrix,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);gl.drawArraysInstanced(gl.POINTS,0,state.positionsBuf.numItems,state.numInstances);gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOInstancingPointsSnapInitRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec4 pickColor;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
16148
16147
|
src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");src.push("flat out vec4 vPickColor;");src.push("out vec4 vWorldPosition;");if(clipping){src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
16149
16148
|
// renderPass = PICK
|
|
16150
16149
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
@@ -16155,8 +16154,7 @@ src.push("outNormal = ivec4(1.0, 1.0, 1.0, 1.0);");src.push("outPickColor = uvec
|
|
|
16155
16154
|
* @private
|
|
16156
16155
|
*/var VBOInstancingPointsSnapRenderer=/*#__PURE__*/function(_VBORenderer18){_inherits(VBOInstancingPointsSnapRenderer,_VBORenderer18);var _super116=_createSuper(VBOInstancingPointsSnapRenderer);function VBOInstancingPointsSnapRenderer(scene){_classCallCheck(this,VBOInstancingPointsSnapRenderer);return _super116.call(this,scene,false,{instancing:true});}_createClass(VBOInstancingPointsSnapRenderer,[{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){if(!this._program){this._allocate(instancingLayer);if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}var model=instancingLayer.model;var scene=model.scene;var camera=scene.camera;var gl=scene.canvas.gl;var state=instancingLayer._state;var origin=instancingLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix;var aabb=instancingLayer.aabb;// Per-layer AABB for best RTC accuracy
|
|
16157
16156
|
var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(instancingLayer)){gl.bindVertexArray(this._vaoCache.get(instancingLayer));}else{this._vaoCache.set(instancingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$o;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$k;if(origin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$f);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$f);frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrix,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);// TODO: Far from pick project matrix
|
|
16158
|
-
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);
|
|
16159
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,0);gl.vertexAttribDivisor(this._aFlags.location,0);if(this._aOffset){gl.vertexAttribDivisor(this._aOffset.location,0);}}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOInstancingPointsSnapRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
16157
|
+
gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);gl.drawArraysInstanced(gl.POINTS,0,state.positionsBuf.numItems,state.numInstances);gl.bindVertexArray(null);}},{key:"_allocate",value:function _allocate(){_get(_getPrototypeOf(VBOInstancingPointsSnapRenderer.prototype),"_allocate",this).call(this);var program=this._program;{this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
|
|
16160
16158
|
src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");{src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
|
|
16161
16159
|
// renderPass = PICK
|
|
16162
16160
|
src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
|
|
@@ -25495,7 +25493,7 @@ for(var _i529=0,len=plugins.length;_i529<len;_i529++){var plugin=plugins[_i529];
|
|
|
25495
25493
|
function parseFromContext(_x7,_x8,_x9,_x10){return _parseFromContext.apply(this,arguments);}/**
|
|
25496
25494
|
* Throws an `Error` with the optional `message` if `condition` is falsy
|
|
25497
25495
|
* @note Replacement for the external assert method to reduce bundle size
|
|
25498
|
-
*/function _parseFromContext(){_parseFromContext=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25496
|
+
*/function _parseFromContext(){_parseFromContext=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data,loaders,options,context){return _regeneratorRuntime().wrap(function _callee19$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:return _context23.abrupt("return",context._parse(data,loaders,options,context));case 1:case"end":return _context23.stop();}}},_callee19);}));return _parseFromContext.apply(this,arguments);}function assert$4(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}// Purpose: include this in your module to avoid
|
|
25499
25497
|
/** true if running in a browser */var isBrowser$2=// @ts-ignore process does not exist on browser
|
|
25500
25498
|
Boolean((typeof process==="undefined"?"undefined":_typeof(process))!=='object'||String(process)!=='[object process]'||process.browser);// Extract node major version
|
|
25501
25499
|
var matches$1=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);/** Major Node version (as a number) */matches$1&&parseFloat(matches$1[1])||0;// Do not name these variables the same as the global objects - will break bundling
|
|
@@ -25591,8 +25589,8 @@ return Object.assign(opts,{args:args},opts.opts);}function decorateMessage(id,me
|
|
|
25591
25589
|
// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
25592
25590
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
25593
25591
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
25594
|
-
var VERSION$6="4.3.2";var version=VERSION$6[0]>='0'&&VERSION$6[0]<='9'?"v".concat(VERSION$6):'';// Make sure we set the global variable
|
|
25595
|
-
function createLog(){var log=new Log({id:'loaders.gl'});globalThis.loaders=globalThis.loaders||{};globalThis.loaders.log=log;globalThis.loaders.version=version;globalThis.probe=globalThis.probe||{};globalThis.probe.loaders=log;return log;}var log=createLog();// loaders.gl
|
|
25592
|
+
var VERSION$6="4.3.2";var version$1=VERSION$6[0]>='0'&&VERSION$6[0]<='9'?"v".concat(VERSION$6):'';// Make sure we set the global variable
|
|
25593
|
+
function createLog(){var log=new Log({id:'loaders.gl'});globalThis.loaders=globalThis.loaders||{};globalThis.loaders.log=log;globalThis.loaders.version=version$1;globalThis.probe=globalThis.probe||{};globalThis.probe.loaders=log;return log;}var log=createLog();// loaders.gl
|
|
25596
25594
|
// SPDX-License-Identifier: MIT
|
|
25597
25595
|
// Copyright (c) vis.gl contributors
|
|
25598
25596
|
/**
|
|
@@ -25842,9 +25840,9 @@ var loadLibraryPromises={};// promises
|
|
|
25842
25840
|
* @param moduleName
|
|
25843
25841
|
* @param options
|
|
25844
25842
|
*/function loadLibrary(_x12){return _loadLibrary.apply(this,arguments);}// TODO - sort out how to resolve paths for main/worker and dev/prod
|
|
25845
|
-
function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25843
|
+
function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(libraryUrl){var moduleName,options,libraryName,_args23=arguments;return _regeneratorRuntime().wrap(function _callee20$(_context24){while(1){switch(_context24.prev=_context24.next){case 0:moduleName=_args23.length>1&&_args23[1]!==undefined?_args23[1]:null;options=_args23.length>2&&_args23[2]!==undefined?_args23[2]:{};libraryName=_args23.length>3&&_args23[3]!==undefined?_args23[3]:null;if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options,libraryName);}// Ensure libraries are only loaded once
|
|
25846
25844
|
loadLibraryPromises[libraryUrl]=// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
25847
|
-
loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);
|
|
25845
|
+
loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context24.next=7;return loadLibraryPromises[libraryUrl];case 7:return _context24.abrupt("return",_context24.sent);case 8:case"end":return _context24.stop();}}},_callee20);}));return _loadLibrary.apply(this,arguments);}function getLibraryUrl(library,moduleName){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var libraryName=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;// Check if already a URL
|
|
25848
25846
|
if(!options.useLocalLibraries&&library.startsWith('http')){return library;}libraryName=libraryName||library;// Allow application to import and supply libraries through `options.modules`
|
|
25849
25847
|
// TODO - See js-module-utils in loader-utils
|
|
25850
25848
|
var modules=options.modules||{};if(modules[libraryName]){return modules[libraryName];}// Load from local files, not from CDN scripts in Node.js
|
|
@@ -25867,8 +25865,8 @@ async function loadScriptFromFile(libraryUrl) {
|
|
|
25867
25865
|
// - Potentially bypasses CORS
|
|
25868
25866
|
// Upside is that this separates fetching and parsing
|
|
25869
25867
|
// we could create a`LibraryLoader` or`ModuleLoader`
|
|
25870
|
-
function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25871
|
-
return
|
|
25868
|
+
function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(libraryUrl){var _ref36,requireFromFile,scriptSource;return _regeneratorRuntime().wrap(function _callee21$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:if(!libraryUrl.endsWith('wasm')){_context25.next=4;break;}_context25.next=3;return loadAsArrayBuffer(libraryUrl);case 3:return _context25.abrupt("return",_context25.sent);case 4:if(isBrowser){_context25.next=16;break;}_context25.prev=5;_ref36=globalThis.loaders||{},requireFromFile=_ref36.requireFromFile;_context25.next=9;return requireFromFile===null||requireFromFile===void 0?void 0:requireFromFile(libraryUrl);case 9:return _context25.abrupt("return",_context25.sent);case 12:_context25.prev=12;_context25.t0=_context25["catch"](5);console.error(_context25.t0);// eslint-disable-line no-console
|
|
25869
|
+
return _context25.abrupt("return",null);case 16:if(!isWorker){_context25.next=18;break;}return _context25.abrupt("return",importScripts(libraryUrl));case 18:_context25.next=20;return loadAsText(libraryUrl);case 20:scriptSource=_context25.sent;return _context25.abrupt("return",loadLibraryFromString(scriptSource,libraryUrl));case 22:case"end":return _context25.stop();}}},_callee21,null,[[5,12]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser){var _ref16=globalThis.loaders||{},requireFromString=_ref16.requireFromString;return requireFromString===null||requireFromString===void 0?void 0:requireFromString(scriptSource,id);}if(isWorker){// Use lvalue trick to make eval run in global scope
|
|
25872
25870
|
eval.call(globalThis,scriptSource);// eslint-disable-line no-eval
|
|
25873
25871
|
// https://stackoverflow.com/questions/9107240/1-evalthis-vs-evalthis-in-javascript
|
|
25874
25872
|
// http://perfectionkills.com/global-eval-what-are-the-options/
|
|
@@ -25890,11 +25888,11 @@ function combineWorkerWithLibrary(worker, jsContent) {
|
|
|
25890
25888
|
* Load a file from local file system
|
|
25891
25889
|
* @param filename
|
|
25892
25890
|
* @returns
|
|
25893
|
-
*/function _loadAsArrayBuffer(){_loadAsArrayBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25891
|
+
*/function _loadAsArrayBuffer(){_loadAsArrayBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(url){var _ref37,readFileAsArrayBuffer,response;return _regeneratorRuntime().wrap(function _callee22$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:_ref37=globalThis.loaders||{},readFileAsArrayBuffer=_ref37.readFileAsArrayBuffer;if(!(isBrowser||!readFileAsArrayBuffer||url.startsWith('http'))){_context26.next=8;break;}_context26.next=4;return fetch(url);case 4:response=_context26.sent;_context26.next=7;return response.arrayBuffer();case 7:return _context26.abrupt("return",_context26.sent);case 8:_context26.next=10;return readFileAsArrayBuffer(url);case 10:return _context26.abrupt("return",_context26.sent);case 11:case"end":return _context26.stop();}}},_callee22);}));return _loadAsArrayBuffer.apply(this,arguments);}function loadAsText(_x15){return _loadAsText.apply(this,arguments);}/**
|
|
25894
25892
|
* Determines if a loader can parse with worker
|
|
25895
25893
|
* @param loader
|
|
25896
25894
|
* @param options
|
|
25897
|
-
*/function _loadAsText(){_loadAsText=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25895
|
+
*/function _loadAsText(){_loadAsText=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(url){var _ref38,readFileAsText,response;return _regeneratorRuntime().wrap(function _callee23$(_context27){while(1){switch(_context27.prev=_context27.next){case 0:_ref38=globalThis.loaders||{},readFileAsText=_ref38.readFileAsText;if(!(isBrowser||!readFileAsText||url.startsWith('http'))){_context27.next=8;break;}_context27.next=4;return fetch(url);case 4:response=_context27.sent;_context27.next=7;return response.text();case 7:return _context27.abrupt("return",_context27.sent);case 8:_context27.next=10;return readFileAsText(url);case 10:return _context27.abrupt("return",_context27.sent);case 11:case"end":return _context27.stop();}}},_callee23);}));return _loadAsText.apply(this,arguments);}function canParseWithWorker(loader,options){if(!WorkerFarm.isSupported()){return false;}// Node workers are still experimental
|
|
25898
25896
|
if(!isBrowser&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}/**
|
|
25899
25897
|
* this function expects that the worker function sends certain messages,
|
|
25900
25898
|
* this can be automated if the worker is wrapper by a call to createLoaderWorker in @loaders.gl/loader-utils.
|
|
@@ -25903,14 +25901,14 @@ if(!isBrowser&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return
|
|
|
25903
25901
|
* @param job
|
|
25904
25902
|
* @param type
|
|
25905
25903
|
* @param payload
|
|
25906
|
-
*/function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25904
|
+
*/function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regeneratorRuntime().wrap(function _callee24$(_context28){while(1){switch(_context28.prev=_context28.next){case 0:name=loader.id;// TODO
|
|
25907
25905
|
url=getWorkerURL(loader,options);workerFarm=WorkerFarm.getWorkerFarm(options);workerPool=workerFarm.getWorkerPool({name:name,url:url});// options.log object contains functions which cannot be transferred
|
|
25908
25906
|
// context.fetch & context.parse functions cannot be transferred
|
|
25909
25907
|
// TODO - decide how to handle logging on workers
|
|
25910
|
-
options=JSON.parse(JSON.stringify(options));context=JSON.parse(JSON.stringify(context||{}));
|
|
25908
|
+
options=JSON.parse(JSON.stringify(options));context=JSON.parse(JSON.stringify(context||{}));_context28.next=8;return workerPool.startJob('process-on-worker',// @ts-expect-error
|
|
25911
25909
|
onMessage.bind(null,parseOnMainThread)// eslint-disable-line @typescript-eslint/no-misused-promises
|
|
25912
|
-
);case 8:job=
|
|
25913
|
-
input:data,options:options,context:context});
|
|
25910
|
+
);case 8:job=_context28.sent;job.postMessage('process',{// @ts-ignore
|
|
25911
|
+
input:data,options:options,context:context});_context28.next=12;return job.result;case 12:result=_context28.sent;_context28.next=15;return result.result;case 15:return _context28.abrupt("return",_context28.sent);case 16:case"end":return _context28.stop();}}},_callee24);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x21,_x22,_x23,_x24){return _onMessage2.apply(this,arguments);}// loaders.gl
|
|
25914
25912
|
// SPDX-License-Identifier: MIT
|
|
25915
25913
|
// Copyright (c) vis.gl contributors
|
|
25916
25914
|
/**
|
|
@@ -25918,9 +25916,9 @@ input:data,options:options,context:context});_context18.next=12;return job.resul
|
|
|
25918
25916
|
* @param data
|
|
25919
25917
|
* @param length
|
|
25920
25918
|
* @returns
|
|
25921
|
-
*/function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25922
|
-
id=payload.id,input=payload.input,options=payload.options;
|
|
25923
|
-
console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return
|
|
25919
|
+
*/function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(parseOnMainThread,job,type,payload){var id,input,options,result,message;return _regeneratorRuntime().wrap(function _callee25$(_context29){while(1){switch(_context29.prev=_context29.next){case 0:_context29.t0=type;_context29.next=_context29.t0==='done'?3:_context29.t0==='error'?5:_context29.t0==='process'?7:20;break;case 3:job.done(payload);return _context29.abrupt("break",21);case 5:job.error(new Error(payload.error));return _context29.abrupt("break",21);case 7:// Worker is asking for main thread to parseO
|
|
25920
|
+
id=payload.id,input=payload.input,options=payload.options;_context29.prev=8;_context29.next=11;return parseOnMainThread(input,options);case 11:result=_context29.sent;job.postMessage('done',{id:id,result:result});_context29.next=19;break;case 15:_context29.prev=15;_context29.t1=_context29["catch"](8);message=_context29.t1 instanceof Error?_context29.t1.message:'unknown error';job.postMessage('error',{id:id,error:message});case 19:return _context29.abrupt("break",21);case 20:// eslint-disable-next-line
|
|
25921
|
+
console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return _context29.stop();}}},_callee25,null,[[8,15]]);}));return _onMessage2.apply(this,arguments);}function getFirstCharacters$1(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){// Typed Arrays can have offsets into underlying buffer
|
|
25924
25922
|
return getMagicString$2(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$2(data,byteOffset,length);}return'';}/**
|
|
25925
25923
|
* Gets a magic string from a "file"
|
|
25926
25924
|
* Typically used to check or detect file format
|
|
@@ -25980,7 +25978,7 @@ target.set(sourceArray,targetOffset);return targetOffset+padToNBytes(sourceArray
|
|
|
25980
25978
|
* Concatenates all data chunks yielded by an (async) iterator
|
|
25981
25979
|
* This function can e.g. be used to enable atomic parsers to work on (async) iterator inputs
|
|
25982
25980
|
*/function concatenateArrayBuffersAsync(_x25){return _concatenateArrayBuffersAsync.apply(this,arguments);}// Simple file alias mechanisms for tests.
|
|
25983
|
-
function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25981
|
+
function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk;return _regeneratorRuntime().wrap(function _callee26$(_context30){while(1){switch(_context30.prev=_context30.next){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context30.prev=3;_iterator=_asyncIterator(asyncIterator);case 5:_context30.next=7;return _iterator.next();case 7:if(!(_iteratorAbruptCompletion=!(_step=_context30.sent).done)){_context30.next=13;break;}chunk=_step.value;arrayBuffers.push(chunk);case 10:_iteratorAbruptCompletion=false;_context30.next=5;break;case 13:_context30.next=19;break;case 15:_context30.prev=15;_context30.t0=_context30["catch"](3);_didIteratorError=true;_iteratorError=_context30.t0;case 19:_context30.prev=19;_context30.prev=20;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context30.next=24;break;}_context30.next=24;return _iterator["return"]();case 24:_context30.prev=24;if(!_didIteratorError){_context30.next=27;break;}throw _iteratorError;case 27:return _context30.finish(24);case 28:return _context30.finish(19);case 29:return _context30.abrupt("return",concatenateArrayBuffers.apply(void 0,arrayBuffers));case 30:case"end":return _context30.stop();}}},_callee26,null,[[3,15,19,29],[20,,24,28]]);}));return _concatenateArrayBuffersAsync.apply(this,arguments);}var pathPrefix='';var fileAliases={};/**
|
|
25984
25982
|
* Resolves aliases and adds path-prefix to paths
|
|
25985
25983
|
*/function resolvePath(filename){for(var alias in fileAliases){if(filename.startsWith(alias)){var replacement=fileAliases[alias];filename=filename.replace(alias,replacement);}}if(!filename.startsWith('http://')&&!filename.startsWith('https://')){filename="".concat(pathPrefix).concat(filename);}return filename;}// loaders.gl
|
|
25986
25984
|
// SPDX-License-Identifier: MIT
|
|
@@ -26080,27 +26078,27 @@ return resource.length;}if(resource instanceof ArrayBuffer){return resource.byte
|
|
|
26080
26078
|
*/function makeResponse(_x26){return _makeResponse.apply(this,arguments);}/**
|
|
26081
26079
|
* Checks response status (async) and throws a helpful error message if status is not OK.
|
|
26082
26080
|
* @param response
|
|
26083
|
-
*/function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26081
|
+
*/function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(resource){var headers,contentLength,url,type,initialDataUrl,response;return _regeneratorRuntime().wrap(function _callee27$(_context31){while(1){switch(_context31.prev=_context31.next){case 0:if(!isResponse(resource)){_context31.next=2;break;}return _context31.abrupt("return",resource);case 2:// Add content-length header if possible
|
|
26084
26082
|
headers={};contentLength=getResourceContentLength(resource);if(contentLength>=0){headers['content-length']=String(contentLength);}// `new Response(File)` does not preserve content-type and URL
|
|
26085
26083
|
// so we add them here
|
|
26086
26084
|
url=getResourceUrl(resource);type=getResourceMIMEType(resource);if(type){headers['content-type']=type;}// Add a custom header with initial bytes if available
|
|
26087
|
-
|
|
26085
|
+
_context31.next=10;return getInitialDataUrl(resource);case 10:initialDataUrl=_context31.sent;if(initialDataUrl){headers['x-first-bytes']=initialDataUrl;}// TODO - is this the best way of handling strings?
|
|
26088
26086
|
// Maybe package as data URL instead?
|
|
26089
26087
|
if(typeof resource==='string'){// Convert to ArrayBuffer to avoid Response treating it as a URL
|
|
26090
26088
|
resource=new TextEncoder().encode(resource);}// Attempt to create a Response from the resource, adding headers and setting url
|
|
26091
26089
|
response=new Response(resource,{headers:headers});// We can't control `Response.url` via constructor, use a property override to record URL.
|
|
26092
|
-
Object.defineProperty(response,'url',{value:url});return
|
|
26093
|
-
function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26094
|
-
|
|
26095
|
-
function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26090
|
+
Object.defineProperty(response,'url',{value:url});return _context31.abrupt("return",response);case 16:case"end":return _context31.stop();}}},_callee27);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x27){return _checkResponse.apply(this,arguments);}// HELPERS
|
|
26091
|
+
function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(response){var _error3;return _regeneratorRuntime().wrap(function _callee28$(_context32){while(1){switch(_context32.prev=_context32.next){case 0:if(response.ok){_context32.next=5;break;}_context32.next=3;return getResponseError(response);case 3:_error3=_context32.sent;throw _error3;case 5:case"end":return _context32.stop();}}},_callee28);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x28){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(response){var shortUrl,message,info,contentType;return _regeneratorRuntime().wrap(function _callee29$(_context33){while(1){switch(_context33.prev=_context33.next){case 0:shortUrl=shortenUrlForDisplay(response.url);message="Failed to fetch resource (".concat(response.status,") ").concat(response.statusText,": ").concat(shortUrl);message=message.length>100?"".concat(message.slice(0,100),"..."):message;info={reason:response.statusText,url:response.url,response:response};// See if we got an error message in the body
|
|
26092
|
+
_context33.prev=4;contentType=response.headers.get('Content-Type');if(!(!response.bodyUsed&&contentType!==null&&contentType!==void 0&&contentType.includes('application/json'))){_context33.next=12;break;}_context33.next=9;return response.json();case 9:_context33.t0=_context33.sent;_context33.next=15;break;case 12:_context33.next=14;return response.text();case 14:_context33.t0=_context33.sent;case 15:info.reason=_context33.t0;_context33.next=20;break;case 18:_context33.prev=18;_context33.t1=_context33["catch"](4);case 20:return _context33.abrupt("return",new FetchError(message,info));case 21:case"end":return _context33.stop();}}},_callee29,null,[[4,18]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x29){return _getInitialDataUrl.apply(this,arguments);}// https://stackoverflow.com/questions/9267899/arraybuffer-to-base64-encoded-string
|
|
26093
|
+
function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee30$(_context34){while(1){switch(_context34.prev=_context34.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context34.next=3;break;}return _context34.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context34.next=8;break;}blobSlice=resource.slice(0,5);_context34.next=7;return new Promise(function(resolve){var reader=new FileReader();reader.onload=function(event){var _event$target;return resolve(event===null||event===void 0?void 0:(_event$target=event.target)===null||_event$target===void 0?void 0:_event$target.result);};reader.readAsDataURL(blobSlice);});case 7:return _context34.abrupt("return",_context34.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context34.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context34.abrupt("return","data:base64,".concat(_base));case 12:return _context34.abrupt("return",null);case 13:case"end":return _context34.stop();}}},_callee30);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i533=0;_i533<bytes.byteLength;_i533++){binary+=String.fromCharCode(bytes[_i533]);}return btoa(binary);}// loaders.gl
|
|
26096
26094
|
// import {FetchError} from './fetch-error';
|
|
26097
26095
|
function isNodePath(url){return!isRequestURL(url)&&!isDataURL(url);}function isRequestURL(url){return url.startsWith('http:')||url.startsWith('https:');}function isDataURL(url){return url.startsWith('data:');}/**
|
|
26098
26096
|
* fetch API compatible function
|
|
26099
26097
|
* - Supports fetching from Node.js local file system paths
|
|
26100
26098
|
* - Respects pathPrefix and file aliases
|
|
26101
|
-
*/function fetchFile(_x30,_x31){return _fetchFile
|
|
26102
|
-
function _fetchFile(){_fetchFile
|
|
26103
|
-
if(!isNodePath(url)){
|
|
26099
|
+
*/function fetchFile$1(_x30,_x31){return _fetchFile$.apply(this,arguments);}// loaders.gl
|
|
26100
|
+
function _fetchFile$(){_fetchFile$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(urlOrData,fetchOptions){var url,_globalThis$loaders6,_globalThis$loaders7;return _regeneratorRuntime().wrap(function _callee31$(_context35){while(1){switch(_context35.prev=_context35.next){case 0:if(!(typeof urlOrData==='string')){_context35.next=8;break;}url=resolvePath(urlOrData);// Support fetching from local file system
|
|
26101
|
+
if(!isNodePath(url)){_context35.next=5;break;}if(!((_globalThis$loaders6=globalThis.loaders)!==null&&_globalThis$loaders6!==void 0&&_globalThis$loaders6.fetchNode)){_context35.next=5;break;}return _context35.abrupt("return",(_globalThis$loaders7=globalThis.loaders)===null||_globalThis$loaders7===void 0?void 0:_globalThis$loaders7.fetchNode(url,fetchOptions));case 5:_context35.next=7;return fetch(url,fetchOptions);case 7:return _context35.abrupt("return",_context35.sent);case 8:_context35.next=10;return makeResponse(urlOrData);case 10:return _context35.abrupt("return",_context35.sent);case 11:case"end":return _context35.stop();}}},_callee31);}));return _fetchFile$.apply(this,arguments);}var probeLog=new Log({id:'loaders.gl'});// Logs nothing
|
|
26104
26102
|
var NullLog=/*#__PURE__*/function(){function NullLog(){_classCallCheck(this,NullLog);}_createClass(NullLog,[{key:"log",value:function log(){return function(){};}},{key:"info",value:function info(){return function(){};}},{key:"warn",value:function warn(){return function(){};}},{key:"error",value:function error(){return function(){};}}]);return NullLog;}();// Logs to console
|
|
26105
26103
|
var ConsoleLog=/*#__PURE__*/function(){function ConsoleLog(){_classCallCheck(this,ConsoleLog);_defineProperty(this,"console",void 0);this.console=console;// eslint-disable-line
|
|
26106
26104
|
}_createClass(ConsoleLog,[{key:"log",value:function log(){var _this$console$log;for(var _len101=arguments.length,args=new Array(_len101),_key7=0;_key7<_len101;_key7++){args[_key7]=arguments[_key7];}return(_this$console$log=this.console.log).bind.apply(_this$console$log,[this.console].concat(args));}},{key:"info",value:function info(){var _this$console$info;for(var _len102=arguments.length,args=new Array(_len102),_key8=0;_key8<_len102;_key8++){args[_key8]=arguments[_key8];}return(_this$console$info=this.console.info).bind.apply(_this$console$info,[this.console].concat(args));}},{key:"warn",value:function warn(){var _this$console$warn;for(var _len103=arguments.length,args=new Array(_len103),_key9=0;_key9<_len103;_key9++){args[_key9]=arguments[_key9];}return(_this$console$warn=this.console.warn).bind.apply(_this$console$warn,[this.console].concat(args));}},{key:"error",value:function error(){var _this$console$error;for(var _len104=arguments.length,args=new Array(_len104),_key10=0;_key10<_len104;_key10++){args[_key10]=arguments[_key10];}return(_this$console$error=this.console.error).bind.apply(_this$console$error,[this.console].concat(args));}}]);return ConsoleLog;}();// loaders.gl
|
|
@@ -26200,8 +26198,8 @@ var EXT_PATTERN=/\.([^.]+)$/;// TODO - Need a variant that peeks at streams for
|
|
|
26200
26198
|
* @param loaders
|
|
26201
26199
|
* @param options
|
|
26202
26200
|
* @param context used internally, applications should not provide this parameter
|
|
26203
|
-
*/function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26204
|
-
loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){
|
|
26201
|
+
*/function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(data){var loaders,options,context,loader,_args35=arguments;return _regeneratorRuntime().wrap(function _callee32$(_context36){while(1){switch(_context36.prev=_context36.next){case 0:loaders=_args35.length>1&&_args35[1]!==undefined?_args35[1]:[];options=_args35.length>2?_args35[2]:undefined;context=_args35.length>3?_args35[3]:undefined;if(validHTTPResponse(data)){_context36.next=5;break;}return _context36.abrupt("return",null);case 5:// First make a sync attempt, disabling exceptions
|
|
26202
|
+
loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context36.next=8;break;}return _context36.abrupt("return",loader);case 8:if(!isBlob(data)){_context36.next=13;break;}_context36.next=11;return data.slice(0,10).arrayBuffer();case 11:data=_context36.sent;loader=selectLoaderSync(data,loaders,options,context);case 13:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context36.next=15;break;}throw new Error(getNoValidLoaderMessage(data));case 15:return _context36.abrupt("return",loader);case 16:case"end":return _context36.stop();}}},_callee32);}));return _selectLoader.apply(this,arguments);}function selectLoaderSync(data){var loaders=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var options=arguments.length>2?arguments[2]:undefined;var context=arguments.length>3?arguments[3]:undefined;if(!validHTTPResponse(data)){return null;}// eslint-disable-next-line complexity
|
|
26205
26203
|
// if only a single loader was provided (not as array), force its use
|
|
26206
26204
|
// TODO - Should this behavior be kept and documented?
|
|
26207
26205
|
if(loaders&&!Array.isArray(loaders)){// TODO - remove support for legacy loaders
|
|
@@ -26340,12 +26338,12 @@ function getArrayBufferOrStringFromData(_x33,_x34,_x35){return _getArrayBufferOr
|
|
|
26340
26338
|
* Gets the current fetch function from options and context
|
|
26341
26339
|
* @param options
|
|
26342
26340
|
* @param context
|
|
26343
|
-
*/function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26344
|
-
data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){
|
|
26341
|
+
*/function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(data,loader,options){var isArrayBuffer,response;return _regeneratorRuntime().wrap(function _callee33$(_context37){while(1){switch(_context37.prev=_context37.next){case 0:isArrayBuffer=data instanceof ArrayBuffer||ArrayBuffer.isView(data);if(!(typeof data==='string'||isArrayBuffer)){_context37.next=3;break;}return _context37.abrupt("return",getArrayBufferOrStringFromDataSync(data,loader));case 3:if(!isBlob(data)){_context37.next=7;break;}_context37.next=6;return makeResponse(data);case 6:data=_context37.sent;case 7:if(!isResponse(data)){_context37.next=21;break;}response=data;_context37.next=11;return checkResponse(response);case 11:if(!loader.binary){_context37.next=17;break;}_context37.next=14;return response.arrayBuffer();case 14:_context37.t0=_context37.sent;_context37.next=20;break;case 17:_context37.next=19;return response.text();case 19:_context37.t0=_context37.sent;case 20:return _context37.abrupt("return",_context37.t0);case 21:if(isReadableStream(data)){// @ts-expect-error TS2559 options type
|
|
26342
|
+
data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){_context37.next=24;break;}return _context37.abrupt("return",concatenateArrayBuffersAsync(data));case 24:throw new Error(ERR_DATA);case 25:case"end":return _context37.stop();}}},_callee33);}));return _getArrayBufferOrStringFromData.apply(this,arguments);}function getFetchFunction(options,context){var globalOptions=getGlobalLoaderOptions();var loaderOptions=options||globalOptions;// options.fetch can be a function
|
|
26345
26343
|
if(typeof loaderOptions.fetch==='function'){return loaderOptions.fetch;}// options.fetch can be an options object
|
|
26346
|
-
if(isObject(loaderOptions.fetch)){return function(url){return fetchFile(url,loaderOptions.fetch);};}// else refer to context (from parent loader) if available
|
|
26344
|
+
if(isObject(loaderOptions.fetch)){return function(url){return fetchFile$1(url,loaderOptions.fetch);};}// else refer to context (from parent loader) if available
|
|
26347
26345
|
if(context!==null&&context!==void 0&&context.fetch){return context===null||context===void 0?void 0:context.fetch;}// else return the default fetch function
|
|
26348
|
-
return fetchFile;}// loaders.gl
|
|
26346
|
+
return fetchFile$1;}// loaders.gl
|
|
26349
26347
|
/**
|
|
26350
26348
|
* "sub" loaders invoked by other loaders get a "context" injected on `this`
|
|
26351
26349
|
* The context will inject core methods like `parse` and contain information
|
|
@@ -26372,29 +26370,29 @@ return candidateLoaders&&candidateLoaders.length?candidateLoaders:undefined;}//
|
|
|
26372
26370
|
*/ // implementation signature
|
|
26373
26371
|
function parse$3(_x36,_x37,_x38,_x39){return _parse$.apply(this,arguments);}// TODO: support progress and abort
|
|
26374
26372
|
// TODO - should accept loader.parseAsyncIterator and concatenate.
|
|
26375
|
-
function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26373
|
+
function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(data,loaders,options,context){var url,typedLoaders,candidateLoaders,loader;return _regeneratorRuntime().wrap(function _callee34$(_context38){while(1){switch(_context38.prev=_context38.next){case 0:// Signature: parse(data, options, context | url)
|
|
26376
26374
|
// Uses registered loaders
|
|
26377
26375
|
if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;// context not supported in short signature
|
|
26378
|
-
options=loaders;loaders=undefined;}
|
|
26376
|
+
options=loaders;loaders=undefined;}_context38.next=3;return data;case 3:data=_context38.sent;// Resolve any promise
|
|
26379
26377
|
options=options||{};// Could be invalid...
|
|
26380
26378
|
// Extract a url for auto detection
|
|
26381
26379
|
url=getResourceUrl(data);// Chooses a loader (and normalizes it)
|
|
26382
26380
|
// Also use any loaders in the context, new loaders take priority
|
|
26383
26381
|
typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);// todo hacky type cast
|
|
26384
|
-
|
|
26382
|
+
_context38.next=10;return selectLoader(data,candidateLoaders,options);case 10:loader=_context38.sent;if(loader){_context38.next=13;break;}return _context38.abrupt("return",null);case 13:// Normalize options
|
|
26385
26383
|
// @ts-expect-error
|
|
26386
26384
|
options=normalizeOptions(options,loader,candidateLoaders,url);// Could be invalid...
|
|
26387
26385
|
// Get a context (if already present, will be unchanged)
|
|
26388
26386
|
context=getLoaderContext(// @ts-expect-error
|
|
26389
|
-
{url:url,_parse:parse$3,loaders:candidateLoaders},options,context||null);
|
|
26387
|
+
{url:url,_parse:parse$3,loaders:candidateLoaders},options,context||null);_context38.next=17;return parseWithLoader(loader,data,options,context);case 17:return _context38.abrupt("return",_context38.sent);case 18:case"end":return _context38.stop();}}},_callee34);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x40,_x41,_x42,_x43){return _parseWithLoader.apply(this,arguments);}// loaders.gl
|
|
26390
26388
|
/**
|
|
26391
26389
|
* Deduces a simple data type "descriptor from a typed array instance
|
|
26392
|
-
*/function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26390
|
+
*/function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers,loaderWithParser;return _regeneratorRuntime().wrap(function _callee35$(_context39){while(1){switch(_context39.prev=_context39.next){case 0:validateWorkerVersion(loader);options=mergeLoaderOptions(loader.options,options);if(isResponse(data)){// Serialize to support passing the response to web worker
|
|
26393
26391
|
response=data;ok=response.ok,redirected=response.redirected,status=response.status,statusText=response.statusText,type=response.type,url=response.url;headers=Object.fromEntries(response.headers.entries());// @ts-expect-error TODO - fix this
|
|
26394
|
-
context.response={headers:headers,ok:ok,redirected:redirected,status:status,statusText:statusText,type:type,url:url};}
|
|
26395
|
-
if(!(loaderWithParser.parseTextSync&&typeof data==='string')){
|
|
26392
|
+
context.response={headers:headers,ok:ok,redirected:redirected,status:status,statusText:statusText,type:type,url:url};}_context39.next=5;return getArrayBufferOrStringFromData(data,loader,options);case 5:data=_context39.sent;loaderWithParser=loader;// First check for synchronous text parser, wrap results in promises
|
|
26393
|
+
if(!(loaderWithParser.parseTextSync&&typeof data==='string')){_context39.next=9;break;}return _context39.abrupt("return",loaderWithParser.parseTextSync(data,options,context));case 9:if(!canParseWithWorker(loader,options)){_context39.next=13;break;}_context39.next=12;return parseWithWorker(loader,data,options,context,parse$3);case 12:return _context39.abrupt("return",_context39.sent);case 13:if(!(loaderWithParser.parseText&&typeof data==='string')){_context39.next=17;break;}_context39.next=16;return loaderWithParser.parseText(data,options,context);case 16:return _context39.abrupt("return",_context39.sent);case 17:if(!loaderWithParser.parse){_context39.next=21;break;}_context39.next=20;return loaderWithParser.parse(data,options,context);case 20:return _context39.abrupt("return",_context39.sent);case 21:// This should not happen, all sync loaders should also offer `parse` function
|
|
26396
26394
|
assert$2(!loaderWithParser.parseSync);// TBD - If asynchronous parser not available, return null
|
|
26397
|
-
throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 23:case"end":return
|
|
26395
|
+
throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 23:case"end":return _context39.stop();}}},_callee35);}));return _parseWithLoader.apply(this,arguments);}function getDataTypeFromTypedArray(array){switch(array.constructor){case Int8Array:return'int8';case Uint8Array:case Uint8ClampedArray:return'uint8';case Int16Array:return'int16';case Uint16Array:return'uint16';case Int32Array:return'int32';case Uint32Array:return'uint32';case Float32Array:return'float32';case Float64Array:return'float64';default:return'null';}}/**
|
|
26398
26396
|
* Get number of vertices in mesh
|
|
26399
26397
|
* @param attributes
|
|
26400
26398
|
*/ /**
|
|
@@ -26453,16 +26451,16 @@ var src="data:image/svg+xml;base64,".concat(btoa(xmlText));return src;}return ge
|
|
|
26453
26451
|
throw new Error('SVG cannot be parsed directly to imagebitmap');}// TODO - how to determine mime type? Param? Sniff here?
|
|
26454
26452
|
return new Blob([new Uint8Array(arrayBuffer)]);// MIME type not needed?
|
|
26455
26453
|
}// Parses html image from array buffer
|
|
26456
|
-
function parseToImage(_x44,_x45,_x46){return _parseToImage.apply(this,arguments);}function _parseToImage(){_parseToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26454
|
+
function parseToImage(_x44,_x45,_x46){return _parseToImage.apply(this,arguments);}function _parseToImage(){_parseToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(arrayBuffer,options,url){var blobOrDataUrl,URL,objectUrl;return _regeneratorRuntime().wrap(function _callee36$(_context40){while(1){switch(_context40.prev=_context40.next){case 0:// Note: image parsing requires conversion to Blob (for createObjectURL).
|
|
26457
26455
|
// Potentially inefficient for not using `response.blob()` (and for File / Blob inputs)...
|
|
26458
26456
|
// But presumably not worth adding 'blob' flag to loader objects?
|
|
26459
|
-
blobOrDataUrl=getBlobOrSVGDataUrl(arrayBuffer,url);URL=self.URL||self.webkitURL;objectUrl=typeof blobOrDataUrl!=='string'&&URL.createObjectURL(blobOrDataUrl);
|
|
26457
|
+
blobOrDataUrl=getBlobOrSVGDataUrl(arrayBuffer,url);URL=self.URL||self.webkitURL;objectUrl=typeof blobOrDataUrl!=='string'&&URL.createObjectURL(blobOrDataUrl);_context40.prev=3;_context40.next=6;return loadToImage(objectUrl||blobOrDataUrl,options);case 6:return _context40.abrupt("return",_context40.sent);case 7:_context40.prev=7;if(objectUrl){URL.revokeObjectURL(objectUrl);}return _context40.finish(7);case 10:case"end":return _context40.stop();}}},_callee36,null,[[3,,7,10]]);}));return _parseToImage.apply(this,arguments);}function loadToImage(_x47,_x48){return _loadToImage.apply(this,arguments);}function _loadToImage(){_loadToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(url,options){var image;return _regeneratorRuntime().wrap(function _callee37$(_context41){while(1){switch(_context41.prev=_context41.next){case 0:image=new Image();image.src=url;// The `image.onload()` callback does not guarantee that the image has been decoded
|
|
26460
26458
|
// so a main thread "freeze" can be incurred when using the image for the first time.
|
|
26461
26459
|
// `Image.decode()` returns a promise that completes when image is decoded.
|
|
26462
26460
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decode
|
|
26463
26461
|
// Note: When calling `img.decode()`, we do not need to wait for `img.onload()`
|
|
26464
26462
|
// Note: `HTMLImageElement.decode()` is not available in Edge and IE11
|
|
26465
|
-
if(!(options.image&&options.image.decode&&image.decode)){
|
|
26463
|
+
if(!(options.image&&options.image.decode&&image.decode)){_context41.next=6;break;}_context41.next=5;return image.decode();case 5:return _context41.abrupt("return",image);case 6:_context41.next=8;return new Promise(function(resolve,reject){try{image.onload=function(){return resolve(image);};image.onerror=function(error){var message=error instanceof Error?error.message:'error';reject(new Error(message));};}catch(error){reject(error);}});case 8:return _context41.abrupt("return",_context41.sent);case 9:case"end":return _context41.stop();}}},_callee37);}));return _loadToImage.apply(this,arguments);}var EMPTY_OBJECT={};var imagebitmapOptionsSupported=true;/**
|
|
26466
26464
|
* Asynchronously parses an array buffer into an ImageBitmap - this contains the decoded data
|
|
26467
26465
|
* ImageBitmaps are supported on worker threads, but not supported on Edge, IE11 and Safari
|
|
26468
26466
|
* https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap#Browser_compatibility
|
|
@@ -26473,9 +26471,9 @@ if(!(options.image&&options.image.decode&&image.decode)){_context31.next=6;break
|
|
|
26473
26471
|
* *
|
|
26474
26472
|
* Firefox crashes if imagebitmapOptions is supplied
|
|
26475
26473
|
* Avoid supplying if not provided or supported, remember if not supported
|
|
26476
|
-
*/function _parseToImageBitmap(){_parseToImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26477
|
-
blob=getBlob(arrayBuffer,url);case 8:imagebitmapOptions=options&&options.imagebitmap;
|
|
26478
|
-
imagebitmapOptionsSupported=false;case 13:
|
|
26474
|
+
*/function _parseToImageBitmap(){_parseToImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(arrayBuffer,options,url){var blob,_image7,imagebitmapOptions;return _regeneratorRuntime().wrap(function _callee38$(_context42){while(1){switch(_context42.prev=_context42.next){case 0:if(!isSVG(url)){_context42.next=7;break;}_context42.next=3;return parseToImage(arrayBuffer,options,url);case 3:_image7=_context42.sent;blob=_image7;_context42.next=8;break;case 7:// Create blob from the array buffer
|
|
26475
|
+
blob=getBlob(arrayBuffer,url);case 8:imagebitmapOptions=options&&options.imagebitmap;_context42.next=11;return safeCreateImageBitmap(blob,imagebitmapOptions);case 11:return _context42.abrupt("return",_context42.sent);case 12:case"end":return _context42.stop();}}},_callee38);}));return _parseToImageBitmap.apply(this,arguments);}function safeCreateImageBitmap(_x52){return _safeCreateImageBitmap.apply(this,arguments);}function _safeCreateImageBitmap(){_safeCreateImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(blob){var imagebitmapOptions,_args42=arguments;return _regeneratorRuntime().wrap(function _callee39$(_context43){while(1){switch(_context43.prev=_context43.next){case 0:imagebitmapOptions=_args42.length>1&&_args42[1]!==undefined?_args42[1]:null;if(isEmptyObject(imagebitmapOptions)||!imagebitmapOptionsSupported){imagebitmapOptions=null;}if(!imagebitmapOptions){_context43.next=13;break;}_context43.prev=3;_context43.next=6;return createImageBitmap(blob,imagebitmapOptions);case 6:return _context43.abrupt("return",_context43.sent);case 9:_context43.prev=9;_context43.t0=_context43["catch"](3);console.warn(_context43.t0);// eslint-disable-line
|
|
26476
|
+
imagebitmapOptionsSupported=false;case 13:_context43.next=15;return createImageBitmap(blob);case 15:return _context43.abrupt("return",_context43.sent);case 16:case"end":return _context43.stop();}}},_callee39,null,[[3,9]]);}));return _safeCreateImageBitmap.apply(this,arguments);}function isEmptyObject(object){// @ts-ignore
|
|
26479
26477
|
for(var key in object||EMPTY_OBJECT){return false;}return true;}// loaders.gl
|
|
26480
26478
|
// SPDX-License-Identifier: MIT
|
|
26481
26479
|
// Copyright (c) vis.gl contributors
|
|
@@ -26574,14 +26572,14 @@ function toDataView(data){if(data instanceof DataView){return data;}if(ArrayBuff
|
|
|
26574
26572
|
if(data instanceof ArrayBuffer){return new DataView(data);}throw new Error('toDataView');}// Use polyfills if installed to parsed image using get-pixels
|
|
26575
26573
|
function parseToNodeImage(_x53,_x54){return _parseToNodeImage.apply(this,arguments);}// Parse to platform defined image type (data on node, ImageBitmap or HTMLImage on browser)
|
|
26576
26574
|
// eslint-disable-next-line complexity
|
|
26577
|
-
function _parseToNodeImage(){_parseToNodeImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26575
|
+
function _parseToNodeImage(){_parseToNodeImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(arrayBuffer,options){var _globalThis$loaders8;var _ref39,mimeType,parseImageNode;return _regeneratorRuntime().wrap(function _callee40$(_context44){while(1){switch(_context44.prev=_context44.next){case 0:_ref39=getBinaryImageMetadata(arrayBuffer)||{},mimeType=_ref39.mimeType;// @ts-ignore
|
|
26578
26576
|
parseImageNode=(_globalThis$loaders8=globalThis.loaders)===null||_globalThis$loaders8===void 0?void 0:_globalThis$loaders8.parseImageNode;assert$4(parseImageNode);// '@loaders.gl/polyfills not installed'
|
|
26579
26577
|
// @ts-expect-error TODO should we throw error in this case?
|
|
26580
|
-
|
|
26581
|
-
function _parseImage(){_parseImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26582
|
-
imageType=imageOptions.type||'auto';
|
|
26583
|
-
loadType=getLoadableImageType(imageType);
|
|
26584
|
-
if(imageType==='data'){image=getImageData(image);}return
|
|
26578
|
+
_context44.next=5;return parseImageNode(arrayBuffer,mimeType);case 5:return _context44.abrupt("return",_context44.sent);case 6:case"end":return _context44.stop();}}},_callee40);}));return _parseToNodeImage.apply(this,arguments);}function parseImage(_x55,_x56,_x57){return _parseImage.apply(this,arguments);}// Get a loadable image type from image type
|
|
26579
|
+
function _parseImage(){_parseImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(arrayBuffer,options,context){var imageOptions,imageType,_ref40,url,loadType,image;return _regeneratorRuntime().wrap(function _callee41$(_context45){while(1){switch(_context45.prev=_context45.next){case 0:options=options||{};imageOptions=options.image||{};// The user can request a specific output format via `options.image.type`
|
|
26580
|
+
imageType=imageOptions.type||'auto';_ref40=context||{},url=_ref40.url;// Note: For options.image.type === `data`, we may still need to load as `image` or `imagebitmap`
|
|
26581
|
+
loadType=getLoadableImageType(imageType);_context45.t0=loadType;_context45.next=_context45.t0==='imagebitmap'?8:_context45.t0==='image'?12:_context45.t0==='data'?16:20;break;case 8:_context45.next=10;return parseToImageBitmap(arrayBuffer,options,url);case 10:image=_context45.sent;return _context45.abrupt("break",21);case 12:_context45.next=14;return parseToImage(arrayBuffer,options,url);case 14:image=_context45.sent;return _context45.abrupt("break",21);case 16:_context45.next=18;return parseToNodeImage(arrayBuffer);case 18:image=_context45.sent;return _context45.abrupt("break",21);case 20:assert$4(false);case 21:// Browser: if options.image.type === 'data', we can now extract data from the loaded image
|
|
26582
|
+
if(imageType==='data'){image=getImageData(image);}return _context45.abrupt("return",image);case 23:case"end":return _context45.stop();}}},_callee41);}));return _parseImage.apply(this,arguments);}function getLoadableImageType(type){switch(type){case'auto':case'data':// Browser: For image data we need still need to load using an image format
|
|
26585
26583
|
// Node: the default image type is `data`.
|
|
26586
26584
|
return getDefaultImageType();default:// Throw an error if not supported
|
|
26587
26585
|
isImageTypeSupported(type);return type;}}// import type { ImageType } from '@loaders.gl/schema';
|
|
@@ -26879,7 +26877,7 @@ var offset=(indY*w+indX)*components;return offset;}/**
|
|
|
26879
26877
|
* @param stringOffsets - Index of the buffer view containing offsets for strings. It should be available for string type.
|
|
26880
26878
|
* @returns String property values
|
|
26881
26879
|
*/function getPropertyDataString(numberOfElements,valuesDataBytes,arrayOffsets,stringOffsets){if(arrayOffsets){// TODO: implement it as soon as we have the corresponding tileset
|
|
26882
|
-
throw new Error('Not implemented - arrayOffsets for strings is specified');}if(stringOffsets){var stringsArray=[];var textDecoder=new TextDecoder('utf8');var stringOffset=0;for(var index=0;index<numberOfElements;index++){var stringByteSize=stringOffsets[index+1]-stringOffsets[index];if(stringByteSize+stringOffset<=valuesDataBytes.length){var stringData=valuesDataBytes.subarray(stringOffset,stringByteSize+stringOffset);var stringAttribute=textDecoder.decode(stringData);stringsArray.push(stringAttribute);stringOffset+=stringByteSize;}}return stringsArray;}return[];}var EXT_MESH_FEATURES_NAME='EXT_mesh_features';var name$
|
|
26880
|
+
throw new Error('Not implemented - arrayOffsets for strings is specified');}if(stringOffsets){var stringsArray=[];var textDecoder=new TextDecoder('utf8');var stringOffset=0;for(var index=0;index<numberOfElements;index++){var stringByteSize=stringOffsets[index+1]-stringOffsets[index];if(stringByteSize+stringOffset<=valuesDataBytes.length){var stringData=valuesDataBytes.subarray(stringOffset,stringByteSize+stringOffset);var stringAttribute=textDecoder.decode(stringData);stringsArray.push(stringAttribute);stringOffset+=stringByteSize;}}return stringsArray;}return[];}var EXT_MESH_FEATURES_NAME='EXT_mesh_features';var name$b=EXT_MESH_FEATURES_NAME;function decode$9(_x58,_x59){return _decode$.apply(this,arguments);}function _decode$(){_decode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(gltfData,options){var scenegraph;return _regeneratorRuntime().wrap(function _callee42$(_context46){while(1){switch(_context46.prev=_context46.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtMeshFeatures(scenegraph,options);case 2:case"end":return _context46.stop();}}},_callee42);}));return _decode$.apply(this,arguments);}function encode$5(gltfData,options){var scenegraph=new GLTFScenegraph(gltfData);encodeExtMeshFeatures(scenegraph);scenegraph.createBinaryChunk();return scenegraph.gltf;}/**
|
|
26883
26881
|
* Decodes feature metadata from extension.
|
|
26884
26882
|
* @param {GLTFScenegraph} scenegraph - Instance of the class for structured access to GLTF data.
|
|
26885
26883
|
* @param {GLTFLoaderOptions} options - GLTFLoader options.
|
|
@@ -26924,7 +26922,7 @@ featureIds[elementIndex]={featureCount:typedArray.length,propertyTable:featureId
|
|
|
26924
26922
|
*/function createAccessorKey(attributes){var prefix='_FEATURE_ID_';// Search for all "_FEATURE_ID_n" attribures in the primitive provided if any.
|
|
26925
26923
|
// If there are some, e.g. "_FEATURE_ID_0", "_FEATURE_ID_1",
|
|
26926
26924
|
// we will add a new one with the name "_FEATURE_ID_2"
|
|
26927
|
-
var attrs=Object.keys(attributes).filter(function(item){return item.indexOf(prefix)===0;});var max=-1;var _iterator25=_createForOfIteratorHelper(attrs),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _a7=_step25.value;var n=Number(_a7.substring(prefix.length));if(n>max){max=n;}}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}max++;var accessorKey="".concat(prefix).concat(max);return{accessorKey:accessorKey,index:max};}var EXT_mesh_features=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
26925
|
+
var attrs=Object.keys(attributes).filter(function(item){return item.indexOf(prefix)===0;});var max=-1;var _iterator25=_createForOfIteratorHelper(attrs),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _a7=_step25.value;var n=Number(_a7.substring(prefix.length));if(n>max){max=n;}}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}max++;var accessorKey="".concat(prefix).concat(max);return{accessorKey:accessorKey,index:max};}var EXT_mesh_features=/*#__PURE__*/Object.freeze({__proto__:null,name:name$b,decode:decode$9,encode:encode$5,createExtMeshFeatures:createExtMeshFeatures});var EXT_STRUCTURAL_METADATA_NAME='EXT_structural_metadata';var name$a=EXT_STRUCTURAL_METADATA_NAME;function decode$8(_x60,_x61){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(gltfData,options){var scenegraph;return _regeneratorRuntime().wrap(function _callee43$(_context47){while(1){switch(_context47.prev=_context47.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtStructuralMetadata(scenegraph,options);case 2:case"end":return _context47.stop();}}},_callee43);}));return _decode$2.apply(this,arguments);}function encode$4(gltfData,options){var scenegraph=new GLTFScenegraph(gltfData);encodeExtStructuralMetadata(scenegraph);scenegraph.createBinaryChunk();return scenegraph.gltf;}/*
|
|
26928
26926
|
// Example of the extension.
|
|
26929
26927
|
// See more info at https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata
|
|
26930
26928
|
const extensions = {
|
|
@@ -27138,11 +27136,11 @@ if(!table.properties){table.properties={};}// values is a required field. Its re
|
|
|
27138
27136
|
table.properties[attribute.name]={values:0,data:attribute.values};}}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}table.count=count;return table;}function createPropertyTableProperty(// attribute: PropertyAttribute,
|
|
27139
27137
|
values,classProperty,scenegraph){var prop={values:0};if(classProperty.type==='STRING'){var _createPropertyDataSt=createPropertyDataString(values),stringData=_createPropertyDataSt.stringData,stringOffsets=_createPropertyDataSt.stringOffsets;prop.stringOffsets=createBufferView(stringOffsets,scenegraph);prop.values=createBufferView(stringData,scenegraph);}else if(classProperty.type==='SCALAR'&&classProperty.componentType){var data=createPropertyDataScalar(values,classProperty.componentType);prop.values=createBufferView(data,scenegraph);}return prop;}var COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function createPropertyDataScalar(array,componentType){var numberArray=[];var _iterator34=_createForOfIteratorHelper(array),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var value=_step34.value;numberArray.push(Number(value));}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var Construct=COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR[componentType];if(!Construct){throw new Error('Illegal component type');}return new Construct(numberArray);}function createPropertyDataString(strings){var utf8Encode=new TextEncoder();var arr=[];var len=0;var _iterator35=_createForOfIteratorHelper(strings),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _str=_step35.value;var uint8Array=utf8Encode.encode(_str);len+=uint8Array.length;arr.push(uint8Array);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}var strArray=new Uint8Array(len);var strOffsets=[];var offset=0;for(var _i540=0,_arr2=arr;_i540<_arr2.length;_i540++){var str=_arr2[_i540];strArray.set(str,offset);strOffsets.push(offset);offset+=str.length;}strOffsets.push(offset);// The last offset represents the byte offset after the last string.
|
|
27140
27138
|
var stringOffsetsTypedArray=new Uint32Array(strOffsets);// Its length = len+1
|
|
27141
|
-
return{stringData:strArray,stringOffsets:stringOffsetsTypedArray};}function createBufferView(typedArray,scenegraph){scenegraph.gltf.buffers.push({arrayBuffer:typedArray.buffer,byteOffset:typedArray.byteOffset,byteLength:typedArray.byteLength});return scenegraph.addBufferView(typedArray);}var EXT_structural_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
27139
|
+
return{stringData:strArray,stringOffsets:stringOffsetsTypedArray};}function createBufferView(typedArray,scenegraph){scenegraph.gltf.buffers.push({arrayBuffer:typedArray.buffer,byteOffset:typedArray.byteOffset,byteLength:typedArray.byteLength});return scenegraph.addBufferView(typedArray);}var EXT_structural_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name$a,decode:decode$8,encode:encode$4,createExtStructuralMetadata:createExtStructuralMetadata});/** Extension name */var EXT_FEATURE_METADATA_NAME='EXT_feature_metadata';var name$9=EXT_FEATURE_METADATA_NAME;function decode$7(_x62,_x63){return _decode$3.apply(this,arguments);}/**
|
|
27142
27140
|
* Decodes feature metadata from extension.
|
|
27143
27141
|
* @param scenegraph - Instance of the class for structured access to GLTF data.
|
|
27144
27142
|
* @param options - GLTFLoader options.
|
|
27145
|
-
*/function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27143
|
+
*/function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(gltfData,options){var scenegraph;return _regeneratorRuntime().wrap(function _callee44$(_context48){while(1){switch(_context48.prev=_context48.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtFeatureMetadata(scenegraph,options);case 2:case"end":return _context48.stop();}}},_callee44);}));return _decode$3.apply(this,arguments);}function decodeExtFeatureMetadata(scenegraph,options){var _options$gltf5,_options$gltf6;// Decoding metadata involves buffers processing.
|
|
27146
27144
|
// So, if buffers have not been loaded, there is no reason to process metadata.
|
|
27147
27145
|
if(!((_options$gltf5=options.gltf)!==null&&_options$gltf5!==void 0&&_options$gltf5.loadBuffers)){return;}var extension=scenegraph.getExtension(EXT_FEATURE_METADATA_NAME);if(!extension){return;}if((_options$gltf6=options.gltf)!==null&&_options$gltf6!==void 0&&_options$gltf6.loadImages){decodePropertyTextures(scenegraph,extension);}decodePropertyTables(scenegraph,extension);}/**
|
|
27148
27146
|
* Processes the data stored in the textures
|
|
@@ -27235,7 +27233,7 @@ return parseFixedLengthArrayNumeric(valuesData,numberOfElements,arrayCount);}ret
|
|
|
27235
27233
|
* @param featureTextureProperty
|
|
27236
27234
|
* @param featureTextureTable
|
|
27237
27235
|
* @param primitive
|
|
27238
|
-
*/function processPrimitiveTextures(scenegraph,attributeName,featureTextureProperty,featureTextureTable,primitive){var textureInfoTopLevel=_objectSpread({channels:featureTextureProperty.channels},featureTextureProperty.texture);var propertyData=getPrimitiveTextureData(scenegraph,textureInfoTopLevel,primitive);if(!propertyData){return;}primitivePropertyDataToAttributes(scenegraph,attributeName,propertyData,featureTextureTable,primitive);}var EXT_feature_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
27236
|
+
*/function processPrimitiveTextures(scenegraph,attributeName,featureTextureProperty,featureTextureTable,primitive){var textureInfoTopLevel=_objectSpread({channels:featureTextureProperty.channels},featureTextureProperty.texture);var propertyData=getPrimitiveTextureData(scenegraph,textureInfoTopLevel,primitive);if(!propertyData){return;}primitivePropertyDataToAttributes(scenegraph,attributeName,propertyData,featureTextureTable,primitive);}var EXT_feature_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name$9,decode:decode$7});// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
27239
27237
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
27240
27238
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
27241
27239
|
var VERSION$3="4.3.2";// loaders.gl
|
|
@@ -27253,14 +27251,14 @@ var BASIS_EXTERNAL_LIBRARIES={/** Basis transcoder, javascript wrapper part */TR
|
|
|
27253
27251
|
* Loads wasm transcoder module
|
|
27254
27252
|
* @param options
|
|
27255
27253
|
* @returns {BasisFile} promise
|
|
27256
|
-
*/function _loadBasisTranscoderModule(){_loadBasisTranscoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27254
|
+
*/function _loadBasisTranscoderModule(){_loadBasisTranscoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(options){var basis;return _regeneratorRuntime().wrap(function _callee45$(_context49){while(1){switch(_context49.prev=_context49.next){case 0:registerJSModules(options.modules);basis=getJSModuleOrNull('basis');if(!basis){_context49.next=4;break;}return _context49.abrupt("return",basis);case 4:loadBasisTranscoderPromise||(loadBasisTranscoderPromise=loadBasisTranscoder(options));_context49.next=7;return loadBasisTranscoderPromise;case 7:return _context49.abrupt("return",_context49.sent);case 8:case"end":return _context49.stop();}}},_callee45);}));return _loadBasisTranscoderModule.apply(this,arguments);}function loadBasisTranscoder(_x65){return _loadBasisTranscoder.apply(this,arguments);}/**
|
|
27257
27255
|
* Initialize wasm transcoder module
|
|
27258
27256
|
* @param BasisModule - js part of the module
|
|
27259
27257
|
* @param wasmBinary - wasm part of the module
|
|
27260
27258
|
* @returns {BasisFile} promise
|
|
27261
|
-
*/function _loadBasisTranscoder(){_loadBasisTranscoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27259
|
+
*/function _loadBasisTranscoder(){_loadBasisTranscoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(options){var BASIS,wasmBinary,_yield$Promise$all,_yield$Promise$all2;return _regeneratorRuntime().wrap(function _callee46$(_context50){while(1){switch(_context50.prev=_context50.next){case 0:BASIS=null;wasmBinary=null;_context50.t0=Promise;_context50.next=5;return loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER,'textures',options);case 5:_context50.t1=_context50.sent;_context50.next=8;return loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER_WASM,'textures',options);case 8:_context50.t2=_context50.sent;_context50.t3=[_context50.t1,_context50.t2];_context50.next=12;return _context50.t0.all.call(_context50.t0,_context50.t3);case 12:_yield$Promise$all=_context50.sent;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,2);BASIS=_yield$Promise$all2[0];wasmBinary=_yield$Promise$all2[1];// Depends on how import happened...
|
|
27262
27260
|
// @ts-ignore TS2339: Property does not exist on type
|
|
27263
|
-
BASIS=BASIS||globalThis.BASIS;
|
|
27261
|
+
BASIS=BASIS||globalThis.BASIS;_context50.next=19;return initializeBasisTranscoderModule(BASIS,wasmBinary);case 19:return _context50.abrupt("return",_context50.sent);case 20:case"end":return _context50.stop();}}},_callee46);}));return _loadBasisTranscoder.apply(this,arguments);}function initializeBasisTranscoderModule(BasisModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){// if you try to return BasisModule the browser crashes!
|
|
27264
27262
|
BasisModule(options).then(function(module){var BasisFile=module.BasisFile,initializeBasis=module.initializeBasis;initializeBasis();resolve({BasisFile:BasisFile});});});}var loadBasisEncoderPromise;/**
|
|
27265
27263
|
* Loads wasm encoder module
|
|
27266
27264
|
* @param options
|
|
@@ -27269,14 +27267,14 @@ BasisModule(options).then(function(module){var BasisFile=module.BasisFile,initia
|
|
|
27269
27267
|
* Loads wasm encoder module
|
|
27270
27268
|
* @param options
|
|
27271
27269
|
* @returns {BasisFile, KTX2File} promise
|
|
27272
|
-
*/function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27270
|
+
*/function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(options){var modules;return _regeneratorRuntime().wrap(function _callee47$(_context51){while(1){switch(_context51.prev=_context51.next){case 0:modules=options.modules||{};if(!modules.basisEncoder){_context51.next=3;break;}return _context51.abrupt("return",modules.basisEncoder);case 3:loadBasisEncoderPromise=loadBasisEncoderPromise||loadBasisEncoder(options);_context51.next=6;return loadBasisEncoderPromise;case 6:return _context51.abrupt("return",_context51.sent);case 7:case"end":return _context51.stop();}}},_callee47);}));return _loadBasisEncoderModule.apply(this,arguments);}function loadBasisEncoder(_x67){return _loadBasisEncoder.apply(this,arguments);}/**
|
|
27273
27271
|
* Initialize wasm transcoder module
|
|
27274
27272
|
* @param BasisEncoderModule - js part of the module
|
|
27275
27273
|
* @param wasmBinary - wasm part of the module
|
|
27276
27274
|
* @returns {BasisFile, KTX2File} promise
|
|
27277
|
-
*/function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27275
|
+
*/function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(options){var BASIS_ENCODER,wasmBinary,_yield$Promise$all3,_yield$Promise$all4;return _regeneratorRuntime().wrap(function _callee48$(_context52){while(1){switch(_context52.prev=_context52.next){case 0:BASIS_ENCODER=null;wasmBinary=null;_context52.t0=Promise;_context52.next=5;return loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER,'textures',options);case 5:_context52.t1=_context52.sent;_context52.next=8;return loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM,'textures',options);case 8:_context52.t2=_context52.sent;_context52.t3=[_context52.t1,_context52.t2];_context52.next=12;return _context52.t0.all.call(_context52.t0,_context52.t3);case 12:_yield$Promise$all3=_context52.sent;_yield$Promise$all4=_slicedToArray(_yield$Promise$all3,2);BASIS_ENCODER=_yield$Promise$all4[0];wasmBinary=_yield$Promise$all4[1];// Depends on how import happened...
|
|
27278
27276
|
// @ts-ignore TS2339: Property does not exist on type
|
|
27279
|
-
BASIS_ENCODER=BASIS_ENCODER||globalThis.BASIS;
|
|
27277
|
+
BASIS_ENCODER=BASIS_ENCODER||globalThis.BASIS;_context52.next=19;return initializeBasisEncoderModule(BASIS_ENCODER,wasmBinary);case 19:return _context52.abrupt("return",_context52.sent);case 20:case"end":return _context52.stop();}}},_callee48);}));return _loadBasisEncoder.apply(this,arguments);}function initializeBasisEncoderModule(BasisEncoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){// if you try to return BasisModule the browser crashes!
|
|
27280
27278
|
BasisEncoderModule(options).then(function(module){var BasisFile=module.BasisFile,KTX2File=module.KTX2File,initializeBasis=module.initializeBasis,BasisEncoder=module.BasisEncoder;initializeBasis();resolve({BasisFile:BasisFile,KTX2File:KTX2File,BasisEncoder:BasisEncoder});});});}// loaders.gl
|
|
27281
27279
|
// SPDX-License-Identifier: MIT
|
|
27282
27280
|
// Copyright (c) vis.gl contributors
|
|
@@ -27326,7 +27324,7 @@ var OutputFormat={etc1:{basisFormat:0,compressed:true,format:GL_EXTENSIONS_CONST
|
|
|
27326
27324
|
* @param data
|
|
27327
27325
|
* @param options
|
|
27328
27326
|
* @returns compressed texture data
|
|
27329
|
-
*/function _parseBasis(){_parseBasis=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27327
|
+
*/function _parseBasis(){_parseBasis=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(data,options){var fileConstructors,_yield$loadBasisTrans,BasisFile,_fileConstructors,_yield$loadBasisTrans2,_BasisFile;return _regeneratorRuntime().wrap(function _callee49$(_context53){while(1){switch(_context53.prev=_context53.next){case 0:if(!(options.basis.containerFormat==='auto')){_context53.next=11;break;}if(!isKTX(data)){_context53.next=6;break;}_context53.next=4;return loadBasisEncoderModule(options);case 4:fileConstructors=_context53.sent;return _context53.abrupt("return",parseKTX2File(fileConstructors.KTX2File,data,options));case 6:_context53.next=8;return loadBasisTranscoderModule(options);case 8:_yield$loadBasisTrans=_context53.sent;BasisFile=_yield$loadBasisTrans.BasisFile;return _context53.abrupt("return",parseBasisFile(BasisFile,data,options));case 11:_context53.t0=options.basis.module;_context53.next=_context53.t0==='encoder'?14:_context53.t0==='transcoder'?22:22;break;case 14:_context53.next=16;return loadBasisEncoderModule(options);case 16:_fileConstructors=_context53.sent;_context53.t1=options.basis.containerFormat;_context53.next=_context53.t1==='ktx2'?20:_context53.t1==='basis'?21:21;break;case 20:return _context53.abrupt("return",parseKTX2File(_fileConstructors.KTX2File,data,options));case 21:return _context53.abrupt("return",parseBasisFile(_fileConstructors.BasisFile,data,options));case 22:_context53.next=24;return loadBasisTranscoderModule(options);case 24:_yield$loadBasisTrans2=_context53.sent;_BasisFile=_yield$loadBasisTrans2.BasisFile;return _context53.abrupt("return",parseBasisFile(_BasisFile,data,options));case 27:case"end":return _context53.stop();}}},_callee49);}));return _parseBasis.apply(this,arguments);}function parseBasisFile(BasisFile,data,options){var basisFile=new BasisFile(new Uint8Array(data));try{if(!basisFile.startTranscoding()){throw new Error('Failed to start basis transcoding');}var imageCount=basisFile.getNumImages();var images=[];for(var imageIndex=0;imageIndex<imageCount;imageIndex++){var levelsCount=basisFile.getNumLevels(imageIndex);var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeImage(basisFile,imageIndex,levelIndex,options));}images.push(levels);}return images;}finally{basisFile.close();basisFile["delete"]();}}/**
|
|
27330
27328
|
* Parse the particular level image of a basis file
|
|
27331
27329
|
* @param basisFile
|
|
27332
27330
|
* @param imageIndex
|
|
@@ -27424,25 +27422,25 @@ var wasmpack=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,1
|
|
|
27424
27422
|
NONE:'',OCTAHEDRAL:'meshopt_decodeFilterOct',QUATERNION:'meshopt_decodeFilterQuat',EXPONENTIAL:'meshopt_decodeFilterExp'};var DECODERS={// legacy index-based enums for glTF
|
|
27425
27423
|
0:'meshopt_decodeVertexBuffer',1:'meshopt_decodeIndexBuffer',2:'meshopt_decodeIndexSequence',// string-based enums for glTF
|
|
27426
27424
|
ATTRIBUTES:'meshopt_decodeVertexBuffer',TRIANGLES:'meshopt_decodeIndexBuffer',INDICES:'meshopt_decodeIndexSequence'};// eslint-disable-next-line max-params
|
|
27427
|
-
function meshoptDecodeGltfBuffer(_x70,_x71,_x72,_x73,_x74){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27428
|
-
if(!wasmPromise){wasmPromise=loadWasmModule();}return
|
|
27429
|
-
console.log('Warning: meshopt_decoder is using experimental SIMD support');}
|
|
27425
|
+
function meshoptDecodeGltfBuffer(_x70,_x71,_x72,_x73,_x74){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(target,count,size,source,mode){var filter,instance,_args53=arguments;return _regeneratorRuntime().wrap(function _callee50$(_context54){while(1){switch(_context54.prev=_context54.next){case 0:filter=_args53.length>5&&_args53[5]!==undefined?_args53[5]:'NONE';_context54.next=3;return loadWasmInstance();case 3:instance=_context54.sent;decode$6(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 5:case"end":return _context54.stop();}}},_callee50);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(){return _regeneratorRuntime().wrap(function _callee51$(_context55){while(1){switch(_context55.prev=_context55.next){case 0:// eslint-disable-next-line
|
|
27426
|
+
if(!wasmPromise){wasmPromise=loadWasmModule();}return _context55.abrupt("return",wasmPromise);case 2:case"end":return _context55.stop();}}},_callee51);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(){var wasm,result;return _regeneratorRuntime().wrap(function _callee52$(_context56){while(1){switch(_context56.prev=_context56.next){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;// eslint-disable-next-line no-console
|
|
27427
|
+
console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context56.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context56.sent;_context56.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context56.abrupt("return",result.instance);case 8:case"end":return _context56.stop();}}},_callee52);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i541=0;_i541<data.length;++_i541){var ch=data.charCodeAt(_i541);result[_i541]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i542=0;_i542<data.length;++_i542){result[write++]=result[_i542]<60?wasmpack[result[_i542]]:(result[_i542]-60)*64+result[++_i542];}return result.buffer.slice(0,write);}// eslint-disable-next-line max-params
|
|
27430
27428
|
function decode$6(instance,fun,target,count,size,source,filter){var sbrk=instance.exports.sbrk;var count4=count+3&~3;// pad for SIMD filter
|
|
27431
|
-
var tp=sbrk(count4*size);var sp=sbrk(source.length);var heap=new Uint8Array(instance.exports.memory.buffer);heap.set(source,sp);var res=fun(tp,count,size,sp,source.length);if(res===0&&filter){filter(tp,count4,size);}target.set(heap.subarray(tp,tp+count*size));sbrk(tp-sbrk(0));if(res!==0){throw new Error("Malformed buffer data: ".concat(res));}}/** Extension name */var EXT_MESHOPT_COMPRESSION='EXT_meshopt_compression';var name$
|
|
27432
|
-
}catch(err){_iterator67.e(err);}finally{_iterator67.f();}
|
|
27433
|
-
scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);case 9:case"end":return
|
|
27434
|
-
var EXT_TEXTURE_WEBP='EXT_texture_webp';/** Extension name */var name$
|
|
27429
|
+
var tp=sbrk(count4*size);var sp=sbrk(source.length);var heap=new Uint8Array(instance.exports.memory.buffer);heap.set(source,sp);var res=fun(tp,count,size,sp,source.length);if(res===0&&filter){filter(tp,count4,size);}target.set(heap.subarray(tp,tp+count*size));sbrk(tp-sbrk(0));if(res!==0){throw new Error("Malformed buffer data: ".concat(res));}}/** Extension name */var EXT_MESHOPT_COMPRESSION='EXT_meshopt_compression';var name$8=EXT_MESHOPT_COMPRESSION;function decode$5(_x75,_x76){return _decode$4.apply(this,arguments);}/** Decode one meshopt buffer view */function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee53(gltfData,options){var _options$gltf8,_options$gltf9;var scenegraph,promises,_iterator67,_step67,bufferViewIndex;return _regeneratorRuntime().wrap(function _callee53$(_context57){while(1){switch(_context57.prev=_context57.next){case 0:scenegraph=new GLTFScenegraph(gltfData);if(!(!(options!==null&&options!==void 0&&(_options$gltf8=options.gltf)!==null&&_options$gltf8!==void 0&&_options$gltf8.decompressMeshes)||!((_options$gltf9=options.gltf)!==null&&_options$gltf9!==void 0&&_options$gltf9.loadBuffers))){_context57.next=3;break;}return _context57.abrupt("return");case 3:promises=[];_iterator67=_createForOfIteratorHelper(gltfData.json.bufferViews||[]);try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){bufferViewIndex=_step67.value;promises.push(decodeMeshoptBufferView(scenegraph,bufferViewIndex));}// Decompress meshes in parallel
|
|
27430
|
+
}catch(err){_iterator67.e(err);}finally{_iterator67.f();}_context57.next=8;return Promise.all(promises);case 8:// We have now decompressed all primitives, so remove the top-level extension
|
|
27431
|
+
scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);case 9:case"end":return _context57.stop();}}},_callee53);}));return _decode$4.apply(this,arguments);}function decodeMeshoptBufferView(_x77,_x78){return _decodeMeshoptBufferView.apply(this,arguments);}function _decodeMeshoptBufferView(){_decodeMeshoptBufferView=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee54(scenegraph,bufferView){var meshoptExtension,_meshoptExtension$byt,byteOffset,_meshoptExtension$byt2,byteLength,byteStride,count,mode,_meshoptExtension$fil,filter,bufferIndex,buffer,source,result;return _regeneratorRuntime().wrap(function _callee54$(_context58){while(1){switch(_context58.prev=_context58.next){case 0:meshoptExtension=scenegraph.getObjectExtension(bufferView,EXT_MESHOPT_COMPRESSION);if(!meshoptExtension){_context58.next=9;break;}_meshoptExtension$byt=meshoptExtension.byteOffset,byteOffset=_meshoptExtension$byt===void 0?0:_meshoptExtension$byt,_meshoptExtension$byt2=meshoptExtension.byteLength,byteLength=_meshoptExtension$byt2===void 0?0:_meshoptExtension$byt2,byteStride=meshoptExtension.byteStride,count=meshoptExtension.count,mode=meshoptExtension.mode,_meshoptExtension$fil=meshoptExtension.filter,filter=_meshoptExtension$fil===void 0?'NONE':_meshoptExtension$fil,bufferIndex=meshoptExtension.buffer;buffer=scenegraph.gltf.buffers[bufferIndex];source=new Uint8Array(buffer.arrayBuffer,buffer.byteOffset+byteOffset,byteLength);result=new Uint8Array(scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer,bufferView.byteOffset,bufferView.byteLength);_context58.next=8;return meshoptDecodeGltfBuffer(result,count,byteStride,source,mode,filter);case 8:scenegraph.removeObjectExtension(bufferView,EXT_MESHOPT_COMPRESSION);case 9:case"end":return _context58.stop();}}},_callee54);}));return _decodeMeshoptBufferView.apply(this,arguments);}var EXT_meshopt_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$8,decode:decode$5});// GLTF EXTENSION: EXT_TEXTURE_WEBP
|
|
27432
|
+
var EXT_TEXTURE_WEBP='EXT_texture_webp';/** Extension name */var name$7=EXT_TEXTURE_WEBP;/**
|
|
27435
27433
|
* Replaces a texture source reference with the extension texture
|
|
27436
27434
|
* Done in preprocess() to prevent load of default image
|
|
27437
27435
|
*/function preprocess$3(gltfData,options){var scenegraph=new GLTFScenegraph(gltfData);if(!isImageFormatSupported('image/webp')){if(scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)){throw new Error("gltf: Required extension ".concat(EXT_TEXTURE_WEBP," not supported by browser"));}return;}var json=scenegraph.json;var _iterator39=_createForOfIteratorHelper(json.textures||[]),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var texture=_step39.value;var extension=scenegraph.getObjectExtension(texture,EXT_TEXTURE_WEBP);if(extension){// TODO - if multiple texture extensions are present which one wins?
|
|
27438
27436
|
texture.source=extension.source;}scenegraph.removeObjectExtension(texture,EXT_TEXTURE_WEBP);}// Remove the top-level extension
|
|
27439
|
-
}catch(err){_iterator39.e(err);}finally{_iterator39.f();}scenegraph.removeExtension(EXT_TEXTURE_WEBP);}var EXT_texture_webp=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
27440
|
-
var KHR_TEXTURE_BASISU='KHR_texture_basisu';/** Extension name */var name$
|
|
27437
|
+
}catch(err){_iterator39.e(err);}finally{_iterator39.f();}scenegraph.removeExtension(EXT_TEXTURE_WEBP);}var EXT_texture_webp=/*#__PURE__*/Object.freeze({__proto__:null,name:name$7,preprocess:preprocess$3});// GLTF EXTENSION: KHR_texture_basisu
|
|
27438
|
+
var KHR_TEXTURE_BASISU='KHR_texture_basisu';/** Extension name */var name$6=KHR_TEXTURE_BASISU;/**
|
|
27441
27439
|
* Replaces a texture source reference with the extension texture
|
|
27442
27440
|
* Done in preprocess() to prevent load of default image
|
|
27443
27441
|
*/function preprocess$2(gltfData,options){var scene=new GLTFScenegraph(gltfData);var json=scene.json;var _iterator40=_createForOfIteratorHelper(json.textures||[]),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var texture=_step40.value;var extension=scene.getObjectExtension(texture,KHR_TEXTURE_BASISU);if(extension){// TODO - if multiple texture extensions are present which one wins?
|
|
27444
27442
|
texture.source=extension.source;scene.removeObjectExtension(texture,KHR_TEXTURE_BASISU);}}// Remove the top-level extension
|
|
27445
|
-
}catch(err){_iterator40.e(err);}finally{_iterator40.f();}scene.removeExtension(KHR_TEXTURE_BASISU);}var KHR_texture_basisu=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
27443
|
+
}catch(err){_iterator40.e(err);}finally{_iterator40.f();}scene.removeExtension(KHR_TEXTURE_BASISU);}var KHR_texture_basisu=/*#__PURE__*/Object.freeze({__proto__:null,name:name$6,preprocess:preprocess$2});// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
27446
27444
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
27447
27445
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
27448
27446
|
var VERSION$1="4.3.2";// loaders.gl
|
|
@@ -27556,11 +27554,11 @@ this.metadataQuerier.GetIntEntryArray(dracoMetadata,entryName,dracoArray);var in
|
|
|
27556
27554
|
* Copy a Draco int32 array into a JS typed array
|
|
27557
27555
|
*/function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i546=0;_i546<numValues;_i546++){intArray[_i546]=dracoArray.GetValue(_i546);}return intArray;}// Dynamic DRACO module loading inspired by THREE.DRACOLoader
|
|
27558
27556
|
var DRACO_DECODER_VERSION='1.5.6';var DRACO_ENCODER_VERSION='1.4.1';var STATIC_DECODER_URL="https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION);var DRACO_EXTERNAL_LIBRARIES={/** The primary Draco3D encoder, javascript wrapper part */DECODER:'draco_wasm_wrapper.js',/** The primary draco decoder, compiled web assembly part */DECODER_WASM:'draco_decoder.wasm',/** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */FALLBACK_DECODER:'draco_decoder.js',/** Draco encoder */ENCODER:'draco_encoder.js'};var DRACO_EXTERNAL_LIBRARY_URLS=(_DRACO_EXTERNAL_LIBRA={},_defineProperty(_DRACO_EXTERNAL_LIBRA,DRACO_EXTERNAL_LIBRARIES.DECODER,"".concat(STATIC_DECODER_URL,"/").concat(DRACO_EXTERNAL_LIBRARIES.DECODER)),_defineProperty(_DRACO_EXTERNAL_LIBRA,DRACO_EXTERNAL_LIBRARIES.DECODER_WASM,"".concat(STATIC_DECODER_URL,"/").concat(DRACO_EXTERNAL_LIBRARIES.DECODER_WASM)),_defineProperty(_DRACO_EXTERNAL_LIBRA,DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,"".concat(STATIC_DECODER_URL,"/").concat(DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER)),_defineProperty(_DRACO_EXTERNAL_LIBRA,DRACO_EXTERNAL_LIBRARIES.ENCODER,"https://raw.githubusercontent.com/google/draco/".concat(DRACO_ENCODER_VERSION,"/javascript/").concat(DRACO_EXTERNAL_LIBRARIES.ENCODER)),_DRACO_EXTERNAL_LIBRA);var loadDecoderPromise;function loadDracoDecoderModule(_x79){return _loadDracoDecoderModule.apply(this,arguments);}// DRACO DECODER LOADING
|
|
27559
|
-
function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27557
|
+
function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(options){var modules;return _regeneratorRuntime().wrap(function _callee55$(_context59){while(1){switch(_context59.prev=_context59.next){case 0:modules=options.modules||{};// Check if a bundled draco3d library has been supplied by application
|
|
27560
27558
|
if(modules.draco3d){loadDecoderPromise||(loadDecoderPromise=modules.draco3d.createDecoderModule({}).then(function(draco){return{draco:draco};}));}else{// If not, dynamically load the WASM script from our CDN
|
|
27561
|
-
loadDecoderPromise||(loadDecoderPromise=loadDracoDecoder(options));}
|
|
27559
|
+
loadDecoderPromise||(loadDecoderPromise=loadDracoDecoder(options));}_context59.next=4;return loadDecoderPromise;case 4:return _context59.abrupt("return",_context59.sent);case 5:case"end":return _context59.stop();}}},_callee55);}));return _loadDracoDecoderModule.apply(this,arguments);}function loadDracoDecoder(_x80){return _loadDracoDecoder.apply(this,arguments);}function _loadDracoDecoder(){_loadDracoDecoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(options){var DracoDecoderModule,wasmBinary,_yield$Promise$all5,_yield$Promise$all6;return _regeneratorRuntime().wrap(function _callee56$(_context60){while(1){switch(_context60.prev=_context60.next){case 0:_context60.t0=options.draco&&options.draco.decoderType;_context60.next=_context60.t0==='js'?3:_context60.t0==='wasm'?7:7;break;case 3:_context60.next=5;return loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],'draco',options,DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER);case 5:DracoDecoderModule=_context60.sent;return _context60.abrupt("break",21);case 7:_context60.t1=Promise;_context60.next=10;return loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],'draco',options,DRACO_EXTERNAL_LIBRARIES.DECODER);case 10:_context60.t2=_context60.sent;_context60.next=13;return loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],'draco',options,DRACO_EXTERNAL_LIBRARIES.DECODER_WASM);case 13:_context60.t3=_context60.sent;_context60.t4=[_context60.t2,_context60.t3];_context60.next=17;return _context60.t1.all.call(_context60.t1,_context60.t4);case 17:_yield$Promise$all5=_context60.sent;_yield$Promise$all6=_slicedToArray(_yield$Promise$all5,2);DracoDecoderModule=_yield$Promise$all6[0];wasmBinary=_yield$Promise$all6[1];case 21:// Depends on how import happened...
|
|
27562
27560
|
// @ts-ignore
|
|
27563
|
-
DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;
|
|
27561
|
+
DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;_context60.next=24;return initializeDracoDecoder(DracoDecoderModule,wasmBinary);case 24:return _context60.abrupt("return",_context60.sent);case 25:case"end":return _context60.stop();}}},_callee56);}));return _loadDracoDecoder.apply(this,arguments);}function initializeDracoDecoder(DracoDecoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){DracoDecoderModule(_objectSpread(_objectSpread({},options),{},{onModuleLoaded:function onModuleLoaded(draco){return resolve({draco:draco});}// Module is Promise-like. Wrap in object to avoid loop.
|
|
27564
27562
|
}));});}/**
|
|
27565
27563
|
* Browser worker doesn't work because of issue during "draco_encoder.js" loading.
|
|
27566
27564
|
* Refused to execute script from 'https://raw.githubusercontent.com/google/draco/1.4.1/javascript/draco_encoder.js' because its MIME type ('') is not executable.
|
|
@@ -27570,7 +27568,7 @@ DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;_context50.
|
|
|
27570
27568
|
// Returns a fresh attributes object with glTF-standardized attributes names
|
|
27571
27569
|
// Attributes that cannot be identified will not be included
|
|
27572
27570
|
// Removes `indices` if present, as it should be stored separately from the attributes
|
|
27573
|
-
function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27571
|
+
function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(arrayBuffer,options){var _yield$loadDracoDecod,draco,dracoParser;return _regeneratorRuntime().wrap(function _callee57$(_context61){while(1){switch(_context61.prev=_context61.next){case 0:_context61.next=2;return loadDracoDecoderModule(options);case 2:_yield$loadDracoDecod=_context61.sent;draco=_yield$loadDracoDecod.draco;dracoParser=new DracoParser(draco);_context61.prev=5;return _context61.abrupt("return",dracoParser.parseSync(arrayBuffer,options===null||options===void 0?void 0:options.draco));case 7:_context61.prev=7;dracoParser.destroy();return _context61.finish(7);case 10:case"end":return _context61.stop();}}},_callee57,null,[[5,,7,10]]);}));return _parse$2.apply(this,arguments);}function getGLTFAccessors(attributes){var accessors={};for(var _name6 in attributes){var attribute=attributes[_name6];if(_name6!=='indices'){var glTFAccessor=getGLTFAccessor(attribute);accessors[_name6]=glTFAccessor;}}return accessors;}// Fix up a single accessor.
|
|
27574
27572
|
// Input: typed array or a partial accessor object
|
|
27575
27573
|
// Return: accessor object
|
|
27576
27574
|
function getGLTFAccessor(attribute){var _getAccessorData=getAccessorData(attribute),buffer=_getAccessorData.buffer,size=_getAccessorData.size,count=_getAccessorData.count;var glTFAccessor={// glTF Accessor values
|
|
@@ -27584,9 +27582,9 @@ byteOffset:0,count:count,type:getAccessorTypeFromSize(size),componentType:getCom
|
|
|
27584
27582
|
// }
|
|
27585
27583
|
function getAccessorData(attribute){var buffer=attribute;var size=1;var count=0;if(attribute&&attribute.value){buffer=attribute.value;size=attribute.size||1;}if(buffer){if(!ArrayBuffer.isView(buffer)){buffer=toTypedArray(buffer,Float32Array);}count=buffer.length/size;}return{buffer:buffer,size:size,count:count};}// Convert non-typed arrays to arrays of specified format
|
|
27586
27584
|
function toTypedArray(array,ArrayType){var convertTypedArrays=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!array){return null;}if(Array.isArray(array)){return new ArrayType(array);}if(convertTypedArrays&&!(array instanceof ArrayType)){return new ArrayType(array);}return array;}// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
|
|
27587
|
-
var KHR_DRACO_MESH_COMPRESSION='KHR_draco_mesh_compression';/** Extension name */var name$
|
|
27588
|
-
}catch(err){_iterator68.e(err);}finally{_iterator68.f();}
|
|
27589
|
-
scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return
|
|
27585
|
+
var KHR_DRACO_MESH_COMPRESSION='KHR_draco_mesh_compression';/** Extension name */var name$5=KHR_DRACO_MESH_COMPRESSION;function preprocess$1(gltfData,options,context){var scenegraph=new GLTFScenegraph(gltfData);var _iterator42=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph)),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var _primitive5=_step42.value;if(scenegraph.getObjectExtension(_primitive5,KHR_DRACO_MESH_COMPRESSION));}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}}function decode$4(_x83,_x84,_x85){return _decode$5.apply(this,arguments);}function _decode$5(){_decode$5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58(gltfData,options,context){var _options$gltf10;var scenegraph,promises,_iterator68,_step68,_primitive10;return _regeneratorRuntime().wrap(function _callee58$(_context62){while(1){switch(_context62.prev=_context62.next){case 0:if(options!==null&&options!==void 0&&(_options$gltf10=options.gltf)!==null&&_options$gltf10!==void 0&&_options$gltf10.decompressMeshes){_context62.next=2;break;}return _context62.abrupt("return");case 2:scenegraph=new GLTFScenegraph(gltfData);promises=[];_iterator68=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph));try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){_primitive10=_step68.value;if(scenegraph.getObjectExtension(_primitive10,KHR_DRACO_MESH_COMPRESSION)){promises.push(decompressPrimitive(scenegraph,_primitive10,options,context));}}// Decompress meshes in parallel
|
|
27586
|
+
}catch(err){_iterator68.e(err);}finally{_iterator68.f();}_context62.next=8;return Promise.all(promises);case 8:// We have now decompressed all primitives, so remove the top-level extension
|
|
27587
|
+
scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return _context62.stop();}}},_callee58);}));return _decode$5.apply(this,arguments);}function encode$3(gltfData){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var scenegraph=new GLTFScenegraph(gltfData);var _iterator43=_createForOfIteratorHelper(scenegraph.json.meshes||[]),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _mesh7=_step43.value;// eslint-disable-next-line camelcase
|
|
27590
27588
|
// @ts-ignore
|
|
27591
27589
|
compressMesh(_mesh7);// NOTE: Only add the extension if something was actually compressed
|
|
27592
27590
|
scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}}// DECODE
|
|
@@ -27597,15 +27595,15 @@ scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterat
|
|
|
27597
27595
|
function decompressPrimitive(_x86,_x87,_x88,_x89){return _decompressPrimitive.apply(this,arguments);}// ENCODE
|
|
27598
27596
|
// eslint-disable-next-line max-len
|
|
27599
27597
|
// Only TRIANGLES: 0x0004 and TRIANGLE_STRIP: 0x0005 are supported
|
|
27600
|
-
function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27598
|
+
function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,dracoOptions,decodedData,decodedAttributes,_i693,_Object$entries9,_Object$entries9$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee59$(_context63){while(1){switch(_context63.prev=_context63.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context63.next=3;break;}return _context63.abrupt("return");case 3:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);// TODO - parse does not yet deal well with byte offsets embedded in typed arrays. Copy buffer
|
|
27601
27599
|
// TODO - remove when `parse` is fixed to handle `byteOffset`s
|
|
27602
27600
|
bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);// , buffer.byteLength);
|
|
27603
27601
|
dracoOptions=_objectSpread({},options);// TODO - remove hack: The entire tileset might be included, too expensive to serialize
|
|
27604
|
-
delete dracoOptions['3d-tiles'];
|
|
27605
|
-
for(
|
|
27602
|
+
delete dracoOptions['3d-tiles'];_context63.next=9;return parseFromContext(bufferCopy,DracoLoader,dracoOptions,context);case 9:decodedData=_context63.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);// Restore min/max values
|
|
27603
|
+
for(_i693=0,_Object$entries9=Object.entries(decodedAttributes);_i693<_Object$entries9.length;_i693++){_Object$entries9$_i=_slicedToArray(_Object$entries9[_i693],2),attributeName=_Object$entries9$_i[0],decodedAttribute=_Object$entries9$_i[1];if(attributeName in primitive.attributes){accessorIndex=primitive.attributes[attributeName];accessor=scenegraph.getAccessor(accessorIndex);if(accessor!==null&&accessor!==void 0&&accessor.min&&accessor!==null&&accessor!==void 0&&accessor.max){decodedAttribute.min=accessor.min;decodedAttribute.max=accessor.max;}}}// @ts-ignore
|
|
27606
27604
|
primitive.attributes=decodedAttributes;if(decodedData.indices){// @ts-ignore
|
|
27607
27605
|
primitive.indices=getGLTFAccessor(decodedData.indices);}// Extension has been processed, delete it
|
|
27608
|
-
scenegraph.removeObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);checkPrimitive(primitive);case 16:case"end":return
|
|
27606
|
+
scenegraph.removeObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);checkPrimitive(primitive);case 16:case"end":return _context63.stop();}}},_callee59);}));return _decompressPrimitive.apply(this,arguments);}function compressMesh(attributes,indices){var _context$parseSync;var mode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:4;var options=arguments.length>3?arguments[3]:undefined;var context=arguments.length>4?arguments[4]:undefined;if(!options.DracoWriter){throw new Error('options.gltf.DracoWriter not provided');}// TODO - use DracoWriter using encode w/ registered DracoWriter...
|
|
27609
27607
|
var compressedData=options.DracoWriter.encodeSync({attributes:attributes});// Draco compression may change the order and number of vertices in a mesh.
|
|
27610
27608
|
// To satisfy the requirement that accessors properties be correct for both
|
|
27611
27609
|
// compressed and uncompressed data, generators should create uncompressed
|
|
@@ -27616,7 +27614,7 @@ var decodedData=context===null||context===void 0?void 0:(_context$parseSync=cont
|
|
|
27616
27614
|
mode:mode,// GL.POINTS
|
|
27617
27615
|
extensions:_defineProperty({},KHR_DRACO_MESH_COMPRESSION,{bufferView:bufferViewIndex,attributes:fauxAccessors// TODO - verify with spec
|
|
27618
27616
|
})}]};return glTFMesh;}// UTILS
|
|
27619
|
-
function checkPrimitive(primitive){if(!primitive.attributes&&Object.keys(primitive.attributes).length>0){throw new Error('glTF: Empty primitive detected: Draco decompression failure?');}}function makeMeshPrimitiveIterator(scenegraph){var _iterator44,_step44,_mesh8,_iterator45,_step45,_primitive6;return _regeneratorRuntime().wrap(function makeMeshPrimitiveIterator$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_iterator44=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context10.prev=1;_iterator44.s();case 3:if((_step44=_iterator44.n()).done){_context10.next=24;break;}_mesh8=_step44.value;_iterator45=_createForOfIteratorHelper(_mesh8.primitives);_context10.prev=6;_iterator45.s();case 8:if((_step45=_iterator45.n()).done){_context10.next=14;break;}_primitive6=_step45.value;_context10.next=12;return _primitive6;case 12:_context10.next=8;break;case 14:_context10.next=19;break;case 16:_context10.prev=16;_context10.t0=_context10["catch"](6);_iterator45.e(_context10.t0);case 19:_context10.prev=19;_iterator45.f();return _context10.finish(19);case 22:_context10.next=3;break;case 24:_context10.next=29;break;case 26:_context10.prev=26;_context10.t1=_context10["catch"](1);_iterator44.e(_context10.t1);case 29:_context10.prev=29;_iterator44.f();return _context10.finish(29);case 32:case"end":return _context10.stop();}}},_marked3,null,[[1,26,29,32],[6,16,19,22]]);}var KHR_draco_mesh_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
27617
|
+
function checkPrimitive(primitive){if(!primitive.attributes&&Object.keys(primitive.attributes).length>0){throw new Error('glTF: Empty primitive detected: Draco decompression failure?');}}function makeMeshPrimitiveIterator(scenegraph){var _iterator44,_step44,_mesh8,_iterator45,_step45,_primitive6;return _regeneratorRuntime().wrap(function makeMeshPrimitiveIterator$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_iterator44=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context10.prev=1;_iterator44.s();case 3:if((_step44=_iterator44.n()).done){_context10.next=24;break;}_mesh8=_step44.value;_iterator45=_createForOfIteratorHelper(_mesh8.primitives);_context10.prev=6;_iterator45.s();case 8:if((_step45=_iterator45.n()).done){_context10.next=14;break;}_primitive6=_step45.value;_context10.next=12;return _primitive6;case 12:_context10.next=8;break;case 14:_context10.next=19;break;case 16:_context10.prev=16;_context10.t0=_context10["catch"](6);_iterator45.e(_context10.t0);case 19:_context10.prev=19;_iterator45.f();return _context10.finish(19);case 22:_context10.next=3;break;case 24:_context10.next=29;break;case 26:_context10.prev=26;_context10.t1=_context10["catch"](1);_iterator44.e(_context10.t1);case 29:_context10.prev=29;_iterator44.f();return _context10.finish(29);case 32:case"end":return _context10.stop();}}},_marked3,null,[[1,26,29,32],[6,16,19,22]]);}var KHR_draco_mesh_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$5,preprocess:preprocess$1,decode:decode$4,encode:encode$3});// math.gl
|
|
27620
27618
|
var DEFAULT_CONFIG={EPSILON:1e-12,debug:false,precision:4,printTypes:false,printDegrees:false,printRowMajor:true,_cartographicRadians:false};// Configuration is truly global as of v3.6 to ensure single config even if multiple copies of math.gl
|
|
27621
27619
|
// Multiple copies of config can be quite tricky to debug...
|
|
27622
27620
|
globalThis.mathgl=globalThis.mathgl||{config:_objectSpread({},DEFAULT_CONFIG)};var config=globalThis.mathgl.config;/**
|
|
@@ -27918,7 +27916,7 @@ this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=arra
|
|
|
27918
27916
|
},{key:"multiplyLeft",value:function multiplyLeft(a){multiply(this,a,this);return this.check();}},{key:"multiplyRight",value:function multiplyRight(a){multiply(this,this,a);return this.check();}},{key:"rotate",value:function rotate(radians){_rotate(this,this,radians);return this.check();}},{key:"scale",value:function scale(factor){if(Array.isArray(factor)){_scale6(this,this,factor);}else{_scale6(this,this,[factor,factor]);}return this.check();}},{key:"translate",value:function translate(vec){_translate(this,this,vec);return this.check();}// Transforms
|
|
27919
27917
|
},{key:"transform",value:function transform(vector,result){var out;switch(vector.length){case 2:out=transformMat3$1(result||[-0,-0],vector,this);break;case 3:out=transformMat3(result||[-0,-0,-0],vector,this);break;case 4:out=vec4_transformMat3(result||[-0,-0,-0,-0],vector,this);break;default:throw new Error('Illegal vector');}checkVector(out,vector.length);return out;}/** @deprecated */},{key:"transformVector",value:function transformVector(vector,result){return this.transform(vector,result);}/** @deprecated */},{key:"transformVector2",value:function transformVector2(vector,result){return this.transform(vector,result);}/** @deprecated */},{key:"transformVector3",value:function transformVector3(vector,result){return this.transform(vector,result);}}],[{key:"IDENTITY",get:function get(){return getIdentityMatrix();}},{key:"ZERO",get:function get(){return getZeroMatrix();}}]);return Matrix3;}(Matrix);var ZERO_MATRIX3;var IDENTITY_MATRIX3=null;function getZeroMatrix(){if(!ZERO_MATRIX3){ZERO_MATRIX3=new Matrix3([0,0,0,0,0,0,0,0,0]);Object.freeze(ZERO_MATRIX3);}return ZERO_MATRIX3;}function getIdentityMatrix(){if(!IDENTITY_MATRIX3){IDENTITY_MATRIX3=new Matrix3();Object.freeze(IDENTITY_MATRIX3);}return IDENTITY_MATRIX3;}/**
|
|
27920
27918
|
* https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_texture_transform/README.md
|
|
27921
|
-
*/ /** Extension name */var KHR_TEXTURE_TRANSFORM='KHR_texture_transform';var name$
|
|
27919
|
+
*/ /** Extension name */var KHR_TEXTURE_TRANSFORM='KHR_texture_transform';var name$4=KHR_TEXTURE_TRANSFORM;var scratchVector=new Vector3();var scratchRotationMatrix=new Matrix3();var scratchScaleMatrix=new Matrix3();/**
|
|
27922
27920
|
* The extension entry to process the transformation
|
|
27923
27921
|
* @param gltfData gltf buffers and json
|
|
27924
27922
|
* @param options GLTFLoader options
|
|
@@ -27926,7 +27924,7 @@ this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=arra
|
|
|
27926
27924
|
* Transform TEXCOORD by material
|
|
27927
27925
|
* @param materialIndex processing material index
|
|
27928
27926
|
* @param gltfData gltf buffers and json
|
|
27929
|
-
*/function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27927
|
+
*/function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee60(gltfData,options){var _options$gltf11;var gltfScenegraph,hasExtension,materials,_i694;return _regeneratorRuntime().wrap(function _callee60$(_context64){while(1){switch(_context64.prev=_context64.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);hasExtension=gltfScenegraph.hasExtension(KHR_TEXTURE_TRANSFORM);if(!(!hasExtension||!((_options$gltf11=options.gltf)!==null&&_options$gltf11!==void 0&&_options$gltf11.loadBuffers))){_context64.next=4;break;}return _context64.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i694=0;_i694<materials.length;_i694++){transformTexCoords(_i694,gltfData);}case 6:case"end":return _context64.stop();}}},_callee60);}));return _decode$6.apply(this,arguments);}function transformTexCoords(materialIndex,gltfData){var _gltfData$json$materi,_material$pbrMetallic,_material$pbrMetallic2;var material=(_gltfData$json$materi=gltfData.json.materials)===null||_gltfData$json$materi===void 0?void 0:_gltfData$json$materi[materialIndex];var materialTextures=[material===null||material===void 0?void 0:(_material$pbrMetallic=material.pbrMetallicRoughness)===null||_material$pbrMetallic===void 0?void 0:_material$pbrMetallic.baseColorTexture,material===null||material===void 0?void 0:material.emissiveTexture,material===null||material===void 0?void 0:material.normalTexture,material===null||material===void 0?void 0:material.occlusionTexture,material===null||material===void 0?void 0:(_material$pbrMetallic2=material.pbrMetallicRoughness)===null||_material$pbrMetallic2===void 0?void 0:_material$pbrMetallic2.metallicRoughnessTexture];// Save processed texCoords in order no to process the same twice
|
|
27930
27928
|
var processedTexCoords=[];for(var _i582=0,_materialTextures=materialTextures;_i582<_materialTextures.length;_i582++){var _textureInfo$extensio;var textureInfo=_materialTextures[_i582];if(textureInfo&&textureInfo!==null&&textureInfo!==void 0&&(_textureInfo$extensio=textureInfo.extensions)!==null&&_textureInfo$extensio!==void 0&&_textureInfo$extensio[KHR_TEXTURE_TRANSFORM]){transformPrimitives(gltfData,materialIndex,textureInfo,processedTexCoords);}}}/**
|
|
27931
27929
|
* Transform primitives of the particular material
|
|
27932
27930
|
* @param gltfData gltf data
|
|
@@ -27977,14 +27975,14 @@ createAttribute(texCoord,accessor,primitive,gltfData,result);}}}}}/**
|
|
|
27977
27975
|
* Construct transformation matrix from the extension data (transition, rotation, scale)
|
|
27978
27976
|
* @param extensionData extension data
|
|
27979
27977
|
* @returns transformation matrix
|
|
27980
|
-
*/function makeTransformationMatrix(extensionData){var _extensionData$offset=extensionData.offset,offset=_extensionData$offset===void 0?[0,0]:_extensionData$offset,_extensionData$rotati=extensionData.rotation,rotation=_extensionData$rotati===void 0?0:_extensionData$rotati,_extensionData$scale=extensionData.scale,scale=_extensionData$scale===void 0?[1,1]:_extensionData$scale;var translationMatrix=new Matrix3().set(1,0,0,0,1,0,offset[0],offset[1],1);var rotationMatrix=scratchRotationMatrix.set(Math.cos(rotation),Math.sin(rotation),0,-Math.sin(rotation),Math.cos(rotation),0,0,0,1);var scaleMatrix=scratchScaleMatrix.set(scale[0],0,0,0,scale[1],0,0,0,1);return translationMatrix.multiplyRight(rotationMatrix).multiplyRight(scaleMatrix);}var KHR_texture_transform=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
27981
|
-
var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$
|
|
27982
|
-
function _decode$7(){_decode$7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27978
|
+
*/function makeTransformationMatrix(extensionData){var _extensionData$offset=extensionData.offset,offset=_extensionData$offset===void 0?[0,0]:_extensionData$offset,_extensionData$rotati=extensionData.rotation,rotation=_extensionData$rotati===void 0?0:_extensionData$rotati,_extensionData$scale=extensionData.scale,scale=_extensionData$scale===void 0?[1,1]:_extensionData$scale;var translationMatrix=new Matrix3().set(1,0,0,0,1,0,offset[0],offset[1],1);var rotationMatrix=scratchRotationMatrix.set(Math.cos(rotation),Math.sin(rotation),0,-Math.sin(rotation),Math.cos(rotation),0,0,0,1);var scaleMatrix=scratchScaleMatrix.set(scale[0],0,0,0,scale[1],0,0,0,1);return translationMatrix.multiplyRight(rotationMatrix).multiplyRight(scaleMatrix);}var KHR_texture_transform=/*#__PURE__*/Object.freeze({__proto__:null,name:name$4,decode:decode$3});// GLTF EXTENSION: KHR_lights_punctual
|
|
27979
|
+
var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$3=KHR_LIGHTS_PUNCTUAL;function decode$2(_x92){return _decode$7.apply(this,arguments);}// Move the light ar ray out of the extension and remove the extension
|
|
27980
|
+
function _decode$7(){_decode$7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(gltfData){var gltfScenegraph,json,extension,_iterator69,_step69,node,nodeExtension;return _regeneratorRuntime().wrap(function _callee61$(_context65){while(1){switch(_context65.prev=_context65.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;// Move the light array out of the extension and remove the extension
|
|
27983
27981
|
extension=gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);if(extension){// @ts-ignore
|
|
27984
27982
|
gltfScenegraph.json.lights=extension.lights;gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);}// Any nodes that have the extension, add lights field pointing to light object
|
|
27985
27983
|
// and remove the extension
|
|
27986
27984
|
_iterator69=_createForOfIteratorHelper(json.nodes||[]);try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){node=_step69.value;nodeExtension=gltfScenegraph.getObjectExtension(node,KHR_LIGHTS_PUNCTUAL);if(nodeExtension){// @ts-ignore
|
|
27987
|
-
node.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(node,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}case 6:case"end":return
|
|
27985
|
+
node.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(node,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}case 6:case"end":return _context65.stop();}}},_callee61);}));return _decode$7.apply(this,arguments);}function encode$2(_x93){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee62(gltfData){var gltfScenegraph,json,extension,_iterator70,_step70,light,node;return _regeneratorRuntime().wrap(function _callee62$(_context66){while(1){switch(_context66.prev=_context66.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;// @ts-ignore
|
|
27988
27986
|
if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);// @ts-ignore
|
|
27989
27987
|
assert$1(!extension.lights);// @ts-ignore
|
|
27990
27988
|
extension.lights=json.lights;// @ts-ignore
|
|
@@ -27993,23 +27991,23 @@ delete json.lights;}// Any nodes that have lights field pointing to light object
|
|
|
27993
27991
|
// @ts-ignore
|
|
27994
27992
|
if(gltfScenegraph.json.lights){// @ts-ignore
|
|
27995
27993
|
_iterator70=_createForOfIteratorHelper(gltfScenegraph.json.lights);try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){light=_step70.value;node=light.node;gltfScenegraph.addObjectExtension(node,KHR_LIGHTS_PUNCTUAL,light);}// @ts-ignore
|
|
27996
|
-
}catch(err){_iterator70.e(err);}finally{_iterator70.f();}delete gltfScenegraph.json.lights;}case 4:case"end":return
|
|
27997
|
-
var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$
|
|
27994
|
+
}catch(err){_iterator70.e(err);}finally{_iterator70.f();}delete gltfScenegraph.json.lights;}case 4:case"end":return _context66.stop();}}},_callee62);}));return _encode$.apply(this,arguments);}var KHR_lights_punctual=/*#__PURE__*/Object.freeze({__proto__:null,name:name$3,decode:decode$2,encode:encode$2});// GLTF EXTENSION: KHR_materials_unlit
|
|
27995
|
+
var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$2=KHR_MATERIALS_UNLIT;function decode$1(_x94){return _decode$8.apply(this,arguments);}function _decode$8(){_decode$8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee63(gltfData){var gltfScenegraph,json,_iterator71,_step71,material,extension;return _regeneratorRuntime().wrap(function _callee63$(_context67){while(1){switch(_context67.prev=_context67.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;// Any nodes that have the extension, add lights field pointing to light object
|
|
27998
27996
|
// and remove the extension
|
|
27999
27997
|
_iterator71=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){material=_step71.value;extension=material.extensions&&material.extensions.KHR_materials_unlit;if(extension){// @ts-ignore TODO
|
|
28000
27998
|
material.unlit=true;}gltfScenegraph.removeObjectExtension(material,KHR_MATERIALS_UNLIT);}// Remove the top-level extension
|
|
28001
|
-
}catch(err){_iterator71.e(err);}finally{_iterator71.f();}gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);case 5:case"end":return
|
|
27999
|
+
}catch(err){_iterator71.e(err);}finally{_iterator71.f();}gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);case 5:case"end":return _context67.stop();}}},_callee63);}));return _decode$8.apply(this,arguments);}function encode$1(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;// Any nodes that have lights field pointing to light object
|
|
28002
28000
|
// add the extension
|
|
28003
28001
|
// @ts-ignore
|
|
28004
28002
|
if(gltfScenegraph.materials){var _iterator48=_createForOfIteratorHelper(json.materials||[]),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var material=_step48.value;// @ts-ignore
|
|
28005
28003
|
if(material.unlit){// @ts-ignore
|
|
28006
|
-
delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
28007
|
-
var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name=KHR_TECHNIQUES_WEBGL;function decode(_x95){return _decode.apply(this,arguments);}// eslint-disable-next-line
|
|
28008
|
-
function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28004
|
+
delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$2,decode:decode$1,encode:encode$1});// GLTF EXTENSION: KHR_techniques_webgl
|
|
28005
|
+
var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name$1=KHR_TECHNIQUES_WEBGL;function decode(_x95){return _decode.apply(this,arguments);}// eslint-disable-next-line
|
|
28006
|
+
function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee64(gltfData){var gltfScenegraph,json,extension,techniques,_iterator72,_step72,material,materialExtension;return _regeneratorRuntime().wrap(function _callee64$(_context68){while(1){switch(_context68.prev=_context68.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);if(extension){techniques=resolveTechniques(extension,gltfScenegraph);_iterator72=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){material=_step72.value;materialExtension=gltfScenegraph.getObjectExtension(material,KHR_TECHNIQUES_WEBGL);if(materialExtension){// @ts-ignore TODO
|
|
28009
28007
|
material.technique=Object.assign({},materialExtension,// @ts-ignore
|
|
28010
28008
|
techniques[materialExtension.technique]);// @ts-ignore TODO
|
|
28011
28009
|
material.technique.values=resolveValues(material.technique,gltfScenegraph);}gltfScenegraph.removeObjectExtension(material,KHR_TECHNIQUES_WEBGL);}// Remove the top-level extension
|
|
28012
|
-
}catch(err){_iterator72.e(err);}finally{_iterator72.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 4:case"end":return
|
|
28010
|
+
}catch(err){_iterator72.e(err);}finally{_iterator72.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 4:case"end":return _context68.stop();}}},_callee64);}));return _decode.apply(this,arguments);}function encode(_x96,_x97){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee65(gltfData,options){return _regeneratorRuntime().wrap(function _callee65$(_context69){while(1){switch(_context69.prev=_context69.next){case 0:case"end":return _context69.stop();}}},_callee65);}));return _encode.apply(this,arguments);}function resolveTechniques(techniquesExtension,// programs: {[key: string]: any}[],
|
|
28013
28011
|
// shaders: {[key: string]: any}[],
|
|
28014
28012
|
// techniques: {[key: string]: any}[]
|
|
28015
28013
|
gltfScenegraph){var _techniquesExtension$=techniquesExtension.programs,programs=_techniquesExtension$===void 0?[]:_techniquesExtension$,_techniquesExtension$2=techniquesExtension.shaders,shaders=_techniquesExtension$2===void 0?[]:_techniquesExtension$2,_techniquesExtension$3=techniquesExtension.techniques,techniques=_techniquesExtension$3===void 0?[]:_techniquesExtension$3;var textDecoder=new TextDecoder();shaders.forEach(function(shader){if(Number.isFinite(shader.bufferView)){shader.code=textDecoder.decode(gltfScenegraph.getTypedArrayForBufferView(shader.bufferView));}else{// TODO: handle URI shader
|
|
@@ -28017,7 +28015,7 @@ throw new Error('KHR_techniques_webgl: no shader code');}});programs.forEach(fun
|
|
|
28017
28015
|
Object.keys(technique.uniforms||{}).forEach(function(uniform){if(technique.uniforms[uniform].value&&!(uniform in values)){values[uniform]=technique.uniforms[uniform].value;}});// resolve textures
|
|
28018
28016
|
Object.keys(values).forEach(function(uniform){if(_typeof(values[uniform])==='object'&&values[uniform].index!==undefined){// Assume this is a texture
|
|
28019
28017
|
// TODO: find if there are any other types that can be referenced
|
|
28020
|
-
values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});return values;}var KHR_techniques_webgl=/*#__PURE__*/Object.freeze({__proto__:null,name:name,decode:decode,encode:encode});// GLTF 1.0 extensions (decode only)
|
|
28018
|
+
values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});return values;}var KHR_techniques_webgl=/*#__PURE__*/Object.freeze({__proto__:null,name:name$1,decode:decode,encode:encode});// GLTF 1.0 extensions (decode only)
|
|
28021
28019
|
/**
|
|
28022
28020
|
* List of extensions processed by the GLTFLoader
|
|
28023
28021
|
* Note that may extensions can only be handled on the rendering stage and are left out here
|
|
@@ -28027,7 +28025,7 @@ values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});ret
|
|
|
28027
28025
|
// KHR_binary_gltf,
|
|
28028
28026
|
// 2.0
|
|
28029
28027
|
EXT_structural_metadata,EXT_mesh_features,EXT_meshopt_compression,EXT_texture_webp,// Basisu should come after webp, we want basisu to be preferred if both are provided
|
|
28030
|
-
KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl,KHR_texture_transform,EXT_feature_metadata];/** Call before any resource loading starts */function preprocessExtensions(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var context=arguments.length>2?arguments[2]:undefined;var extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});var _iterator49=_createForOfIteratorHelper(extensions),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _extension$preprocess;var extension=_step49.value;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}}/** Call after resource loading */function decodeExtensions(_x98){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28028
|
+
KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl,KHR_texture_transform,EXT_feature_metadata];/** Call before any resource loading starts */function preprocessExtensions(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var context=arguments.length>2?arguments[2]:undefined;var extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});var _iterator49=_createForOfIteratorHelper(extensions),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _extension$preprocess;var extension=_step49.value;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}}/** Call after resource loading */function decodeExtensions(_x98){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee66(gltf){var options,context,extensions,_iterator73,_step73,_extension$decode,extension,_args69=arguments;return _regeneratorRuntime().wrap(function _callee66$(_context70){while(1){switch(_context70.prev=_context70.next){case 0:options=_args69.length>1&&_args69[1]!==undefined?_args69[1]:{};context=_args69.length>2?_args69[2]:undefined;extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});_iterator73=_createForOfIteratorHelper(extensions);_context70.prev=4;_iterator73.s();case 6:if((_step73=_iterator73.n()).done){_context70.next=12;break;}extension=_step73.value;_context70.next=10;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 10:_context70.next=6;break;case 12:_context70.next=17;break;case 14:_context70.prev=14;_context70.t0=_context70["catch"](4);_iterator73.e(_context70.t0);case 17:_context70.prev=17;_iterator73.f();return _context70.finish(17);case 20:case"end":return _context70.stop();}}},_callee66,null,[[4,14,17,20]]);}));return _decodeExtensions.apply(this,arguments);}function useExtension(extensionName,options){var _options$gltf7;var excludes=(options===null||options===void 0?void 0:(_options$gltf7=options.gltf)===null||_options$gltf7===void 0?void 0:_options$gltf7.excludeExtensions)||{};var exclude=extensionName in excludes&&!excludes[extensionName];return!exclude;}// GLTF 1.0 EXTENSION: KHR_binary_glTF
|
|
28031
28029
|
var KHR_BINARY_GLTF='KHR_binary_glTF';function preprocess(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;// Note: json.buffers.binary_glTF also needs to be replaced
|
|
28032
28030
|
// This is currently done during gltf normalization
|
|
28033
28031
|
// Image and shader nodes can have the extension
|
|
@@ -28120,8 +28118,8 @@ delete buffer.type;}}catch(err){_iterator57.e(err);}finally{_iterator57.f();}}/*
|
|
|
28120
28118
|
* @param data - can be ArrayBuffer (GLB), ArrayBuffer (Binary JSON), String (JSON), or Object (parsed JSON)
|
|
28121
28119
|
* @param byteOffset
|
|
28122
28120
|
* @param options
|
|
28123
|
-
*/function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28124
|
-
if(!(options!==null&&options!==void 0&&(_options$gltf13=options.gltf)!==null&&_options$gltf13!==void 0&&_options$gltf13.loadBuffers&&gltf.json.buffers)){
|
|
28121
|
+
*/function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee67(gltf,arrayBufferOrString){var _options$gltf12,_options$gltf13,_options$gltf14;var byteOffset,options,context,_args70=arguments;return _regeneratorRuntime().wrap(function _callee67$(_context71){while(1){switch(_context71.prev=_context71.next){case 0:byteOffset=_args70.length>2&&_args70[2]!==undefined?_args70[2]:0;options=_args70.length>3?_args70[3]:undefined;context=_args70.length>4?_args70[4]:undefined;parseGLTFContainerSync(gltf,arrayBufferOrString,byteOffset,options);normalizeGLTFV1(gltf,{normalize:options===null||options===void 0?void 0:(_options$gltf12=options.gltf)===null||_options$gltf12===void 0?void 0:_options$gltf12.normalize});preprocessExtensions(gltf,options,context);// Load linked buffers asynchronously and decodes base64 buffers in parallel
|
|
28122
|
+
if(!(options!==null&&options!==void 0&&(_options$gltf13=options.gltf)!==null&&_options$gltf13!==void 0&&_options$gltf13.loadBuffers&&gltf.json.buffers)){_context71.next=9;break;}_context71.next=9;return loadBuffers(gltf,options,context);case 9:if(!(options!==null&&options!==void 0&&(_options$gltf14=options.gltf)!==null&&_options$gltf14!==void 0&&_options$gltf14.loadImages)){_context71.next=12;break;}_context71.next=12;return loadImages(gltf,options,context);case 12:_context71.next=14;return decodeExtensions(gltf,options,context);case 14:return _context71.abrupt("return",gltf);case 15:case"end":return _context71.stop();}}},_callee67);}));return _parseGLTF$.apply(this,arguments);}function parseGLTFContainerSync(gltf,data,byteOffset,options){// Initialize gltf container
|
|
28125
28123
|
if(options.uri){gltf.baseUri=options.uri;}// If data is binary and starting with magic bytes, assume binary JSON text, convert to string
|
|
28126
28124
|
if(data instanceof ArrayBuffer&&!isGLB(data,byteOffset,options)){var textDecoder=new TextDecoder();data=textDecoder.decode(data);}if(typeof data==='string'){// If string, try to parse as JSON
|
|
28127
28125
|
gltf.json=parseJSON(data);}else if(data instanceof ArrayBuffer){// If still ArrayBuffer, parse as GLB container
|
|
@@ -28141,16 +28139,16 @@ var images=gltf.json.images||[];gltf.images=new Array(images.length).fill({});}/
|
|
|
28141
28139
|
* @param options
|
|
28142
28140
|
* @param context
|
|
28143
28141
|
* @returns
|
|
28144
|
-
*/function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28145
|
-
buffers=gltf.json.buffers||[];
|
|
28142
|
+
*/function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee68(gltf,options,context){var buffers,_i695,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee68$(_context72){while(1){switch(_context72.prev=_context72.next){case 0:// TODO
|
|
28143
|
+
buffers=gltf.json.buffers||[];_i695=0;case 2:if(!(_i695<buffers.length)){_context72.next=22;break;}buffer=buffers[_i695];if(!buffer.uri){_context72.next=18;break;}_fetch=context.fetch;assert$1(_fetch);uri=resolveUrl(buffer.uri,options);_context72.next=10;return context===null||context===void 0?void 0:(_context$fetch=context.fetch)===null||_context$fetch===void 0?void 0:_context$fetch.call(context,uri);case 10:response=_context72.sent;_context72.next=13;return response===null||response===void 0?void 0:(_response$arrayBuffer=response.arrayBuffer)===null||_response$arrayBuffer===void 0?void 0:_response$arrayBuffer.call(response);case 13:arrayBuffer=_context72.sent;gltf.buffers[_i695]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context72.next=19;break;case 18:if(gltf.buffers[_i695]===null){gltf.buffers[_i695]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i695;_context72.next=2;break;case 22:case"end":return _context72.stop();}}},_callee68);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x104,_x105,_x106){return _loadImages.apply(this,arguments);}/** Make sure we only load images that are actually referenced by textures */function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee69(gltf,options,context){var imageIndices,images,promises,_iterator74,_step74,imageIndex;return _regeneratorRuntime().wrap(function _callee69$(_context73){while(1){switch(_context73.prev=_context73.next){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator74=_createForOfIteratorHelper(imageIndices);try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){imageIndex=_step74.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator74.e(err);}finally{_iterator74.f();}_context73.next=7;return Promise.all(promises);case 7:return _context73.abrupt("return",_context73.sent);case 8:case"end":return _context73.stop();}}},_callee69);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator59=_createForOfIteratorHelper(textures),_step59;try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){var texture=_step59.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}return Array.from(imageIndices).sort();}/** Asynchronously fetches and parses one image, store in images array outside of json */function loadImage(_x107,_x108,_x109,_x110,_x111){return _loadImage.apply(this,arguments);}/**
|
|
28146
28144
|
* GLTF loader
|
|
28147
|
-
*/function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28148
|
-
|
|
28145
|
+
*/function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee70(gltf,image,index,options,context){var arrayBuffer,uri,_fetch2,response,array,parsedImage;return _regeneratorRuntime().wrap(function _callee70$(_context74){while(1){switch(_context74.prev=_context74.next){case 0:if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context74.next=10;break;}uri=resolveUrl(image.uri,options);_fetch2=context.fetch;_context74.next=5;return _fetch2(uri);case 5:response=_context74.sent;_context74.next=8;return response.arrayBuffer();case 8:arrayBuffer=_context74.sent;image.bufferView={data:arrayBuffer};case 10:if(Number.isFinite(image.bufferView)){array=getTypedArrayForBufferView(gltf.json,gltf.buffers,image.bufferView);arrayBuffer=sliceArrayBuffer(array.buffer,array.byteOffset,array.byteLength);}assert$1(arrayBuffer,'glTF image has no data');// Call `parse`
|
|
28146
|
+
_context74.next=14;return parseFromContext(arrayBuffer,[ImageLoader,BasisLoader],_objectSpread(_objectSpread({},options),{},{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}}),context);case 14:parsedImage=_context74.sent;if(parsedImage&&parsedImage[0]){parsedImage={compressed:true,// @ts-expect-error
|
|
28149
28147
|
mipmaps:false,width:parsedImage[0].width,height:parsedImage[0].height,data:parsedImage[0]};}// TODO making sure ImageLoader is overridable by using array of loaders
|
|
28150
28148
|
// const parsedImage = await parse(arrayBuffer, [ImageLoader]);
|
|
28151
28149
|
// Store the loaded image
|
|
28152
28150
|
gltf.images=gltf.images||[];// @ts-expect-error TODO - sort out image typing asap
|
|
28153
|
-
gltf.images[index]=parsedImage;case 18:case"end":return
|
|
28151
|
+
gltf.images[index]=parsedImage;case 18:case"end":return _context74.stop();}}},_callee70);}));return _loadImage.apply(this,arguments);}var GLTFLoader={dataType:null,batchType:null,name:'glTF',id:'gltf',module:'gltf',version:VERSION$3,extensions:['gltf','glb'],mimeTypes:['model/gltf+json','model/gltf-binary'],text:true,binary:true,tests:['glTF'],parse:parse$1,options:{gltf:{normalize:true,// Normalize glTF v1 to glTF v2 format (not yet stable)
|
|
28154
28152
|
loadBuffers:true,// Fetch any linked .BIN buffers, decode base64
|
|
28155
28153
|
loadImages:true,// Create image objects
|
|
28156
28154
|
decompressMeshes:true// Decompress Draco encoded meshes
|
|
@@ -28165,9 +28163,9 @@ log:console// eslint-disable-line
|
|
|
28165
28163
|
// * Translate stringified enum keys and values into WebGL constants.
|
|
28166
28164
|
// * Load images (optional)
|
|
28167
28165
|
// ENUM LOOKUP
|
|
28168
|
-
function _parse$3(){_parse$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28166
|
+
function _parse$3(){_parse$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee71(arrayBuffer){var options,context,_options2,_options2$byteOffset,byteOffset,gltf,_args74=arguments;return _regeneratorRuntime().wrap(function _callee71$(_context75){while(1){switch(_context75.prev=_context75.next){case 0:options=_args74.length>1&&_args74[1]!==undefined?_args74[1]:{};context=_args74.length>2?_args74[2]:undefined;// Apps can call the parse method directly, we so apply default options here
|
|
28169
28167
|
options=_objectSpread(_objectSpread({},GLTFLoader.options),options);// @ts-ignore
|
|
28170
|
-
options.gltf=_objectSpread(_objectSpread({},GLTFLoader.options.gltf),options.gltf);_options2=options,_options2$byteOffset=_options2.byteOffset,byteOffset=_options2$byteOffset===void 0?0:_options2$byteOffset;gltf={};
|
|
28168
|
+
options.gltf=_objectSpread(_objectSpread({},GLTFLoader.options.gltf),options.gltf);_options2=options,_options2$byteOffset=_options2.byteOffset,byteOffset=_options2$byteOffset===void 0?0:_options2$byteOffset;gltf={};_context75.next=8;return parseGLTF$1(gltf,arrayBuffer,byteOffset,options,context);case 8:return _context75.abrupt("return",_context75.sent);case 9:case"end":return _context75.stop();}}},_callee71);}));return _parse$3.apply(this,arguments);}var COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES={5120:1,// BYTE
|
|
28171
28169
|
5121:1,// UNSIGNED_BYTE
|
|
28172
28170
|
5122:2,// SHORT
|
|
28173
28171
|
5123:2,// UNSIGNED_SHORT
|
|
@@ -30624,8 +30622,8 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
|
|
|
30624
30622
|
_this164._nodeNodes={};// Node ID -> Node
|
|
30625
30623
|
_this164._rootNames={};// Node ID -> Root name
|
|
30626
30624
|
_this164._sortNodes=cfg.sortNodes;_this164._pruneEmptyNodes=cfg.pruneEmptyNodes;_this164._showListItemElementId=null;_this164._renderService=cfg.renderService||new RenderService();_this164._showIndeterminate=(_cfg$showIndeterminat=cfg.showIndeterminate)!==null&&_cfg$showIndeterminat!==void 0?_cfg$showIndeterminat:false;_this164._showProjectNode=(_cfg$showProjectNode=cfg.showProjectNode)!==null&&_cfg$showProjectNode!==void 0?_cfg$showProjectNode:false;_this164._elevationSortFunction=(_cfg$elevationSortFun=cfg.elevationSortFunction)!==null&&_cfg$elevationSortFun!==void 0?_cfg$elevationSortFun:undefined;_this164._defaultSortFunction=(_cfg$defaultSortFunct=cfg.defaultSortFunction)!==null&&_cfg$defaultSortFunct!==void 0?_cfg$defaultSortFunct:undefined;if(!_this164._renderService){throw new Error('TreeViewPlugin: no render service set');}_this164._containerElement.oncontextmenu=function(e){e.preventDefault();};_this164._onObjectVisibility=_this164._viewer.scene.on("objectVisibility",function(entity){if(_this164._muteSceneEvents){return;}var objectId=entity.id;var node=_this164._objectNodes[objectId];if(!node){return;// Not in this tree
|
|
30627
|
-
}var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this164._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}_this164._renderService.setCheckbox(node.nodeId,visible);var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}var indeterminate=_this164._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;_this164._renderService.setCheckbox(parent.nodeId,parent.
|
|
30628
|
-
}_this164._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this164._renderService.setXRayed(node.nodeId,xrayed);_this164._muteTreeEvents=false;});_this164._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this164._expandSwitchElement(switchElement);};_this164._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this164._collapseSwitchElement(switchElement);};_this164._checkboxChangeHandler=function(event){if(_this164._muteTreeEvents){return;}_this164._muteSceneEvents=true;var checkbox=event.target;var visible=_this164._renderService.isChecked(checkbox);var nodeId=_this164._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this164._nodeNodes[nodeId];var objects=_this164._viewer.scene.objects;var numUpdated=0;_this164._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;_this164._renderService.setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}});var parent=checkedNode.parent;while(parent){
|
|
30625
|
+
}var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this164._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}_this164._renderService.setCheckbox(node.nodeId,visible);var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}var indeterminate=_this164._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;parent.checked=parent.numVisibleEntities>0;_this164._renderService.setCheckbox(parent.nodeId,parent.checked,indeterminate);parent=parent.parent;}_this164._muteTreeEvents=false;});_this164._onObjectXrayed=_this164._viewer.scene.on('objectXRayed',function(entity){if(_this164._muteSceneEvents){return;}var objectId=entity.id;var node=_this164._objectNodes[objectId];if(!node){return;// Not in this tree
|
|
30626
|
+
}_this164._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this164._renderService.setXRayed(node.nodeId,xrayed);_this164._muteTreeEvents=false;});_this164._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this164._expandSwitchElement(switchElement);};_this164._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this164._collapseSwitchElement(switchElement);};_this164._checkboxChangeHandler=function(event){if(_this164._muteTreeEvents){return;}_this164._muteSceneEvents=true;var checkbox=event.target;var visible=_this164._renderService.isChecked(checkbox);var nodeId=_this164._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this164._nodeNodes[nodeId];var objects=_this164._viewer.scene.objects;var numUpdated=0;_this164._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;_this164._renderService.setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}});var parent=checkedNode.parent;while(parent){if(visible){parent.numVisibleEntities+=numUpdated;}else{parent.numVisibleEntities-=numUpdated;}var indeterminate=_this164._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;parent.checked=parent.numVisibleEntities>0;_this164._renderService.setCheckbox(parent.nodeId,parent.checked,indeterminate);parent=parent.parent;}_this164._muteSceneEvents=false;};_this164._hierarchy=cfg.hierarchy||"containment";_this164._autoExpandDepth=cfg.autoExpandDepth||0;if(_this164._autoAddModels){var modelIds=Object.keys(_this164.viewer.metaScene.metaModels);for(var _i599=0,len=modelIds.length;_i599<len;_i599++){var modelId=modelIds[_i599];var metaModel=_this164.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this164.addModel(modelId);}}_this164.viewer.scene.on("modelLoaded",function(modelId){if(_this164.viewer.metaScene.metaModels[modelId]){_this164.addModel(modelId);}});}_this164.hierarchy=cfg.hierarchy;return _this164;}/**
|
|
30629
30627
|
* Sets how the nodes are organized within this tree view.
|
|
30630
30628
|
*
|
|
30631
30629
|
* Accepted values are:
|
|
@@ -31865,9 +31863,9 @@ var ParserV12={version:12,parseArrayBuffer:function parseArrayBuffer(viewer,opti
|
|
|
31865
31863
|
var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){if(sceneModel.destroyed){return;}// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
|
|
31866
31864
|
sceneModel.finalize();metaModel.finalize();_this176.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this176.viewer.metaScene.destroyMetaModel(metaModel.id);});_this176.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
31867
31865
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
31868
|
-
});};var error=function error(errMsg){_this176.viewer.scene.canvas.spinner.processes--;_this176.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this176._loadModel(params.src,options,sceneModel,null,manifestCtx,finish,error);}else{_this176._parseModel(params.xkt,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=metaDataFiles.length){done();}else{_this176._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this176.scheduleTask(loadNext,200);},error);}};loadNext();};var loadXKTs_excludeTheirMetaModels=function loadXKTs_excludeTheirMetaModels(xktFiles,done,error){// Load XKTs, ignore metamodels in the XKT
|
|
31866
|
+
});};var error=function error(errMsg){_this176.viewer.scene.canvas.spinner.processes--;_this176.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this176._loadModel(params.src,options,sceneModel,null,manifestCtx,finish,error);}else{_this176._parseModel(params.xkt,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory$1(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=metaDataFiles.length){done();}else{_this176._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this176.scheduleTask(loadNext,200);},error);}};loadNext();};var loadXKTs_excludeTheirMetaModels=function loadXKTs_excludeTheirMetaModels(xktFiles,done,error){// Load XKTs, ignore metamodels in the XKT
|
|
31869
31867
|
var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this176._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this176._parseModel(arrayBuffer,options,sceneModel,null/* Ignore metamodel in XKT */,manifestCtx);sceneModel.preFinalize();i++;_this176.scheduleTask(loadNext,200);},error);}};loadNext();};var loadXKTs_includeTheirMetaModels=function loadXKTs_includeTheirMetaModels(xktFiles,done,error){// Load XKTs, parse metamodels from the XKT
|
|
31870
|
-
var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this176._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this176._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this176.scheduleTask(loadNext,200);},error);}};loadNext();};if(params.manifest){var manifestData=params.manifest;var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs_excludeTheirMetaModels(xktFiles,finish,error);},error);}else{loadXKTs_includeTheirMetaModels(xktFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs_excludeTheirMetaModels(xktFiles,finish,error);},error);}else{loadXKTs_includeTheirMetaModels(xktFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,options,sceneModel,metaModel,manifestCtx,done,error){var _this177=this;this._dataSource.getXKT(src,function(arrayBuffer){_this177._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(arrayBuffer,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,firstUint,xktVersion,zipped,parser,numElements,elements,byteOffset,_i647,elementSize;return _regeneratorRuntime().wrap(function _callee7$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:if(!sceneModel.destroyed){_context11.next=2;break;}return _context11.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);firstUint=dataView.getUint32(0,true);xktVersion=firstUint&0x7fffffff;zipped=xktVersion<11||xktVersion>=12&&firstUint>>>31;parser=parsers[xktVersion];if(parser){_context11.next=11;break;}this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return _context11.abrupt("return");case 11:if(zipped){_context11.next=14;break;}parser.parseArrayBuffer(this.viewer,options,arrayBuffer,sceneModel,metaModel,manifestCtx);return _context11.abrupt("return");case 14:numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i647=0;_i647<numElements;_i647++){elementSize=dataView.getUint32((_i647+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 19:case"end":return _context11.stop();}}},_callee7,this);}));function _parseModel(_x113,_x114,_x115,_x116,_x117){return _parseModel2.apply(this,arguments);}return _parseModel;}()}]);return XKTLoaderPlugin;}(Plugin);function getBaseDirectory(filePath){if(filePath.indexOf('?')>-1){filePath=filePath.split('?')[0];}var pathArray=filePath.split('/');pathArray.pop();// Remove the file name or the last segment of the path
|
|
31868
|
+
var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this176._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this176._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this176.scheduleTask(loadNext,200);},error);}};loadNext();};if(params.manifest){var manifestData=params.manifest;var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs_excludeTheirMetaModels(xktFiles,finish,error);},error);}else{loadXKTs_includeTheirMetaModels(xktFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs_excludeTheirMetaModels(xktFiles,finish,error);},error);}else{loadXKTs_includeTheirMetaModels(xktFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,options,sceneModel,metaModel,manifestCtx,done,error){var _this177=this;this._dataSource.getXKT(src,function(arrayBuffer){_this177._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(arrayBuffer,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,firstUint,xktVersion,zipped,parser,numElements,elements,byteOffset,_i647,elementSize;return _regeneratorRuntime().wrap(function _callee7$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:if(!sceneModel.destroyed){_context11.next=2;break;}return _context11.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);firstUint=dataView.getUint32(0,true);xktVersion=firstUint&0x7fffffff;zipped=xktVersion<11||xktVersion>=12&&firstUint>>>31;parser=parsers[xktVersion];if(parser){_context11.next=11;break;}this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return _context11.abrupt("return");case 11:if(zipped){_context11.next=14;break;}parser.parseArrayBuffer(this.viewer,options,arrayBuffer,sceneModel,metaModel,manifestCtx);return _context11.abrupt("return");case 14:numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i647=0;_i647<numElements;_i647++){elementSize=dataView.getUint32((_i647+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 19:case"end":return _context11.stop();}}},_callee7,this);}));function _parseModel(_x113,_x114,_x115,_x116,_x117){return _parseModel2.apply(this,arguments);}return _parseModel;}()}]);return XKTLoaderPlugin;}(Plugin);function getBaseDirectory$1(filePath){if(filePath.indexOf('?')>-1){filePath=filePath.split('?')[0];}var pathArray=filePath.split('/');pathArray.pop();// Remove the file name or the last segment of the path
|
|
31871
31869
|
return pathArray.join('/')+'/';}/*
|
|
31872
31870
|
Copyright (c) 2013 Gildas Lormeau. All rights reserved.
|
|
31873
31871
|
|
|
@@ -32740,7 +32738,44 @@ sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscri
|
|
|
32740
32738
|
});}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,'RelatingObject','RelatedObjects',this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,'RelatingStructure','RelatedElements',this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this181=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i652=0;_i652<lines.size();_i652++){var relID=lines.get(_i652);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this181._ifcAPI.GetLine(ctx.modelID,element2.value);_this181._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i653=0;_i653<lines.size();_i653++){var relID=lines.get(_i653);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i654=0,len=props.length;_i654<len;_i654++){var prop=props[_i654];var _name7=prop.Name;var nominalValue=prop.NominalValue;if(_name7&&nominalValue){var property={name:_name7.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i655=0,_len125=relatedObjects.length;_i655<_len125;_i655++){var relatedObject=relatedObjects[_i655];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this182=this;this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
|
|
32741
32739
|
var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this182._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);var globalId=properties.GlobalId.value;if(ctx.loadMetadata){var metaObjectId=globalId;var metaObject=ctx.metaObjects[metaObjectId];if(ctx.includeTypes&&(!metaObject||!ctx.includeTypes[metaObject.type])){return;}if(ctx.excludeTypes&&(!metaObject||ctx.excludeTypes[metaObject.type])){return;}}var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this182._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this182._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this182._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
|
|
32742
32740
|
var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,l=0,lenk=vertexData.length/6;k<lenk;k++,l+=3){positions[l+0]=vertexData[k*6+0];positions[l+1]=vertexData[k*6+1];positions[l+2]=vertexData[k*6+2];}matrix.set(placedGeometry.flatTransformation);math.transformPositions3(matrix,positions);var rtcNeeded=worldToRTCPositions(positions,positions,origin);if(!ctx.options.autoNormals){for(var _k2=0,_l2=0,_lenk=vertexData.length/6;_k2<_lenk;_k2++,_l2+=3){normals[_l2+0]=vertexData[_k2*6+3];normals[_l2+1]=vertexData[_k2*6+4];normals[_l2+2]=vertexData[_k2*6+5];}}ctx.stats.numGeometries++;ctx.stats.numVertices+=positions.length/3;ctx.stats.numTriangles+=indices.length/3;var meshId="mesh"+ctx.nextId++;ctx.sceneModel.createMesh({id:meshId,primitive:"triangles",// TODO
|
|
32743
|
-
origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});}}]);return WebIFCLoaderPlugin;}(Plugin);/**
|
|
32741
|
+
origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});}}]);return WebIFCLoaderPlugin;}(Plugin);var name="@creooxag/cx-converter";var version="0.0.12-alpha";var description="";var exports$1={".":{types:"./dist/index.d.ts","import":"./dist/index.mjs",require:"./dist/index.cjs"}};var main="./dist/index.mjs";var module$1="./dist/index.mjs";var types="./dist/index.d.ts";var typesVersions={"*":{"*":["./dist/*","./dist/index.d.ts"]}};var files=["dist/"];var scripts={"clean-dist":"rm -rf ./dist","clean-cmake":"rm -rf ./cmake-build","build-wasm-release":"emcmake cmake -S . -B ../cmake-build -DCMAKE_BUILD_TYPE=Release && cmake --build ../cmake-build","publish-npm":"npm publish --access public",build:"unbuild",dev:"unbuild --stub",lint:"eslint .",start:"esno examples/node/nodeExport.ts","example-html":"http-server -c-1 -p8237 --cors"};var keywords=[];var devDependencies={"@types/node":"^22.10.2",esno:"^4.8.0","fast-glob":"^3.3.2",globals:"^15.8.0","http-server":"^14.1.1",prettier:"^3.3.3","prettier-eslint":"^16.3.0",typescript:"^5.7.2",unbuild:"^2.0.0","@eslint/eslintrc":"^3.2.0","@eslint/js":"^9.20.0","@typescript-eslint/eslint-plugin":"^8.24.0","@typescript-eslint/parser":"^8.24.0",eslint:"^9.20.1","eslint-config-prettier":"^10.0.1","eslint-plugin-import":"^2.31.0","eslint-plugin-prettier":"^5.2.3"};var packageJSON={name:name,version:version,description:description,exports:exports$1,main:main,module:module$1,types:types,typesVersions:typesVersions,files:files,scripts:scripts,keywords:keywords,devDependencies:devDependencies};var __defProp$2=Object.defineProperty;var __defNormalProp$2=function __defNormalProp$2(obj,key,value){return key in obj?__defProp$2(obj,key,{enumerable:true,configurable:true,writable:true,value:value}):obj[key]=value;};var __publicField$2=function __publicField$2(obj,key,value){__defNormalProp$2(obj,_typeof(key)!=="symbol"?key+"":key,value);return value;};var IfcDbWasm=function(){var _scriptName=import.meta.url;return/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(){var moduleArg,moduleRtn,Module,readyPromiseResolve,readyPromiseReject,readyPromise,moduleOverrides,arguments_,thisProgram,quit_,scriptDirectory,locateFile,readAsync,readBinary,out,err,wasmBinary,wasmMemory,ABORT,EXITSTATUS,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64,updateMemoryViews,preRun,initRuntime,postRun,runDependencies,dependenciesFulfilled,addRunDependency,removeRunDependency,abort,wasmBinaryFile,findWasmBinary,getBinarySync,getWasmBinary,_getWasmBinary,instantiateArrayBuffer,_instantiateArrayBuffer,instantiateAsync,_instantiateAsync,getWasmImports,createWasm,_createWasm,ASM_CONSTS,ExitStatus,callRuntimeCallbacks,onPostRuns,addOnPostRun,onPreRuns,addOnPreRun,noExitRuntime,ExceptionInfo,exceptionLast,___cxa_throw,syscallGetVarargI,syscallGetVarargP,PATH,initRandomFill,_randomFill,PATH_FS,UTF8Decoder,UTF8ArrayToString,FS_stdin_getChar_buffer,lengthBytesUTF8,stringToUTF8Array,intArrayFromString,FS_stdin_getChar,TTY,alignMemory,mmapAlloc,MEMFS,asyncLoad,FS_createDataFile,preloadPlugins,FS_handledByPreloadPlugin,FS_createPreloadedFile,FS_modeStringToFlags,FS_getMode,FS,UTF8ToString,SYSCALLS,___syscall_fcntl64,___syscall_ioctl,___syscall_openat,___syscall_renameat,___syscall_rmdir,___syscall_stat64,___syscall_unlinkat,__abort_js,structRegistrations,runDestructors,readPointer,awaitingDependencies,registeredTypes,typeDependencies,InternalError,throwInternalError,whenDependentTypesAreResolved,__embind_finalize_value_object,embindRepr,embind_init_charCodes,embind_charCodes,readLatin1String,BindingError,throwBindingError,sharedRegisterType,registerType,integerReadValueFromPointer,__embind_register_bigint,GenericWireTypeSize,__embind_register_bool,emval_freelist,emval_handles,__emval_decref,count_emval_handles,init_emval,Emval,EmValType,__embind_register_emval,floatReadValueFromPointer,__embind_register_float,createNamedFunction,usesDestructorStack,newFunc,createJsInvoker,runAndAbortIfError,handleException,runtimeKeepaliveCounter,keepRuntimeAlive,_proc_exit,exitJS,_exit,maybeExit,callUserCallback,Asyncify,craftInvokerFunction,ensureOverloadTable,exposePublicSymbol,heap32VectorToArray,replacePublicSymbol,dynCallLegacy,dynCall,getDynCaller,embind__requireFunction,extendError,UnboundTypeError,getTypeName,throwUnboundTypeError,getFunctionName,__embind_register_function,__embind_register_integer,__embind_register_memory_view,stringToUTF8,__embind_register_std_string,UTF16Decoder,UTF16ToString,stringToUTF16,lengthBytesUTF16,UTF32ToString,stringToUTF32,lengthBytesUTF32,__embind_register_std_wstring,__embind_register_value_object,__embind_register_value_object_field,__embind_register_void,requireRegisteredType,emval_returnValue,__emval_as,emval_methodCallers,__emval_call,emval_symbols,getStringOrSymbol,emval_get_global,__emval_get_global,emval_addMethodCaller,emval_lookupTypes,__emval_get_method_caller,__emval_incref,__emval_is_string,__emval_run_destructors,__emval_take_value,isLeapYear,MONTH_DAYS_LEAP_CUMULATIVE,MONTH_DAYS_REGULAR_CUMULATIVE,ydayFromDate,INT53_MAX,INT53_MIN,bigintToI53Checked,__localtime_js,__mktime_js,__tzset_js,_emscripten_get_now,_emscripten_date_now,checkWasiClock,_clock_time_get,readEmAsmArgsArray,readEmAsmArgs,runEmAsmFunction,_emscripten_asm_const_int,getHeapMax,_emscripten_get_heap_max,growMemory,_emscripten_resize_heap,safeSetTimeout,_emscripten_sleep,ENV,getExecutableName,getEnvStrings,stringToAscii,_environ_get,_environ_sizes_get,_fd_close,doReadv,_fd_read,_fd_seek,doWritev,_fd_write,stackAlloc,stringToUTF8OnStack,wasmImports,wasmExports,___getTypeName,_malloc,_free,_main,__emscripten_stack_alloc,_asyncify_start_unwind,_asyncify_stop_unwind,_asyncify_start_rewind,_asyncify_stop_rewind,callMain,run,_args17=arguments;return _regeneratorRuntime().wrap(function _callee14$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:run=function _run(){var args=arguments.length>0&&arguments[0]!==undefined?arguments[0]:arguments_;if(runDependencies>0){dependenciesFulfilled=run;return;}preRun();if(runDependencies>0){dependenciesFulfilled=run;return;}function doRun(){var _Module$onRuntimeInit;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);(_Module$onRuntimeInit=Module["onRuntimeInitialized"])===null||_Module$onRuntimeInit===void 0?void 0:_Module$onRuntimeInit.call(Module);var noInitialRun=Module["noInitialRun"]||true;if(!noInitialRun)callMain(args);postRun();}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){return Module["setStatus"]("");},1);doRun();},1);}else{doRun();}};callMain=function _callMain(){var args=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;args.forEach(function(arg){HEAPU32[argv_ptr>>2]=stringToUTF8OnStack(arg);argv_ptr+=4;});HEAPU32[argv_ptr>>2]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret;}catch(e){return handleException(e);}};_fd_write=function _fd_write2(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_seek=function _fd_seek2(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);HEAP64[newOffset>>3]=BigInt(stream.position);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_read=function _fd_read2(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_close=function _fd_close2(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_clock_time_get=function _clock_time_get2(clk_id,ignored_precision,ptime){if(!checkWasiClock(clk_id)){return 28;}var now;if(clk_id===0){now=_emscripten_date_now();}else{now=_emscripten_get_now();}var nsec=Math.round(now*1e3*1e3);HEAP64[ptime>>3]=BigInt(nsec);return 0;};__localtime_js=function _localtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst;};craftInvokerFunction=function _craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=usesDestructorStack(argTypes);var returns=argTypes[0].name!=="void";var closureArgs=[humanName,throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,argTypes[0],argTypes[1]];for(var i=0;i<argCount-2;++i){closureArgs.push(argTypes[i+2]);}closureArgs.push(Asyncify);if(!needsDestructorStack){for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){if(argTypes[i].destructorFunction!==null){closureArgs.push(argTypes[i].destructorFunction);}}}var _createJsInvoker=createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync),_createJsInvoker2=_slicedToArray(_createJsInvoker,2),args=_createJsInvoker2[0],invokerFnBody=_createJsInvoker2[1];args.push(invokerFnBody);var invokerFn=newFunc(Function,args).apply(void 0,closureArgs);return createNamedFunction(humanName,invokerFn);};createJsInvoker=function _createJsInvoker3(argTypes,isClassMethodFunc,returns,isAsync){var needsDestructorStack=usesDestructorStack(argTypes);var argCount=argTypes.length-2;var argsList=[];var argsListWired=["fn"];if(isClassMethodFunc){argsListWired.push("thisWired");}for(var i=0;i<argCount;++i){argsList.push("arg".concat(i));argsListWired.push("arg".concat(i,"Wired"));}argsList=argsList.join(",");argsListWired=argsListWired.join(",");var invokerFnBody="return function (".concat(argsList,") {\n");if(needsDestructorStack){invokerFnBody+="var destructors = [];\n";}var dtorStack=needsDestructorStack?"destructors":"null";var args1=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];if(isClassMethodFunc){invokerFnBody+="var thisWired = classParam['toWireType'](".concat(dtorStack,", this);\n");}for(var i=0;i<argCount;++i){invokerFnBody+="var arg".concat(i,"Wired = argType").concat(i,"['toWireType'](").concat(dtorStack,", arg").concat(i,");\n");args1.push("argType".concat(i));}invokerFnBody+=(returns||isAsync?"var rv = ":"")+"invoker(".concat(argsListWired,");\n");var returnVal=returns?"rv":"";args1.push("Asyncify");invokerFnBody+="function onDone(".concat(returnVal,") {\n");if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n";}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=i===1?"thisWired":"arg"+(i-2)+"Wired";if(argTypes[i].destructorFunction!==null){invokerFnBody+="".concat(paramName,"_dtor(").concat(paramName,");\n");args1.push("".concat(paramName,"_dtor"));}}}if(returns){invokerFnBody+="var ret = retType['fromWireType'](rv);\nreturn ret;\n";}invokerFnBody+="}\n";invokerFnBody+="return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(".concat(returnVal,");\n");invokerFnBody+="}\n";return[args1,invokerFnBody];};newFunc=function _newFunc(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError("new_ called with constructor type ".concat(_typeof(constructor)," which is not a function"));}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy();var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj;};usesDestructorStack=function _usesDestructorStack(argTypes){for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===void 0){return true;}}return false;};registerType=function _registerType(rawType,registeredInstance){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return sharedRegisterType(rawType,registeredInstance,options);};sharedRegisterType=function _sharedRegisterType(rawType,registeredInstance){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var name=registeredInstance.name;if(!rawType){throwBindingError("type \"".concat(name,"\" must have a positive integer typeid pointer"));}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return;}else{throwBindingError("Cannot register type '".concat(name,"' twice"));}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(function(cb){return cb();});}};readPointer=function _readPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2]);};___syscall_unlinkat=function _syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(flags===0){FS.unlink(path);}else if(flags===512){FS.rmdir(path);}else{abort("Invalid flags passed to unlinkat");}return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_stat64=function _syscall_stat(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.stat(path));}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_rmdir=function _syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_renameat=function _syscall_renameat(olddirfd,oldpath,newdirfd,newpath){try{oldpath=SYSCALLS.getStr(oldpath);newpath=SYSCALLS.getStr(newpath);oldpath=SYSCALLS.calculateAt(olddirfd,oldpath);newpath=SYSCALLS.calculateAt(newdirfd,newpath);FS.rename(oldpath,newpath);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_openat=function _syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;return FS.open(path,flags,mode).fd;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_ioctl=function _syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0;}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0;}return 0;}return 0;}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0;}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17]);}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag:c_iflag,c_oflag:c_oflag,c_cflag:c_cflag,c_lflag:c_lflag,c_cc:c_cc});}return 0;}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0;}case 21520:{if(!stream.tty)return-59;return-28;}case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp);}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1];}return 0;}case 21524:{if(!stream.tty)return-59;return 0;}case 21515:{if(!stream.tty)return-59;return 0;}default:return-28;}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_fcntl64=function _syscall_fcntl(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28;}while(FS.streams[arg]){arg++;}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd;}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();stream.flags|=arg;return 0;}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0;}case 13:case 14:return 0;}return-28;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};_createWasm=function _createWasm3(){_createWasm=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(){var _wasmBinaryFile;var receiveInstance,receiveInstantiationResult,info,result,exports;return _regeneratorRuntime().wrap(function _callee13$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:receiveInstantiationResult=function _receiveInstantiation(result2){return receiveInstance(result2["instance"]);};receiveInstance=function _receiveInstance(instance,module){wasmExports=instance.exports;wasmExports=Asyncify.instrumentWasmExports(wasmExports);wasmMemory=wasmExports["U"];updateMemoryViews();wasmExports["X"];removeRunDependency();return wasmExports;};addRunDependency();info=getWasmImports();if(!Module["instantiateWasm"]){_context17.next=6;break;}return _context17.abrupt("return",new Promise(function(resolve,reject){Module["instantiateWasm"](info,function(mod,inst){receiveInstance(mod);resolve(mod.exports);});}));case 6:(_wasmBinaryFile=wasmBinaryFile)!==null&&_wasmBinaryFile!==void 0?_wasmBinaryFile:wasmBinaryFile=findWasmBinary();_context17.prev=7;_context17.next=10;return instantiateAsync(wasmBinary,wasmBinaryFile,info);case 10:result=_context17.sent;exports=receiveInstantiationResult(result);return _context17.abrupt("return",exports);case 15:_context17.prev=15;_context17.t0=_context17["catch"](7);readyPromiseReject(_context17.t0);return _context17.abrupt("return",Promise.reject(_context17.t0));case 19:case"end":return _context17.stop();}}},_callee13,null,[[7,15]]);}));return _createWasm.apply(this,arguments);};createWasm=function _createWasm2(){return _createWasm.apply(this,arguments);};getWasmImports=function _getWasmImports(){return{a:wasmImports};};_instantiateAsync=function _instantiateAsync3(){_instantiateAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(binary,binaryFile,imports){var response,instantiationResult;return _regeneratorRuntime().wrap(function _callee12$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:if(!(!binary&&typeof WebAssembly.instantiateStreaming=="function")){_context16.next=13;break;}_context16.prev=1;response=fetch(binaryFile,{credentials:"same-origin"});_context16.next=5;return WebAssembly.instantiateStreaming(response,imports);case 5:instantiationResult=_context16.sent;return _context16.abrupt("return",instantiationResult);case 9:_context16.prev=9;_context16.t0=_context16["catch"](1);err("wasm streaming compile failed: ".concat(_context16.t0));err("falling back to ArrayBuffer instantiation");case 13:return _context16.abrupt("return",instantiateArrayBuffer(binaryFile,imports));case 14:case"end":return _context16.stop();}}},_callee12,null,[[1,9]]);}));return _instantiateAsync.apply(this,arguments);};instantiateAsync=function _instantiateAsync2(_x122,_x123,_x124){return _instantiateAsync.apply(this,arguments);};_instantiateArrayBuffer=function _instantiateArrayBuff2(){_instantiateArrayBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(binaryFile,imports){var binary,instance;return _regeneratorRuntime().wrap(function _callee11$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:_context15.prev=0;_context15.next=3;return getWasmBinary(binaryFile);case 3:binary=_context15.sent;_context15.next=6;return WebAssembly.instantiate(binary,imports);case 6:instance=_context15.sent;return _context15.abrupt("return",instance);case 10:_context15.prev=10;_context15.t0=_context15["catch"](0);err("failed to asynchronously prepare wasm: ".concat(_context15.t0));abort(_context15.t0);case 14:case"end":return _context15.stop();}}},_callee11,null,[[0,10]]);}));return _instantiateArrayBuffer.apply(this,arguments);};instantiateArrayBuffer=function _instantiateArrayBuff(_x120,_x121){return _instantiateArrayBuffer.apply(this,arguments);};_getWasmBinary=function _getWasmBinary3(){_getWasmBinary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(binaryFile){var response;return _regeneratorRuntime().wrap(function _callee10$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:if(wasmBinary){_context14.next=10;break;}_context14.prev=1;_context14.next=4;return readAsync(binaryFile);case 4:response=_context14.sent;return _context14.abrupt("return",new Uint8Array(response));case 8:_context14.prev=8;_context14.t0=_context14["catch"](1);case 10:return _context14.abrupt("return",getBinarySync(binaryFile));case 11:case"end":return _context14.stop();}}},_callee10,null,[[1,8]]);}));return _getWasmBinary.apply(this,arguments);};getWasmBinary=function _getWasmBinary2(_x119){return _getWasmBinary.apply(this,arguments);};getBinarySync=function _getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary);}throw"both async and sync fetching of the wasm failed";};findWasmBinary=function _findWasmBinary(){if(Module["locateFile"]){return locateFile("ifcdb.wasm");}return new URL("ifcdb.wasm",import.meta.url).href;};abort=function _abort2(what){var _Module$onAbort;(_Module$onAbort=Module["onAbort"])===null||_Module$onAbort===void 0?void 0:_Module$onAbort.call(Module,what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e;};removeRunDependency=function _removeRunDependency(id){var _Module$monitorRunDep2;runDependencies--;(_Module$monitorRunDep2=Module["monitorRunDependencies"])===null||_Module$monitorRunDep2===void 0?void 0:_Module$monitorRunDep2.call(Module,runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback();}}};addRunDependency=function _addRunDependency(id){var _Module$monitorRunDep;runDependencies++;(_Module$monitorRunDep=Module["monitorRunDependencies"])===null||_Module$monitorRunDep===void 0?void 0:_Module$monitorRunDep.call(Module,runDependencies);};postRun=function _postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift());}}callRuntimeCallbacks(onPostRuns);};initRuntime=function _initRuntime(){if(!Module["noFSInit"]&&!FS.initialized)FS.init();wasmExports["V"]();FS.ignorePermissions=false;};preRun=function _preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift());}}callRuntimeCallbacks(onPreRuns);};updateMemoryViews=function _updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b);Module["HEAP64"]=HEAP64=new BigInt64Array(b);Module["HEAPU64"]=HEAPU64=new BigUint64Array(b);};locateFile=function _locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory);}return scriptDirectory+path;};moduleArg=_args17.length>0&&_args17[0]!==undefined?_args17[0]:{};Module=moduleArg;readyPromise=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject;});moduleOverrides=Object.assign({},Module);arguments_=[];thisProgram="./this.program";quit_=function quit_(status,toThrow){throw toThrow;};scriptDirectory="";if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src;}if(_scriptName){scriptDirectory=_scriptName;}if(scriptDirectory.startsWith("blob:")){scriptDirectory="";}else{scriptDirectory=scriptDirectory.slice(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1);}readAsync=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(url){var response;return _regeneratorRuntime().wrap(function _callee8$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:_context12.next=2;return fetch(url,{credentials:"same-origin"});case 2:response=_context12.sent;if(!response.ok){_context12.next=5;break;}return _context12.abrupt("return",response.arrayBuffer());case 5:throw new Error(response.status+" : "+response.url);case 6:case"end":return _context12.stop();}}},_callee8);}));return function readAsync(_x118){return _ref26.apply(this,arguments);};}();out=Module["print"]||console.log.bind(console);err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];wasmBinary=Module["wasmBinary"];ABORT=false;runDependencies=0;dependenciesFulfilled=null;ASM_CONSTS={191520:function _(){console.error("progress callback is not set.");}};ExitStatus=/*#__PURE__*/_createClass(function ExitStatus(status){_classCallCheck(this,ExitStatus);__publicField$2(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(status,")");this.status=status;});callRuntimeCallbacks=function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module);}};onPostRuns=[];addOnPostRun=function addOnPostRun(cb){return onPostRuns.unshift(cb);};onPreRuns=[];addOnPreRun=function addOnPreRun(cb){return onPreRuns.unshift(cb);};noExitRuntime=Module["noExitRuntime"]||true;ExceptionInfo=/*#__PURE__*/function(){function ExceptionInfo(excPtr){_classCallCheck(this,ExceptionInfo);this.excPtr=excPtr;this.ptr=excPtr-24;}_createClass(ExceptionInfo,[{key:"set_type",value:function set_type(type){HEAPU32[this.ptr+4>>2]=type;}},{key:"get_type",value:function get_type(){return HEAPU32[this.ptr+4>>2];}},{key:"set_destructor",value:function set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor;}},{key:"get_destructor",value:function get_destructor(){return HEAPU32[this.ptr+8>>2];}},{key:"set_caught",value:function set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught;}},{key:"get_caught",value:function get_caught(){return HEAP8[this.ptr+12]!=0;}},{key:"set_rethrown",value:function set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown;}},{key:"get_rethrown",value:function get_rethrown(){return HEAP8[this.ptr+13]!=0;}},{key:"init",value:function init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);}},{key:"set_adjusted_ptr",value:function set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr;}},{key:"get_adjusted_ptr",value:function get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2];}}]);return ExceptionInfo;}();exceptionLast=0;___cxa_throw=function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;throw exceptionLast;};syscallGetVarargI=function syscallGetVarargI(){var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret;};syscallGetVarargP=syscallGetVarargI;PATH={isAbs:function isAbs(path){return path.charAt(0)==="/";},splitPath:function splitPath(filename){var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1);},normalizeArray:function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1);}else if(last===".."){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}}if(allowAboveRoot){for(;up;up--){parts.unshift("..");}}return parts;},normalize:function normalize(path){var isAbsolute=PATH.isAbs(path),trailingSlash=path.slice(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(function(p){return!!p;}),!isAbsolute).join("/");if(!path&&!isAbsolute){path=".";}if(path&&trailingSlash){path+="/";}return(isAbsolute?"/":"")+path;},dirname:function dirname(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return".";}if(dir){dir=dir.slice(0,-1);}return root+dir;},basename:function basename(path){return path&&path.match(/([^\/]+|\/)\/*$/)[1];},join:function join(){for(var _len126=arguments.length,paths=new Array(_len126),_key16=0;_key16<_len126;_key16++){paths[_key16]=arguments[_key16];}return PATH.normalize(paths.join("/"));},join2:function join2(l,r){return PATH.normalize(l+"/"+r);}};initRandomFill=function initRandomFill(){return function(view){return crypto.getRandomValues(view);};};_randomFill=function randomFill(view){(_randomFill=initRandomFill())(view);};PATH_FS={resolve:function resolve(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?i<0||arguments.length<=i?undefined:arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings");}else if(!path){return"";}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path);}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(function(p){return!!p;}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||".";},relative:function relative(from,to){from=PATH_FS.resolve(from).slice(1);to=PATH_FS.resolve(to).slice(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break;}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break;}if(start>end)return[];return arr.slice(start,end-start+1);}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break;}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..");}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/");}};UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder():void 0;UTF8ArrayToString=function UTF8ArrayToString(heapOrArray){var idx=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var maxBytesToRead=arguments.length>2&&arguments[2]!==undefined?arguments[2]:NaN;var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx)){++endPtr;}if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr));}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue;}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue;}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2;}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63;}if(u0<65536){str+=String.fromCharCode(u0);}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023);}}return str;};FS_stdin_getChar_buffer=[];lengthBytesUTF8=function lengthBytesUTF8(str){var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++;}else if(c<=2047){len+=2;}else if(c>=55296&&c<=57343){len+=4;++i;}else{len+=3;}}return len;};stringToUTF8Array=function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023;}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u;}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63;}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;}}heap[outIdx]=0;return outIdx-startIdx;};intArrayFromString=function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array;};FS_stdin_getChar=function FS_stdin_getChar(){if(!FS_stdin_getChar_buffer.length){var result=null;if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n";}}if(!result){return null;}FS_stdin_getChar_buffer=intArrayFromString(result,true);}return FS_stdin_getChar_buffer.shift();};TTY={ttys:[],init:function init(){},shutdown:function shutdown(){},register:function register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops);},stream_ops:{open:function open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43);}stream.tty=tty;stream.seekable=false;},close:function close(stream){stream.tty.ops.fsync(stream.tty);},fsync:function fsync(stream){stream.tty.ops.fsync(stream.tty);},read:function read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60);}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty);}catch(e){throw new FS.ErrnoError(29);}if(result===void 0&&bytesRead===0){throw new FS.ErrnoError(6);}if(result===null||result===void 0)break;bytesRead++;buffer[offset+i]=result;}if(bytesRead){stream.node.atime=Date.now();}return bytesRead;},write:function write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60);}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i]);}}catch(e){throw new FS.ErrnoError(29);}if(length){stream.node.mtime=stream.node.ctime=Date.now();}return i;}},default_tty_ops:{get_char:function get_char(tty){return FS_stdin_getChar();},put_char:function put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output));tty.output=[];}else{if(val!=0)tty.output.push(val);}},fsync:function fsync(tty){var _tty$output;if(((_tty$output=tty.output)===null||_tty$output===void 0?void 0:_tty$output.length)>0){out(UTF8ArrayToString(tty.output));tty.output=[];}},ioctl_tcgets:function ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};},ioctl_tcsets:function ioctl_tcsets(tty,optional_actions,data){return 0;},ioctl_tiocgwinsz:function ioctl_tiocgwinsz(tty){return[24,80];}},default_tty1_ops:{put_char:function put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[];}else{if(val!=0)tty.output.push(val);}},fsync:function fsync(tty){var _tty$output2;if(((_tty$output2=tty.output)===null||_tty$output2===void 0?void 0:_tty$output2.length)>0){err(UTF8ArrayToString(tty.output));tty.output=[];}}}};alignMemory=function alignMemory(size,alignment){return Math.ceil(size/alignment)*alignment;};mmapAlloc=function mmapAlloc(size){abort();};MEMFS={ops_table:null,mount:function mount(_mount){return MEMFS.createNode(null,"/",16895,0);},createNode:function createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63);}MEMFS.ops_table||(MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}});var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={};}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null;}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream;}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream;}node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime;}return node;},getFileDataAsTypedArray:function getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents);},expandFileStorage:function expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);},resizeFileStorage:function resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0;}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)));}node.usedBytes=newSize;}},node_ops:{getattr:function getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096;}else if(FS.isFile(node.mode)){attr.size=node.usedBytes;}else if(FS.isLink(node.mode)){attr.size=node.link.length;}else{attr.size=0;}attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr;},setattr:function setattr(node,attr){for(var _i656=0,_arr3=["mode","atime","mtime","ctime"];_i656<_arr3.length;_i656++){var key=_arr3[_i656];if(attr[key]!=null){node[key]=attr[key];}}if(attr.size!==void 0){MEMFS.resizeFileStorage(node,attr.size);}},lookup:function lookup(parent,name){throw MEMFS.doesNotExistError;},mknod:function mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev);},rename:function rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name);}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55);}}FS.hashRemoveNode(new_node);}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now();},unlink:function unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now();},rmdir:function rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55);}delete parent.contents[name];parent.ctime=parent.mtime=Date.now();},readdir:function readdir(node){return[".",".."].concat(_toConsumableArray(Object.keys(node.contents)));},symlink:function symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node;},readlink:function readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28);}return node.link;}},stream_ops:{read:function read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset);}else{for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i];}}return size;},write:function write(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer){canOwn=false;}if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length;}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length;}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length;}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position);}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i];}}node.usedBytes=Math.max(node.usedBytes,position+length);return length;},llseek:function llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position;}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes;}}if(position<0){throw new FS.ErrnoError(28);}return position;},allocate:function allocate(stream,offset,length){MEMFS.expandFileStorage(stream.node,offset+length);stream.node.usedBytes=Math.max(stream.node.usedBytes,offset+length);},mmap:function mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43);}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset;}else{allocated=true;ptr=mmapAlloc();if(!ptr){throw new FS.ErrnoError(48);}if(contents){if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length);}else{contents=Array.prototype.slice.call(contents,position,position+length);}}HEAP8.set(contents,ptr);}}return{ptr:ptr,allocated:allocated};},msync:function msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0;}}};asyncLoad=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url){var arrayBuffer;return _regeneratorRuntime().wrap(function _callee9$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:_context13.next=2;return readAsync(url);case 2:arrayBuffer=_context13.sent;return _context13.abrupt("return",new Uint8Array(arrayBuffer));case 4:case"end":return _context13.stop();}}},_callee9);}));return function asyncLoad(_x125){return _ref27.apply(this,arguments);};}();asyncLoad.isAsync=true;FS_createDataFile=function FS_createDataFile(parent,name,fileData,canRead,canWrite,canOwn){FS.createDataFile(parent,name,fileData,canRead,canWrite,canOwn);};preloadPlugins=Module["preloadPlugins"]||[];FS_handledByPreloadPlugin=function FS_handledByPreloadPlugin(byteArray,fullname,finish,onerror){if(typeof Browser!="undefined")Browser.init();var handled=false;preloadPlugins.forEach(function(plugin){if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true;}});return handled;};FS_createPreloadedFile=function FS_createPreloadedFile(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish){var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;function processData(byteArray){function finish(byteArray2){preFinish===null||preFinish===void 0?void 0:preFinish();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray2,canRead,canWrite,canOwn);}onload===null||onload===void 0?void 0:onload();removeRunDependency();}if(FS_handledByPreloadPlugin(byteArray,fullname,finish,function(){onerror===null||onerror===void 0?void 0:onerror();removeRunDependency();})){return;}finish(byteArray);}addRunDependency();if(typeof url=="string"){asyncLoad(url).then(processData,onerror);}else{processData(url);}};FS_modeStringToFlags=function FS_modeStringToFlags(str){var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: ".concat(str));}return flags;};FS_getMode=function FS_getMode(canRead,canWrite){var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode;};FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:/*#__PURE__*/_createClass(function ErrnoError(errno){_classCallCheck(this,ErrnoError);__publicField$2(this,"name","ErrnoError");this.errno=errno;}),filesystems:null,syncFSRequests:0,readFiles:{},FSStream:/*#__PURE__*/function(){function FSStream(){_classCallCheck(this,FSStream);__publicField$2(this,"shared",{});}_createClass(FSStream,[{key:"object",get:function get(){return this.node;},set:function set(val){this.node=val;}},{key:"isRead",get:function get(){return(this.flags&2097155)!==1;}},{key:"isWrite",get:function get(){return(this.flags&2097155)!==0;}},{key:"isAppend",get:function get(){return this.flags&1024;}},{key:"flags",get:function get(){return this.shared.flags;},set:function set(val){this.shared.flags=val;}},{key:"position",get:function get(){return this.shared.position;},set:function set(val){this.shared.position=val;}}]);return FSStream;}(),FSNode:/*#__PURE__*/function(){function FSNode(parent,name,mode,rdev){_classCallCheck(this,FSNode);__publicField$2(this,"node_ops",{});__publicField$2(this,"stream_ops",{});__publicField$2(this,"readMode",292|73);__publicField$2(this,"writeMode",146);__publicField$2(this,"mounted",null);if(!parent){parent=this;}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now();}_createClass(FSNode,[{key:"read",get:function get(){return(this.mode&this.readMode)===this.readMode;},set:function set(val){val?this.mode|=this.readMode:this.mode&=~this.readMode;}},{key:"write",get:function get(){return(this.mode&this.writeMode)===this.writeMode;},set:function set(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode;}},{key:"isFolder",get:function get(){return FS.isDir(this.mode);}},{key:"isDevice",get:function get(){return FS.isChrdev(this.mode);}}]);return FSNode;}(),lookupPath:function lookupPath(path){var _opts$follow_mount;var opts=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!path){throw new FS.ErrnoError(44);}(_opts$follow_mount=opts.follow_mount)!==null&&_opts$follow_mount!==void 0?_opts$follow_mount:opts.follow_mount=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path;}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(function(p){return!!p;});var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break;}if(parts[i]==="."){continue;}if(parts[i]===".."){current_path=PATH.dirname(current_path);current=current.parent;continue;}current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i]);}catch(e){if((e===null||e===void 0?void 0:e.errno)===44&&islast&&opts.noent_okay){return{path:current_path};}throw e;}if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root;}if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52);}var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+"/"+link;}path=link+"/"+parts.slice(i+1).join("/");continue linkloop;}}return{path:current_path,node:current};}throw new FS.ErrnoError(32);},getPath:function getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?"".concat(mount,"/").concat(path):mount+path;}path=path?"".concat(node.name,"/").concat(path):node.name;node=node.parent;}},hashName:function hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0;}return(parentid+hash>>>0)%FS.nameTable.length;},hashAddNode:function hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node;},hashRemoveNode:function hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next;}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break;}current=current.name_next;}}},lookupNode:function lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode);}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node;}}return FS.lookup(parent,name);},createNode:function createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node;},destroyNode:function destroyNode(node){FS.hashRemoveNode(node);},isRoot:function isRoot(node){return node===node.parent;},isMountpoint:function isMountpoint(node){return!!node.mounted;},isFile:function isFile(mode){return(mode&61440)===32768;},isDir:function isDir(mode){return(mode&61440)===16384;},isLink:function isLink(mode){return(mode&61440)===40960;},isChrdev:function isChrdev(mode){return(mode&61440)===8192;},isBlkdev:function isBlkdev(mode){return(mode&61440)===24576;},isFIFO:function isFIFO(mode){return(mode&61440)===4096;},isSocket:function isSocket(mode){return(mode&49152)===49152;},flagsToPermissionString:function flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w";}return perms;},nodePermissions:function nodePermissions(node,perms){if(FS.ignorePermissions){return 0;}if(perms.includes("r")&&!(node.mode&292)){return 2;}else if(perms.includes("w")&&!(node.mode&146)){return 2;}else if(perms.includes("x")&&!(node.mode&73)){return 2;}return 0;},mayLookup:function mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0;},mayCreate:function mayCreate(dir,name){if(!FS.isDir(dir.mode)){return 54;}try{var node=FS.lookupNode(dir,name);return 20;}catch(e){}return FS.nodePermissions(dir,"wx");},mayDelete:function mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name);}catch(e){return e.errno;}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode;}if(isdir){if(!FS.isDir(node.mode)){return 54;}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10;}}else{if(FS.isDir(node.mode)){return 31;}}return 0;},mayOpen:function mayOpen(node,flags){if(!node){return 44;}if(FS.isLink(node.mode)){return 32;}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&(512|64)){return 31;}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags));},checkOpExists:function checkOpExists(op,err2){if(!op){throw new FS.ErrnoError(err2);}return op;},MAX_OPEN_FDS:4096,nextfd:function nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd;}}throw new FS.ErrnoError(33);},getStreamChecked:function getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8);}return stream;},getStream:function getStream(fd){return FS.streams[fd];},createStream:function createStream(stream){var fd=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;stream=Object.assign(new FS.FSStream(),stream);if(fd==-1){fd=FS.nextfd();}stream.fd=fd;FS.streams[fd]=stream;return stream;},closeStream:function closeStream(fd){FS.streams[fd]=null;},dupStream:function dupStream(origStream){var _stream$stream_ops,_stream$stream_ops$du;var fd=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var stream=FS.createStream(origStream,fd);(_stream$stream_ops=stream.stream_ops)===null||_stream$stream_ops===void 0?void 0:(_stream$stream_ops$du=_stream$stream_ops.dup)===null||_stream$stream_ops$du===void 0?void 0:_stream$stream_ops$du.call(_stream$stream_ops,stream);return stream;},doSetAttr:function doSetAttr(stream,node,attr){var _setattr;var setattr=stream===null||stream===void 0?void 0:stream.stream_ops.setattr;var arg=setattr?stream:node;(_setattr=setattr)!==null&&_setattr!==void 0?_setattr:setattr=node.node_ops.setattr;FS.checkOpExists(setattr,63);setattr(arg,attr);},chrdev_stream_ops:{open:function open(stream){var _stream$stream_ops$op,_stream$stream_ops2;var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;(_stream$stream_ops$op=(_stream$stream_ops2=stream.stream_ops).open)===null||_stream$stream_ops$op===void 0?void 0:_stream$stream_ops$op.call(_stream$stream_ops2,stream);},llseek:function llseek(){throw new FS.ErrnoError(70);}},major:function major(dev){return dev>>8;},minor:function minor(dev){return dev&255;},makedev:function makedev(ma,mi){return ma<<8|mi;},registerDevice:function registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops};},getDevice:function getDevice(dev){return FS.devices[dev];},getMounts:function getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,_toConsumableArray(m.mounts));}return mounts;},syncfs:function syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false;}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: ".concat(FS.syncFSRequests," FS.syncfs operations in flight at once, probably just doing extra work"));}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode);}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode);}return;}if(++completed>=mounts.length){doCallback(null);}}mounts.forEach(function(mount){if(!mount.type.syncfs){return done(null);}mount.type.syncfs(mount,populate,done);});},mount:function mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10);}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54);}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot;}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount);}}return mountRoot;},unmount:function unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28);}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current);}current=next;}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1);},lookup:function lookup(parent,name){return parent.node_ops.lookup(parent,name);},mknod:function mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name){throw new FS.ErrnoError(28);}if(name==="."||name===".."){throw new FS.ErrnoError(20);}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63);}return parent.node_ops.mknod(parent,name,mode,dev);},statfs:function statfs(path){return FS.statfsNode(FS.lookupPath(path,{follow:true}).node);},statfsStream:function statfsStream(stream){return FS.statfsNode(stream.node);},statfsNode:function statfsNode(node){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};if(node.node_ops.statfs){Object.assign(rtn,node.node_ops.statfs(node.mount.opts.root));}return rtn;},create:function create(path){var mode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0);},mkdir:function mkdir(path){var mode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0);},mkdirTree:function mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var i=0;i<dirs.length;++i){if(!dirs[i])continue;d+="/"+dirs[i];try{FS.mkdir(d,mode);}catch(e){if(e.errno!=20)throw e;}}},mkdev:function mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438;}mode|=8192;return FS.mknod(path,mode,dev);},symlink:function symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44);}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44);}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63);}return parent.node_ops.symlink(parent,newname,oldpath);},rename:function rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75);}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28);}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55);}var new_node;try{new_node=FS.lookupNode(new_dir,new_name);}catch(e){}if(old_node===new_node){return;}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode);}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode);}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63);}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10);}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode);}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir;}catch(e){throw e;}finally{FS.hashAddNode(old_node);}},rmdir:function rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63);}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}parent.node_ops.rmdir(parent,name);FS.destroyNode(node);},readdir:function readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var readdir=FS.checkOpExists(node.node_ops.readdir,54);return readdir(node);},unlink:function unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44);}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63);}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}parent.node_ops.unlink(parent,name);FS.destroyNode(node);},readlink:function readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44);}if(!link.node_ops.readlink){throw new FS.ErrnoError(28);}return link.node_ops.readlink(link);},stat:function stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;var getattr=FS.checkOpExists(node.node_ops.getattr,63);return getattr(node);},fstat:function fstat(fd){var _getattr;var stream=FS.getStreamChecked(fd);var node=stream.node;var getattr=stream.stream_ops.getattr;var arg=getattr?stream:node;(_getattr=getattr)!==null&&_getattr!==void 0?_getattr:getattr=node.node_ops.getattr;FS.checkOpExists(getattr,63);return getattr(arg);},lstat:function lstat(path){return FS.stat(path,true);},doChmod:function doChmod(stream,node,mode,dontFollow){FS.doSetAttr(stream,node,{mode:mode&4095|node.mode&~4095,ctime:Date.now(),dontFollow:dontFollow});},chmod:function chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node;}else{node=path;}FS.doChmod(null,node,mode,dontFollow);},lchmod:function lchmod(path,mode){FS.chmod(path,mode,true);},fchmod:function fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.doChmod(stream,stream.node,mode,false);},doChown:function doChown(stream,node,dontFollow){FS.doSetAttr(stream,node,{timestamp:Date.now(),dontFollow:dontFollow});},chown:function chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node;}else{node=path;}FS.doChown(null,node,dontFollow);},lchown:function lchown(path,uid,gid){FS.chown(path,uid,gid,true);},fchown:function fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.doChown(stream,stream.node,false);},doTruncate:function doTruncate(stream,node,len){if(FS.isDir(node.mode)){throw new FS.ErrnoError(31);}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28);}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode);}FS.doSetAttr(stream,node,{size:len,timestamp:Date.now()});},truncate:function truncate(path,len){if(len<0){throw new FS.ErrnoError(28);}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node;}else{node=path;}FS.doTruncate(null,node,len);},ftruncate:function ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if(len<0||(stream.flags&2097155)===0){throw new FS.ErrnoError(28);}FS.doTruncate(stream,stream.node,len);},utime:function utime(path,atime,mtime){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var setattr=FS.checkOpExists(node.node_ops.setattr,63);setattr(node,{atime:atime,mtime:mtime});},open:function open(path,flags){var mode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:438;if(path===""){throw new FS.ErrnoError(44);}flags=typeof flags=="string"?FS_modeStringToFlags(flags):flags;if(flags&64){mode=mode&4095|32768;}else{mode=0;}var node;var isDirPath;if(_typeof(path)=="object"){node=path;}else{isDirPath=path.endsWith("/");var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path;}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20);}}else if(isDirPath){throw new FS.ErrnoError(31);}else{node=FS.mknod(path,mode|511,0);created=true;}}if(!node){throw new FS.ErrnoError(44);}if(FS.isChrdev(node.mode)){flags&=~512;}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54);}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode);}}if(flags&512&&!created){FS.truncate(node,0);}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream);}if(created){FS.chmod(node,mode&511);}if(Module["logReadFiles"]&&!(flags&1)){if(!(path in FS.readFiles)){FS.readFiles[path]=1;}}return stream;},close:function close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream);}}catch(e){throw e;}finally{FS.closeStream(stream.fd);}stream.fd=null;},isClosed:function isClosed(stream){return stream.fd===null;},llseek:function llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70);}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28);}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position;},read:function read(stream,buffer,offset,length,position){if(length<0||position<0){throw new FS.ErrnoError(28);}if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8);}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31);}if(!stream.stream_ops.read){throw new FS.ErrnoError(28);}var seeking=typeof position!="undefined";if(!seeking){position=stream.position;}else if(!stream.seekable){throw new FS.ErrnoError(70);}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead;},write:function write(stream,buffer,offset,length,position,canOwn){if(length<0||position<0){throw new FS.ErrnoError(28);}if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8);}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31);}if(!stream.stream_ops.write){throw new FS.ErrnoError(28);}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2);}var seeking=typeof position!="undefined";if(!seeking){position=stream.position;}else if(!stream.seekable){throw new FS.ErrnoError(70);}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten;},allocate:function allocate(stream,offset,length){if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if(offset<0||length<=0){throw new FS.ErrnoError(28);}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8);}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43);}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138);}stream.stream_ops.allocate(stream,offset,length);},mmap:function mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2);}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2);}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43);}if(!length){throw new FS.ErrnoError(28);}return stream.stream_ops.mmap(stream,length,position,prot,flags);},msync:function msync(stream,buffer,offset,length,mmapFlags){if(!stream.stream_ops.msync){return 0;}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags);},ioctl:function ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59);}return stream.stream_ops.ioctl(stream,cmd,arg);},readFile:function readFile(path){var opts=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error("Invalid encoding type \"".concat(opts.encoding,"\""));}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf);}else if(opts.encoding==="binary"){ret=buf;}FS.close(stream);return ret;},writeFile:function writeFile(path,data){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,void 0,opts.canOwn);}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,void 0,opts.canOwn);}else{throw new Error("Unsupported data type");}FS.close(stream);},cwd:function cwd(){return FS.currentPath;},chdir:function chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44);}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54);}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode);}FS.currentPath=lookup.path;},createDefaultDirectories:function createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user");},createDefaultDevices:function createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:function read(){return 0;},write:function write(stream,buffer,offset,length,pos){return length;},llseek:function llseek(){return 0;}});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=function randomByte(){if(randomLeft===0){_randomFill(randomBuffer);randomLeft=randomBuffer.byteLength;}return randomBuffer[--randomLeft];};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp");},createSpecialDirectories:function createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:function mount(){var node=FS.createNode(proc_self,"fd",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};node.node_ops={lookup:function lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function readlink(){return stream.path;}},id:fd+1};ret.parent=ret;return ret;},readdir:function readdir(){return Array.from(FS.streams.entries()).filter(function(_ref28){var _ref29=_slicedToArray(_ref28,2),k=_ref29[0],v=_ref29[1];return v;}).map(function(_ref30){var _ref31=_slicedToArray(_ref30,2),k=_ref31[0],v=_ref31[1];return k.toString();});}};return node;}},{},"/proc/self/fd");},createStandardStreams:function createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input);}else{FS.symlink("/dev/tty","/dev/stdin");}if(output){FS.createDevice("/dev","stdout",null,output);}else{FS.symlink("/dev/tty","/dev/stdout");}if(error){FS.createDevice("/dev","stderr",null,error);}else{FS.symlink("/dev/tty1","/dev/stderr");}FS.open("/dev/stdin",0);FS.open("/dev/stdout",1);FS.open("/dev/stderr",1);},staticInit:function staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS:MEMFS};},init:function init(input,output,error){var _input,_output,_error2;FS.initialized=true;(_input=input)!==null&&_input!==void 0?_input:input=Module["stdin"];(_output=output)!==null&&_output!==void 0?_output:output=Module["stdout"];(_error2=error)!==null&&_error2!==void 0?_error2:error=Module["stderr"];FS.createStandardStreams(input,output,error);},quit:function quit(){FS.initialized=false;for(var i=0;i<FS.streams.length;i++){var stream=FS.streams[i];if(!stream){continue;}FS.close(stream);}},findObject:function findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null;}return ret.object;},analyzePath:function analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path;}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/";}catch(e){ret.error=e.errno;}return ret;},createPath:function createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current);}catch(e){}parent=current;}return current;},createFile:function createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode);},createDataFile:function createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent;}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i<len;++i){arr[i]=data.charCodeAt(i);}data=arr;}FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode);}},createDevice:function createDevice(parent,name,input,output){var _a$major;var _a;var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);(_a$major=(_a=FS.createDevice).major)!==null&&_a$major!==void 0?_a$major:_a.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:function open(stream){stream.seekable=false;},close:function close(stream){var _output$buffer;if(output!==null&&output!==void 0&&(_output$buffer=output.buffer)!==null&&_output$buffer!==void 0&&_output$buffer.length){output(10);}},read:function read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input();}catch(e){throw new FS.ErrnoError(29);}if(result===void 0&&bytesRead===0){throw new FS.ErrnoError(6);}if(result===null||result===void 0)break;bytesRead++;buffer[offset+i]=result;}if(bytesRead){stream.node.atime=Date.now();}return bytesRead;},write:function write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i]);}catch(e){throw new FS.ErrnoError(29);}}if(length){stream.node.mtime=stream.node.ctime=Date.now();}return i;}});return FS.mkdev(path,mode,dev);},forceLoadFile:function forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");}else{try{obj.contents=readBinary(obj.url);obj.usedBytes=obj.contents.length;}catch(e){throw new FS.ErrnoError(29);}}},createLazyFile:function createLazyFile(parent,name,url,canRead,canWrite){var LazyUint8Array=/*#__PURE__*/function(){function LazyUint8Array(){_classCallCheck(this,LazyUint8Array);__publicField$2(this,"lengthKnown",false);__publicField$2(this,"chunks",[]);}_createClass(LazyUint8Array,[{key:"get",value:function get(idx){if(idx>this.length-1||idx<0){return void 0;}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset];}},{key:"setDataGetter",value:function setDataGetter(getter){this.getter=getter;}},{key:"cacheLength",value:function cacheLength(){var xhr=new XMLHttpRequest();xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=function doXHR(from,to){if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr2=new XMLHttpRequest();xhr2.open("GET",url,false);if(datalength!==chunkSize)xhr2.setRequestHeader("Range","bytes="+from+"-"+to);xhr2.responseType="arraybuffer";if(xhr2.overrideMimeType){xhr2.overrideMimeType("text/plain; charset=x-user-defined");}xhr2.send(null);if(!(xhr2.status>=200&&xhr2.status<300||xhr2.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr2.status);if(xhr2.response!==void 0){return new Uint8Array(xhr2.response||[]);}return intArrayFromString(xhr2.responseText||"",true);};var lazyArray2=this;lazyArray2.setDataGetter(function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray2.chunks[chunkNum]=="undefined"){lazyArray2.chunks[chunkNum]=doXHR(start,end);}if(typeof lazyArray2.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray2.chunks[chunkNum];});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed");}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true;}},{key:"length",get:function get(){if(!this.lengthKnown){this.cacheLength();}return this._length;}},{key:"chunkSize",get:function get(){if(!this.lengthKnown){this.cacheLength();}return this._chunkSize;}}]);return LazyUint8Array;}();if(typeof XMLHttpRequest!="undefined"){throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array();var properties={isDevice:false,contents:lazyArray};}else{var properties={isDevice:false,url:url};}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents;}else if(properties.url){node.contents=null;node.url=properties.url;}Object.defineProperties(node,{usedBytes:{get:function get(){return this.contents.length;}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(function(key){var fn=node.stream_ops[key];stream_ops[key]=function(){FS.forceLoadFile(node);return fn.apply(void 0,arguments);};});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i];}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i);}}return size;}stream_ops.read=function(stream,buffer,offset,length,position){FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position);};stream_ops.mmap=function(stream,length,position,prot,flags){FS.forceLoadFile(node);var ptr=mmapAlloc();if(!ptr){throw new FS.ErrnoError(48);}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true};};node.stream_ops=stream_ops;return node;}};UTF8ToString=function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";};SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path;}var dir;if(dirfd===-100){dir=FS.cwd();}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path;}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44);}return dir;}return dir+"/"+path;},writeStat:function writeStat(buf,stat){HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAP32[buf+12>>2]=stat.uid;HEAP32[buf+16>>2]=stat.gid;HEAP32[buf+20>>2]=stat.rdev;HEAP64[buf+24>>3]=BigInt(stat.size);HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();HEAP64[buf+40>>3]=BigInt(Math.floor(atime/1e3));HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;HEAP64[buf+56>>3]=BigInt(Math.floor(mtime/1e3));HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;HEAP64[buf+72>>3]=BigInt(Math.floor(ctime/1e3));HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;HEAP64[buf+88>>3]=BigInt(stat.ino);return 0;},writeStatFs:function writeStatFs(buf,stats){HEAP32[buf+4>>2]=stats.bsize;HEAP32[buf+40>>2]=stats.bsize;HEAP32[buf+8>>2]=stats.blocks;HEAP32[buf+12>>2]=stats.bfree;HEAP32[buf+16>>2]=stats.bavail;HEAP32[buf+20>>2]=stats.files;HEAP32[buf+24>>2]=stats.ffree;HEAP32[buf+28>>2]=stats.fsid;HEAP32[buf+44>>2]=stats.flags;HEAP32[buf+36>>2]=stats.namelen;},doMsync:function doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43);}if(flags&2){return 0;}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags);},getStreamFromFD:function getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream;},varargs:void 0,getStr:function getStr(ptr){var ret=UTF8ToString(ptr);return ret;}};__abort_js=function __abort_js(){return abort("");};structRegistrations={};runDestructors=function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr);}};awaitingDependencies={};registeredTypes={};typeDependencies={};throwInternalError=function throwInternalError(message){throw new InternalError(message);};whenDependentTypesAreResolved=function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){return typeDependencies[type]=dependentTypes;});function onComplete(typeConverters2){var myTypeConverters=getTypeConverters(typeConverters2);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count");}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i]);}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach(function(dt,i){if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt];}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[];}awaitingDependencies[dt].push(function(){typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters);}});}});if(0===unregisteredTypes.length){onComplete(typeConverters);}};__embind_finalize_value_object=function __embind_finalize_value_object(structType){var reg=structRegistrations[structType];delete structRegistrations[structType];var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;var fieldRecords=reg.fields;var fieldTypes=fieldRecords.map(function(field){return field.getterReturnType;}).concat(fieldRecords.map(function(field){return field.setterArgumentType;}));whenDependentTypesAreResolved([structType],fieldTypes,function(fieldTypes2){var fields={};fieldRecords.forEach(function(field,i){var fieldName=field.fieldName;var getterReturnType=fieldTypes2[i];var getter=field.getter;var getterContext=field.getterContext;var setterArgumentType=fieldTypes2[i+fieldRecords.length];var setter=field.setter;var setterContext=field.setterContext;fields[fieldName]={read:function read(ptr){return getterReturnType["fromWireType"](getter(getterContext,ptr));},write:function write(ptr,o){var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors);}};});return[{name:reg.name,fromWireType:function fromWireType(ptr){var rv={};for(var i in fields){rv[i]=fields[i].read(ptr);}rawDestructor(ptr);return rv;},toWireType:function toWireType(destructors,o){for(var fieldName in fields){if(!(fieldName in o)){throw new TypeError("Missing field: \"".concat(fieldName,"\""));}}var ptr=rawConstructor();for(fieldName in fields){fields[fieldName].write(ptr,o[fieldName]);}if(destructors!==null){destructors.push(rawDestructor,ptr);}return ptr;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:rawDestructor}];});};embindRepr=function embindRepr(v){if(v===null){return"null";}var t=_typeof(v);if(t==="object"||t==="array"||t==="function"){return v.toString();}else{return""+v;}};embind_init_charCodes=function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i);}embind_charCodes=codes;};readLatin1String=function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]];}return ret;};throwBindingError=function throwBindingError(message){throw new BindingError(message);};integerReadValueFromPointer=function integerReadValueFromPointer(name,width,signed){switch(width){case 1:return signed?function(pointer){return HEAP8[pointer];}:function(pointer){return HEAPU8[pointer];};case 2:return signed?function(pointer){return HEAP16[pointer>>1];}:function(pointer){return HEAPU16[pointer>>1];};case 4:return signed?function(pointer){return HEAP32[pointer>>2];}:function(pointer){return HEAPU32[pointer>>2];};case 8:return signed?function(pointer){return HEAP64[pointer>>3];}:function(pointer){return HEAPU64[pointer>>3];};default:throw new TypeError("invalid integer width (".concat(width,"): ").concat(name));}};__embind_register_bigint=function __embind_register_bigint(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);var isUnsignedType=name.indexOf("u")!=-1;registerType(primitiveType,{name:name,fromWireType:function fromWireType(value){return value;},toWireType:function toWireType(destructors,value){if(typeof value!="bigint"&&typeof value!="number"){throw new TypeError("Cannot convert \"".concat(embindRepr(value),"\" to ").concat(this.name));}if(typeof value=="number"){value=BigInt(value);}return value;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,!isUnsignedType),destructorFunction:null});};GenericWireTypeSize=8;__embind_register_bool=function __embind_register_bool(rawType,name,trueValue,falseValue){name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:function fromWireType(wt){return!!wt;},toWireType:function toWireType(destructors,o){return o?trueValue:falseValue;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:function readValueFromPointer(pointer){return this["fromWireType"](HEAPU8[pointer]);},destructorFunction:null});};emval_freelist=[];emval_handles=[];__emval_decref=function __emval_decref(handle){if(handle>9&&0===--emval_handles[handle+1]){emval_handles[handle]=void 0;emval_freelist.push(handle);}};count_emval_handles=function count_emval_handles(){return emval_handles.length/2-5-emval_freelist.length;};init_emval=function init_emval(){emval_handles.push(0,1,void 0,1,null,1,true,1,false,1);Module["count_emval_handles"]=count_emval_handles;};Emval={toValue:function toValue(handle){if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle);}return emval_handles[handle];},toHandle:function toHandle(value){switch(value){case void 0:return 2;case null:return 4;case true:return 6;case false:return 8;default:{var handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle;}}}};EmValType={name:"emscripten::val",fromWireType:function fromWireType(handle){var rv=Emval.toValue(handle);__emval_decref(handle);return rv;},toWireType:function toWireType(destructors,value){return Emval.toHandle(value);},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:null};__embind_register_emval=function __embind_register_emval(rawType){return registerType(rawType,EmValType);};floatReadValueFromPointer=function floatReadValueFromPointer(name,width){switch(width){case 4:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2]);};case 8:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3]);};default:throw new TypeError("invalid float width (".concat(width,"): ").concat(name));}};__embind_register_float=function __embind_register_float(rawType,name,size){name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:function fromWireType(value){return value;},toWireType:function toWireType(destructors,value){return value;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null});};createNamedFunction=function createNamedFunction(name,body){return Object.defineProperty(body,"name",{value:name});};runAndAbortIfError=function runAndAbortIfError(func){try{return func();}catch(e){abort(e);}};handleException=function handleException(e){if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS;}quit_(1,e);};runtimeKeepaliveCounter=0;keepRuntimeAlive=function keepRuntimeAlive(){return noExitRuntime||runtimeKeepaliveCounter>0;};_proc_exit=function _proc_exit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){var _Module$onExit;(_Module$onExit=Module["onExit"])===null||_Module$onExit===void 0?void 0:_Module$onExit.call(Module,code);ABORT=true;}quit_(code,new ExitStatus(code));};exitJS=function exitJS(status,implicit){EXITSTATUS=status;_proc_exit(status);};_exit=exitJS;maybeExit=function maybeExit(){if(!keepRuntimeAlive()){try{_exit(EXITSTATUS);}catch(e){handleException(e);}}};callUserCallback=function callUserCallback(func){if(ABORT){return;}try{func();maybeExit();}catch(e){handleException(e);}};Asyncify={instrumentWasmImports:function instrumentWasmImports(imports){var importPattern=/^(invoke_.*|__asyncjs__.*)$/;for(var _i657=0,_Object$entries6=Object.entries(imports);_i657<_Object$entries6.length;_i657++){var _Object$entries6$_i=_slicedToArray(_Object$entries6[_i657],2),x=_Object$entries6$_i[0],original=_Object$entries6$_i[1];if(typeof original=="function"){original.isAsync||importPattern.test(x);}}},instrumentWasmExports:function instrumentWasmExports(exports){var ret={};var _loop10=function _loop10(){var _Object$entries7$_i=_slicedToArray(_Object$entries7[_i658],2),x=_Object$entries7$_i[0],original=_Object$entries7$_i[1];if(typeof original=="function"){ret[x]=function(){Asyncify.exportCallStack.push(x);try{return original.apply(void 0,arguments);}finally{if(!ABORT){Asyncify.exportCallStack.pop();Asyncify.maybeStopUnwind();}}};}else{ret[x]=original;}};for(var _i658=0,_Object$entries7=Object.entries(exports);_i658<_Object$entries7.length;_i658++){_loop10();}return ret;},State:{Normal:0,Unwinding:1,Rewinding:2,Disabled:3},state:0,StackSize:4096,currData:null,handleSleepReturnValue:0,exportCallStack:[],callStackNameToId:{},callStackIdToName:{},callStackId:0,asyncPromiseHandlers:null,sleepCallbacks:[],getCallStackId:function getCallStackId(funcName){var id=Asyncify.callStackNameToId[funcName];if(id===void 0){id=Asyncify.callStackId++;Asyncify.callStackNameToId[funcName]=id;Asyncify.callStackIdToName[id]=funcName;}return id;},maybeStopUnwind:function maybeStopUnwind(){if(Asyncify.currData&&Asyncify.state===Asyncify.State.Unwinding&&Asyncify.exportCallStack.length===0){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_unwind);if(typeof Fibers!="undefined"){Fibers.trampoline();}}},whenDone:function whenDone(){return new Promise(function(resolve,reject){Asyncify.asyncPromiseHandlers={resolve:resolve,reject:reject};});},allocateData:function allocateData(){var ptr=_malloc(12+Asyncify.StackSize);Asyncify.setDataHeader(ptr,ptr+12,Asyncify.StackSize);Asyncify.setDataRewindFunc(ptr);return ptr;},setDataHeader:function setDataHeader(ptr,stack,stackSize){HEAPU32[ptr>>2]=stack;HEAPU32[ptr+4>>2]=stack+stackSize;},setDataRewindFunc:function setDataRewindFunc(ptr){var bottomOfCallStack=Asyncify.exportCallStack[0];var rewindId=Asyncify.getCallStackId(bottomOfCallStack);HEAP32[ptr+8>>2]=rewindId;},getDataRewindFuncName:function getDataRewindFuncName(ptr){var id=HEAP32[ptr+8>>2];var name=Asyncify.callStackIdToName[id];return name;},getDataRewindFunc:function getDataRewindFunc(name){var func=wasmExports[name];return func;},doRewind:function doRewind(ptr){var name=Asyncify.getDataRewindFuncName(ptr);var func=Asyncify.getDataRewindFunc(name);return func();},handleSleep:function handleSleep(startAsync){if(ABORT)return;if(Asyncify.state===Asyncify.State.Normal){var reachedCallback=false;var reachedAfterCallback=false;startAsync(function(){var handleSleepReturnValue=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;if(ABORT)return;Asyncify.handleSleepReturnValue=handleSleepReturnValue;reachedCallback=true;if(!reachedAfterCallback){return;}Asyncify.state=Asyncify.State.Rewinding;runAndAbortIfError(function(){return _asyncify_start_rewind(Asyncify.currData);});if(typeof MainLoop!="undefined"&&MainLoop.func){MainLoop.resume();}var asyncWasmReturnValue,isError=false;try{asyncWasmReturnValue=Asyncify.doRewind(Asyncify.currData);}catch(err2){asyncWasmReturnValue=err2;isError=true;}var handled=false;if(!Asyncify.currData){var asyncPromiseHandlers=Asyncify.asyncPromiseHandlers;if(asyncPromiseHandlers){Asyncify.asyncPromiseHandlers=null;(isError?asyncPromiseHandlers.reject:asyncPromiseHandlers.resolve)(asyncWasmReturnValue);handled=true;}}if(isError&&!handled){throw asyncWasmReturnValue;}});reachedAfterCallback=true;if(!reachedCallback){Asyncify.state=Asyncify.State.Unwinding;Asyncify.currData=Asyncify.allocateData();if(typeof MainLoop!="undefined"&&MainLoop.func){MainLoop.pause();}runAndAbortIfError(function(){return _asyncify_start_unwind(Asyncify.currData);});}}else if(Asyncify.state===Asyncify.State.Rewinding){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_rewind);_free(Asyncify.currData);Asyncify.currData=null;Asyncify.sleepCallbacks.forEach(callUserCallback);}else{abort("invalid state: ".concat(Asyncify.state));}return Asyncify.handleSleepReturnValue;},handleAsync:function handleAsync(startAsync){return Asyncify.handleSleep(function(wakeUp){startAsync().then(wakeUp);});}};ensureOverloadTable=function ensureOverloadTable(proto,methodName,humanName){if(void 0===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){for(var _len127=arguments.length,args=new Array(_len127),_key17=0;_key17<_len127;_key17++){args[_key17]=arguments[_key17];}if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError("Function '".concat(humanName,"' called with an invalid number of arguments (").concat(args.length,") - expects one of (").concat(proto[methodName].overloadTable,")!"));}return proto[methodName].overloadTable[args.length].apply(this,args);};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc;}};exposePublicSymbol=function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(void 0===numArguments||void 0!==Module[name].overloadTable&&void 0!==Module[name].overloadTable[numArguments]){throwBindingError("Cannot register public name '".concat(name,"' twice"));}ensureOverloadTable(Module,name,name);if(Module[name].overloadTable.hasOwnProperty(numArguments)){throwBindingError("Cannot register multiple overloads of a function with the same number of arguments (".concat(numArguments,")!"));}Module[name].overloadTable[numArguments]=value;}else{Module[name]=value;Module[name].argCount=numArguments;}};heap32VectorToArray=function heap32VectorToArray(count,firstElement){var array=[];for(var i=0;i<count;i++){array.push(HEAPU32[firstElement+i*4>>2]);}return array;};replacePublicSymbol=function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistent public symbol");}if(void 0!==Module[name].overloadTable&&void 0!==numArguments){Module[name].overloadTable[numArguments]=value;}else{Module[name]=value;Module[name].argCount=numArguments;}};dynCallLegacy=function dynCallLegacy(sig,ptr,args){sig=sig.replace(/p/g,"i");var f=Module["dynCall_"+sig];return f.apply(void 0,[ptr].concat(_toConsumableArray(args)));};dynCall=function dynCall(sig,ptr){var args=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var rtn=dynCallLegacy(sig,ptr,args);return rtn;};getDynCaller=function getDynCaller(sig,ptr){return function(){for(var _len128=arguments.length,args=new Array(_len128),_key18=0;_key18<_len128;_key18++){args[_key18]=arguments[_key18];}return dynCall(sig,ptr,args);};};embind__requireFunction=function embind__requireFunction(signature,rawFunction){signature=readLatin1String(signature);function makeDynCaller(){return getDynCaller(signature,rawFunction);}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError("unknown function pointer with signature ".concat(signature,": ").concat(rawFunction));}return fp;};extendError=function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==void 0){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"");}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===void 0){return this.name;}else{return"".concat(this.name,": ").concat(this.message);}};return errorClass;};getTypeName=function getTypeName(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv;};throwUnboundTypeError=function throwUnboundTypeError(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return;}if(registeredTypes[type]){return;}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return;}unboundTypes.push(type);seen[type]=true;}types.forEach(visit);throw new UnboundTypeError("".concat(message,": ")+unboundTypes.map(getTypeName).join([", "]));};getFunctionName=function getFunctionName(signature){signature=signature.trim();var argsIndex=signature.indexOf("(");if(argsIndex===-1)return signature;return signature.slice(0,argsIndex);};__embind_register_function=function __embind_register_function(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync,isNonnullReturn){var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);name=getFunctionName(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError("Cannot call ".concat(name," due to unbound types"),argTypes);},argCount-1);whenDependentTypesAreResolved([],argTypes,function(argTypes2){var invokerArgsArray=[argTypes2[0],null].concat(argTypes2.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[];});};__embind_register_integer=function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);var fromWireType=function fromWireType(value){return value;};if(minRange===0){var bitshift=32-8*size;fromWireType=function fromWireType(value){return value<<bitshift>>>bitshift;};}var isUnsignedType=name.includes("unsigned");var checkAssertions=function checkAssertions(value,toTypeName){};var toWireType;if(isUnsignedType){toWireType=function toWireType(destructors,value){checkAssertions(value,this.name);return value>>>0;};}else{toWireType=function toWireType(destructors,value){checkAssertions(value,this.name);return value;};}registerType(primitiveType,{name:name,fromWireType:fromWireType,toWireType:toWireType,argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null});};__embind_register_memory_view=function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size);}name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:decodeMemoryView,argPackAdvance:GenericWireTypeSize,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true});};stringToUTF8=function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);};__embind_register_std_string=function __embind_register_std_string(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:function fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;var i;{var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===void 0){str=stringSegment;}else{str+=String.fromCharCode(0);str+=stringSegment;}decodeStartPtr=currentBytePtr+1;}}}_free(value);return str;},toWireType:function toWireType(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value);}var length;var valueIsOfTypeString=typeof value=="string";if(!(valueIsOfTypeString||value instanceof Uint8Array||value instanceof Uint8ClampedArray||value instanceof Int8Array)){throwBindingError("Cannot pass non-string to std::string");}if(valueIsOfTypeString){length=lengthBytesUTF8(value);}else{length=value.length;}var base=_malloc(4+length+1);var ptr=base+4;HEAPU32[base>>2]=length;if(valueIsOfTypeString){stringToUTF8(value,ptr,length+1);}else{if(valueIsOfTypeString){for(var i=0;i<length;++i){var charCode=value.charCodeAt(i);if(charCode>255){_free(base);throwBindingError("String has UTF-16 code units that do not fit in 8 bits");}HEAPU8[ptr+i]=charCode;}}else{for(var i=0;i<length;++i){HEAPU8[ptr+i]=value[i];}}}if(destructors!==null){destructors.push(_free,base);}return base;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:function destructorFunction(ptr){_free(ptr);}});};UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0;UTF16ToString=function UTF16ToString(ptr,maxBytesToRead){var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx]){++idx;}endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit);}return str;};stringToUTF16=function stringToUTF16(str,outPtr,maxBytesToWrite){var _maxBytesToWrite;(_maxBytesToWrite=maxBytesToWrite)!==null&&_maxBytesToWrite!==void 0?_maxBytesToWrite:maxBytesToWrite=2147483647;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr>>1]=codeUnit;outPtr+=2;}HEAP16[outPtr>>1]=0;return outPtr-startPtr;};lengthBytesUTF16=function lengthBytesUTF16(str){return str.length*2;};UTF32ToString=function UTF32ToString(ptr,maxBytesToRead){var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023);}else{str+=String.fromCharCode(utf32);}}return str;};stringToUTF32=function stringToUTF32(str,outPtr,maxBytesToWrite){var _maxBytesToWrite2;(_maxBytesToWrite2=maxBytesToWrite)!==null&&_maxBytesToWrite2!==void 0?_maxBytesToWrite2:maxBytesToWrite=2147483647;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023;}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break;}HEAP32[outPtr>>2]=0;return outPtr-startPtr;};lengthBytesUTF32=function lengthBytesUTF32(str){var len=0;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343)++i;len+=4;}return len;};__embind_register_std_wstring=function __embind_register_std_wstring(rawType,charSize,name){name=readLatin1String(name);var decodeString,encodeString,readCharAt,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;readCharAt=function readCharAt(pointer){return HEAPU16[pointer>>1];};}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;readCharAt=function readCharAt(pointer){return HEAPU32[pointer>>2];};}registerType(rawType,{name:name,fromWireType:function fromWireType(value){var length=HEAPU32[value>>2];var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||readCharAt(currentBytePtr)==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===void 0){str=stringSegment;}else{str+=String.fromCharCode(0);str+=stringSegment;}decodeStartPtr=currentBytePtr+charSize;}}_free(value);return str;},toWireType:function toWireType(destructors,value){if(!(typeof value=="string")){throwBindingError("Cannot pass non-string to C++ string type ".concat(name));}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr);}return ptr;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:function destructorFunction(ptr){_free(ptr);}});};__embind_register_value_object=function __embind_register_value_object(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){structRegistrations[rawType]={name:readLatin1String(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),fields:[]};};__embind_register_value_object_field=function __embind_register_value_object_field(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){structRegistrations[structType].fields.push({fieldName:readLatin1String(fieldName),getterReturnType:getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext:setterContext});};__embind_register_void=function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,argPackAdvance:0,fromWireType:function fromWireType(){return void 0;},toWireType:function toWireType(destructors,o){return void 0;}});};requireRegisteredType=function requireRegisteredType(rawType,humanName){var impl=registeredTypes[rawType];if(void 0===impl){throwBindingError("".concat(humanName," has unknown type ").concat(getTypeName(rawType)));}return impl;};emval_returnValue=function emval_returnValue(returnType,destructorsRef,handle){var destructors=[];var result=returnType["toWireType"](destructors,handle);if(destructors.length){HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors);}return result;};__emval_as=function __emval_as(handle,returnType,destructorsRef){handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");return emval_returnValue(returnType,destructorsRef,handle);};emval_methodCallers=[];__emval_call=function __emval_call(caller,handle,destructorsRef,args){caller=emval_methodCallers[caller];handle=Emval.toValue(handle);return caller(null,handle,destructorsRef,args);};emval_symbols={};getStringOrSymbol=function getStringOrSymbol(address){var symbol=emval_symbols[address];if(symbol===void 0){return readLatin1String(address);}return symbol;};emval_get_global=function emval_get_global(){if((typeof globalThis==="undefined"?"undefined":_typeof(globalThis))=="object"){return globalThis;}return/* @__PURE__ */function(){return Function;}()("return this")();};__emval_get_global=function __emval_get_global(name){if(name===0){return Emval.toHandle(emval_get_global());}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name]);}};emval_addMethodCaller=function emval_addMethodCaller(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id;};emval_lookupTypes=function emval_lookupTypes(argCount,argTypes){var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAPU32[argTypes+i*4>>2],"parameter "+i);}return a;};__emval_get_method_caller=function __emval_get_method_caller(argCount,argTypes,kind){var types=emval_lookupTypes(argCount,argTypes);var retType=types.shift();argCount--;var functionBody="return function (obj, func, destructorsRef, args) {\n";var offset=0;var argsList=[];if(kind===0){argsList.push("obj");}var params=["retType"];var args=[retType];for(var i=0;i<argCount;++i){argsList.push("arg"+i);params.push("argType"+i);args.push(types[i]);functionBody+=" var arg".concat(i," = argType").concat(i,".readValueFromPointer(args").concat(offset?"+"+offset:"",");\n");offset+=types[i].argPackAdvance;}var invoker=kind===1?"new func":"func.call";functionBody+=" var rv = ".concat(invoker,"(").concat(argsList.join(", "),");\n");if(!retType.isVoid){params.push("emval_returnValue");args.push(emval_returnValue);functionBody+=" return emval_returnValue(retType, destructorsRef, rv);\n";}functionBody+="};\n";params.push(functionBody);var invokerFunction=newFunc(Function,params).apply(void 0,args);var functionName="methodCaller<(".concat(types.map(function(t){return t.name;}).join(", "),") => ").concat(retType.name,">");return emval_addMethodCaller(createNamedFunction(functionName,invokerFunction));};__emval_incref=function __emval_incref(handle){if(handle>9){emval_handles[handle+1]+=1;}};__emval_is_string=function __emval_is_string(handle){handle=Emval.toValue(handle);return typeof handle=="string";};__emval_run_destructors=function __emval_run_destructors(handle){var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle);};__emval_take_value=function __emval_take_value(type,arg){type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](arg);return Emval.toHandle(v);};isLeapYear=function isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0);};MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];ydayFromDate=function ydayFromDate(date){var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday;};INT53_MAX=9007199254740992;INT53_MIN=-9007199254740992;bigintToI53Checked=function bigintToI53Checked(num){return num<INT53_MIN||num>INT53_MAX?NaN:Number(num);};__mktime_js=function __mktime_js(tmPtr){var ret=function(){var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset);}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4);}HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getYear();var timeMs=date.getTime();if(isNaN(timeMs)){return-1;}return timeMs/1e3;}();return BigInt(ret);};__tzset_js=function __tzset_js(timezone,daylight,std_name,dst_name){var currentYear=/* @__PURE__ */new Date().getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=function extractZone(timezoneOffset){var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return"UTC".concat(sign).concat(hours).concat(minutes);};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17);}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17);}};_emscripten_get_now=function _emscripten_get_now(){return performance.now();};_emscripten_date_now=function _emscripten_date_now(){return Date.now();};checkWasiClock=function checkWasiClock(clock_id){return clock_id>=0&&clock_id<=3;};readEmAsmArgsArray=[];readEmAsmArgs=function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>2]:ch==106?HEAP64[buf>>3]:ch==105?HEAP32[buf>>2]:HEAPF64[buf>>3]);buf+=wide?8:4;}return readEmAsmArgsArray;};runEmAsmFunction=function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(ASM_CONSTS,_toConsumableArray(args));};_emscripten_asm_const_int=function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf);};getHeapMax=function getHeapMax(){return 2147483648;};_emscripten_get_heap_max=function _emscripten_get_heap_max(){return getHeapMax();};growMemory=function growMemory(size){var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1;}catch(e){}};_emscripten_resize_heap=function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false;}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+0.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true;}}return false;};safeSetTimeout=function safeSetTimeout(func,timeout){return setTimeout(function(){callUserCallback(func);},timeout);};_emscripten_sleep=function _emscripten_sleep(ms){return Asyncify.handleSleep(function(wakeUp){return safeSetTimeout(wakeUp,ms);});};_emscripten_sleep.isAsync=true;ENV={};getExecutableName=function getExecutableName(){return thisProgram||"./this.program";};getEnvStrings=function getEnvStrings(){if(!getEnvStrings.strings){var lang=((typeof navigator==="undefined"?"undefined":_typeof(navigator))=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===void 0)delete env[x];else env[x]=ENV[x];}var strings=[];for(var x in env){strings.push("".concat(x,"=").concat(env[x]));}getEnvStrings.strings=strings;}return getEnvStrings.strings;};stringToAscii=function stringToAscii(str,buffer){for(var i=0;i<str.length;++i){HEAP8[buffer++]=str.charCodeAt(i);}HEAP8[buffer]=0;};_environ_get=function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1;});return 0;};_environ_sizes_get=function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){return bufSize+=string.length+1;});HEAPU32[penviron_buf_size>>2]=bufSize;return 0;};doReadv=function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!="undefined"){offset+=curr;}}return ret;};doWritev=function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len){break;}if(typeof offset!="undefined"){offset+=curr;}}return ret;};stackAlloc=function stackAlloc(sz){return __emscripten_stack_alloc(sz);};stringToUTF8OnStack=function stringToUTF8OnStack(str){var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret;};FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();MEMFS.doesNotExistError=new FS.ErrnoError(44);MEMFS.doesNotExistError.stack="<generic error, no stack>";InternalError=Module["InternalError"]=/*#__PURE__*/function(_Error2){_inherits(InternalError,_Error2);var _super166=_createSuper(InternalError);function InternalError(message){var _this183;_classCallCheck(this,InternalError);_this183=_super166.call(this,message);_this183.name="InternalError";return _this183;}return _createClass(InternalError);}(/*#__PURE__*/_wrapNativeSuper(Error));embind_init_charCodes();BindingError=Module["BindingError"]=/*#__PURE__*/function(_Error3){_inherits(BindingError,_Error3);var _super167=_createSuper(BindingError);function BindingError(message){var _this184;_classCallCheck(this,BindingError);_this184=_super167.call(this,message);_this184.name="BindingError";return _this184;}return _createClass(BindingError);}(/*#__PURE__*/_wrapNativeSuper(Error));init_emval();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");wasmImports={a:___cxa_throw,j:___syscall_fcntl64,G:___syscall_ioctl,H:___syscall_openat,s:___syscall_renameat,y:___syscall_rmdir,v:___syscall_stat64,z:___syscall_unlinkat,t:__abort_js,L:__embind_finalize_value_object,m:__embind_register_bigint,R:__embind_register_bool,P:__embind_register_emval,l:__embind_register_float,f:__embind_register_function,c:__embind_register_integer,b:__embind_register_memory_view,Q:__embind_register_std_string,g:__embind_register_std_wstring,O:__embind_register_value_object,M:__embind_register_value_object_field,S:__embind_register_void,N:__emval_as,d:__emval_call,q:__emval_decref,F:__emval_get_global,e:__emval_get_method_caller,o:__emval_incref,T:__emval_is_string,n:__emval_run_destructors,p:__emval_take_value,A:__localtime_js,B:__mktime_js,C:__tzset_js,J:_clock_time_get,K:_emscripten_asm_const_int,I:_emscripten_date_now,r:_emscripten_get_heap_max,u:_emscripten_resize_heap,k:_emscripten_sleep,w:_environ_get,x:_environ_sizes_get,h:_fd_close,E:_fd_read,D:_fd_seek,i:_fd_write};_context18.next=229;return createWasm();case 229:wasmExports=_context18.sent;wasmExports["V"];___getTypeName=wasmExports["W"];_malloc=wasmExports["Y"];_free=wasmExports["Z"];_main=Module["_main"]=wasmExports["_"];__emscripten_stack_alloc=wasmExports["$"];Module["dynCall_vi"]=wasmExports["aa"];Module["dynCall_ii"]=wasmExports["ba"];Module["dynCall_viiii"]=wasmExports["ca"];Module["dynCall_vii"]=wasmExports["da"];Module["dynCall_iii"]=wasmExports["ea"];Module["dynCall_iijii"]=wasmExports["fa"];Module["dynCall_iiii"]=wasmExports["ga"];Module["dynCall_iiiii"]=wasmExports["ha"];Module["dynCall_iiiiiiiii"]=wasmExports["ia"];Module["dynCall_iiiiii"]=wasmExports["ja"];Module["dynCall_v"]=wasmExports["ka"];Module["dynCall_viii"]=wasmExports["la"];Module["dynCall_viiiiiii"]=wasmExports["ma"];Module["dynCall_diiii"]=wasmExports["na"];Module["dynCall_viif"]=wasmExports["oa"];Module["dynCall_i"]=wasmExports["pa"];Module["dynCall_fii"]=wasmExports["qa"];Module["dynCall_jiji"]=wasmExports["ra"];Module["dynCall_iidiiii"]=wasmExports["sa"];Module["dynCall_viijii"]=wasmExports["ta"];Module["dynCall_iiiiiii"]=wasmExports["ua"];Module["dynCall_iiiiij"]=wasmExports["va"];Module["dynCall_iiiiid"]=wasmExports["wa"];Module["dynCall_iiiiijj"]=wasmExports["xa"];Module["dynCall_iiiiiiii"]=wasmExports["ya"];Module["dynCall_iiiiiijj"]=wasmExports["za"];Module["dynCall_viiiiii"]=wasmExports["Aa"];Module["dynCall_viiiii"]=wasmExports["Ba"];_asyncify_start_unwind=wasmExports["Ca"];_asyncify_stop_unwind=wasmExports["Da"];_asyncify_start_rewind=wasmExports["Ea"];_asyncify_stop_rewind=wasmExports["Fa"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()();}}run();moduleRtn=readyPromise;return _context18.abrupt("return",moduleRtn);case 272:case"end":return _context18.stop();}}},_callee14);}));}();var __defProp$1=Object.defineProperty;var __defNormalProp$1=function __defNormalProp$1(obj,key,value){return key in obj?__defProp$1(obj,key,{enumerable:true,configurable:true,writable:true,value:value}):obj[key]=value;};var __publicField$1=function __publicField$1(obj,key,value){__defNormalProp$1(obj,_typeof(key)!=="symbol"?key+"":key,value);return value;};var cdnUrl="https://cdn.jsdelivr.net/npm/@creooxag/cx-converter@".concat(packageJSON.version,"/dist/");var defaultUrlPrefix="./";var _IfcWasmConverterLoader=/*#__PURE__*/function(){function _IfcWasmConverterLoader(){_classCallCheck(this,_IfcWasmConverterLoader);__publicField$1(this,"module");}_createClass(_IfcWasmConverterLoader,null,[{key:"getInstance",value:function(){var _getInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(userUrlPrefix){var urlPrefix,Module;return _regeneratorRuntime().wrap(function _callee15$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:urlPrefix=defaultUrlPrefix;if(userUrlPrefix){urlPrefix=userUrlPrefix=="remote"?cdnUrl:userUrlPrefix;}if(_IfcWasmConverterLoader.instance){_context19.next=14;break;}_IfcWasmConverterLoader.instance=new _IfcWasmConverterLoader();Module={locateFile:function locateFile(path){var fullPath=urlPrefix+path;if(path.endsWith(".wasm")){console.log("Loading wasm file from ".concat(fullPath));return fullPath;}return path;}};_context19.prev=5;_context19.next=8;return IfcDbWasm(Module);case 8:_IfcWasmConverterLoader.instance.module=_context19.sent;_context19.next=14;break;case 11:_context19.prev=11;_context19.t0=_context19["catch"](5);console.error("Error on wasm import:",_context19.t0);case 14:return _context19.abrupt("return",_IfcWasmConverterLoader.instance);case 15:case"end":return _context19.stop();}}},_callee15,null,[[5,11]]);}));function getInstance(_x126){return _getInstance.apply(this,arguments);}return getInstance;}()},{key:"getModule",value:function(){var _getModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(userUrlPrefix){return _regeneratorRuntime().wrap(function _callee16$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:_context20.next=2;return _IfcWasmConverterLoader.getInstance(userUrlPrefix);case 2:return _context20.abrupt("return",_context20.sent.module);case 3:case"end":return _context20.stop();}}},_callee16);}));function getModule(_x127){return _getModule.apply(this,arguments);}return getModule;}()}]);return _IfcWasmConverterLoader;}();__publicField$1(_IfcWasmConverterLoader,"instance");var IfcWasmConverterLoader=_IfcWasmConverterLoader;function ifc2gltf(_x128,_x129){return _ifc2gltf.apply(this,arguments);}function _ifc2gltf(){_ifc2gltf=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee72(ifcData,params){var inputOptionsString,loadOptions,resolveCallbackGltf,resolveCallbackMetadata,url,module,promiseGltf,promiseMetadata,gltf,uint8Array,decoder,metaStr,metaData;return _regeneratorRuntime().wrap(function _callee72$(_context76){while(1){switch(_context76.prev=_context76.next){case 0:inputOptionsString=params.inputOptions?params.inputOptions:JSON.stringify(inputOptionsDefault);loadOptions={"maxFileSizeInMegaBytes":1e3};resolveCallbackGltf=void 0;resolveCallbackMetadata=void 0;url=params.remote?"remote":params.urlPath;_context76.next=7;return IfcWasmConverterLoader.getModule(url);case 7:module=_context76.sent;if(params.progressCallback)module.setProgressCallback(params.progressCallback);else module.setProgressCallback(function(progress){console.log("Progress: ".concat(progress));});if(params.progressTextCallback)module.setProgressTextCallback(params.progressTextCallback);else module.setProgressTextCallback(function(progressText){console.log("Progress text: ".concat(progressText));});module.setInputOptions(inputOptionsString);promiseGltf=new Promise(function(resolve){resolveCallbackGltf=resolve;});promiseMetadata=new Promise(function(resolve){resolveCallbackMetadata=resolve;});if(resolveCallbackGltf)module.setGltfCompleteCallback(resolveCallbackGltf);if(resolveCallbackMetadata)module.setMetaDataCompleteCallback(resolveCallbackMetadata);module.loadModel(ifcData,loadOptions);_context76.next=18;return Promise.all([promiseGltf,promiseMetadata]);case 18:_context76.next=20;return module.getGeometry();case 20:gltf=_context76.sent;_context76.next=23;return module.getMetaData();case 23:uint8Array=_context76.sent;decoder=new TextDecoder();metaStr=decoder.decode(uint8Array);_context76.next=28;return JSON.parse(metaStr);case 28:metaData=_context76.sent;return _context76.abrupt("return",{gltf:gltf,metaData:metaData});case 30:case"end":return _context76.stop();}}},_callee72);}));return _ifc2gltf.apply(this,arguments);}var inputOptionsDefault={"inputParameters":{"exportPropertySets":"yes","exportIfcPropertyTypes":"yes","exportIfcValueTypes":"yes","exportPolylines":"yes","excludeGeometryForIfcTypes":["IfcOpeningElement"],"excludeGUIDs":[""],"exportOnlyGUIDs":[""],"centerModelAtOrigin":"yes","ignoreProfileRadius":"yes","enableGltfCompression":"yes","enableGltfQuantization":"no","exportNormals":"no","numPointsPerCircle":18,"licenceKey":"",// JSON above is copied from default input config file. Changes applied here:
|
|
32742
|
+
"loadingPriorityTypes":["IFCWALL","IFCSLAB","IFCWINDOW","IFCROOF","IFCFURNISHINGELEMENT","IFCAIRTERMINAL"]//[ "IfcOpeningElement" ],
|
|
32743
|
+
}};/**
|
|
32744
|
+
* Fetches a file from the given URL and returns its contents as text.
|
|
32745
|
+
*
|
|
32746
|
+
* @param {string} url - The URL to fetch the file from.
|
|
32747
|
+
* @returns {Promise<string>} A promise that resolves to the file contents.
|
|
32748
|
+
* @private
|
|
32749
|
+
*/function fetchFile(_x130){return _fetchFile.apply(this,arguments);}/**
|
|
32750
|
+
* {@link Viewer} plugin that uses [CxConverter](https://github.com/Creoox/cxconverter) to load BIM models directly from IFC files, using its WebAssembly buid from [npm package](https://www.npmjs.com/package/@creooxag/cx-converter).
|
|
32751
|
+
*
|
|
32752
|
+
* ## Overview
|
|
32753
|
+
* The WebAssembly build of CxConverter is still in alfa stage, so it may not work as expected. This documentation will be updated as the library and the plugin evolve. The example below shows how to use the plugin:
|
|
32754
|
+
* ````javascript
|
|
32755
|
+
* import { CxConverterIFCLoaderPlugin, Viewer } from "../../dist/xeokit-sdk.es.js";
|
|
32756
|
+
* const cxConverterIFCLoaderPlugin = new CxConverterIFCLoaderPlugin(viewer);
|
|
32757
|
+
*
|
|
32758
|
+
* const sceneModel = await cxConverterIFCLoaderPlugin.load({
|
|
32759
|
+
* src: "../../assets/models/ifc/Duplex.ifc"
|
|
32760
|
+
* });
|
|
32761
|
+
* ````
|
|
32762
|
+
See the code in action [here](https://xeokit.github.io/xeokit-sdk/examples/buildings/#cxConverterIFC_vbo_Duplex).
|
|
32763
|
+
*/function _fetchFile(){_fetchFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee73(url){var response;return _regeneratorRuntime().wrap(function _callee73$(_context77){while(1){switch(_context77.prev=_context77.next){case 0:_context77.prev=0;_context77.next=3;return fetch(url);case 3:response=_context77.sent;if(response.ok){_context77.next=6;break;}throw new Error("HTTP error! Status: ".concat(response.status));case 6:return _context77.abrupt("return",response.text());case 9:_context77.prev=9;_context77.t0=_context77["catch"](0);console.error('Error fetching file:',_context77.t0);case 12:case"end":return _context77.stop();}}},_callee73,null,[[0,9]]);}));return _fetchFile.apply(this,arguments);}var CxConverterIFCLoaderPlugin=/*#__PURE__*/function(_Plugin20){_inherits(CxConverterIFCLoaderPlugin,_Plugin20);var _super168=_createSuper(CxConverterIFCLoaderPlugin);/**
|
|
32764
|
+
* @constructor
|
|
32765
|
+
* @param {Viewer} viewer The Viewer.
|
|
32766
|
+
* @param {Object} [cfg={}] Plugin configuration.
|
|
32767
|
+
*/function CxConverterIFCLoaderPlugin(viewer){var _this185;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CxConverterIFCLoaderPlugin);_this185=_super168.call(this,"ifcLoader",viewer,cfg);/**
|
|
32768
|
+
* The GLTFLoaderPlugin used internally to load the converted GLTF.
|
|
32769
|
+
* @type {GLTFLoaderPlugin}
|
|
32770
|
+
*/_this185.gltfLoader=new GLTFLoaderPlugin(_this185.viewer);return _this185;}/**
|
|
32771
|
+
* Loads an IFC model from the given source.
|
|
32772
|
+
*
|
|
32773
|
+
* @param {Object} [params={}] Loading parameters.
|
|
32774
|
+
* @param {string} params.src Path to an IFC file.
|
|
32775
|
+
* @param {Function} [params.progressCallback] Callback to track loading progress.
|
|
32776
|
+
* @param {Function} [params.progressTextCallback] Callback to track loading progress with text updates.
|
|
32777
|
+
* @returns {Promise<SceneModel>} A promise that resolves to the loaded SceneModel.
|
|
32778
|
+
*/_createClass(CxConverterIFCLoaderPlugin,[{key:"load",value:function(){var _load=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(){var params,data,_yield$ifc2gltf,gltf,metaData,sceneModel,_args20=arguments;return _regeneratorRuntime().wrap(function _callee17$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:params=_args20.length>0&&_args20[0]!==undefined?_args20[0]:{};if(!params.src){this.error("load() param expected: src");}_context21.next=4;return fetchFile(params.src);case 4:data=_context21.sent;_context21.next=7;return ifc2gltf(data,{remote:true,progressCallback:params.progressCallback,progressTextCallback:params.progressTextCallback});case 7:_yield$ifc2gltf=_context21.sent;gltf=_yield$ifc2gltf.gltf;metaData=_yield$ifc2gltf.metaData;sceneModel=this.gltfLoader.load({id:"myModel",gltf:gltf,metaModelJSON:metaData});return _context21.abrupt("return",sceneModel);case 12:case"end":return _context21.stop();}}},_callee17,this);}));function load(){return _load.apply(this,arguments);}return load;}()}]);return CxConverterIFCLoaderPlugin;}(Plugin);/**
|
|
32744
32779
|
* Default data access strategy for {@link LASLoaderPlugin}.
|
|
32745
32780
|
*/var LASDefaultDataSource=/*#__PURE__*/function(){function LASDefaultDataSource(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,LASDefaultDataSource);this.cacheBuster=cfg.cacheBuster!==false;}_createClass(LASDefaultDataSource,[{key:"_cacheBusterURL",value:function _cacheBusterURL(url){if(!this.cacheBuster){return url;}var timestamp=new Date().getTime();if(url.indexOf('?')>-1){return url+'&_='+timestamp;}else{return url+'?_='+timestamp;}}/**
|
|
32746
32781
|
* Gets the contents of the given LAS file in an arraybuffer.
|
|
@@ -32749,7 +32784,7 @@ origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals
|
|
|
32749
32784
|
* @param {Function} ok Callback fired on success, argument is the LAS file in an arraybuffer.
|
|
32750
32785
|
* @param {Function} error Callback fired on error.
|
|
32751
32786
|
*/},{key:"getLAS",value:function getLAS(src,ok,error){src=this._cacheBusterURL(src);var defaultCallback=function defaultCallback(){};ok=ok||defaultCallback;error=error||defaultCallback;var dataUriRegex=/^data:(.*?)(;base64)?,(.*)$/;var dataUriRegexResult=src.match(dataUriRegex);if(dataUriRegexResult){// Safari can't handle data URIs through XMLHttpRequest
|
|
32752
|
-
var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.decodeURIComponent(data);if(isBase64){data=window.atob(data);}try{var buffer=new ArrayBuffer(data.length);var view=new Uint8Array(buffer);for(var i=0;i<data.length;i++){view[i]=data.charCodeAt(i);}ok(buffer);}catch(errMsg){error(errMsg);}}else{var request=new XMLHttpRequest();request.open('GET',src,true);request.responseType='arraybuffer';request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){ok(request.response);}else{error('
|
|
32787
|
+
var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.decodeURIComponent(data);if(isBase64){data=window.atob(data);}try{var buffer=new ArrayBuffer(data.length);var view=new Uint8Array(buffer);for(var i=0;i<data.length;i++){view[i]=data.charCodeAt(i);}ok(buffer);}catch(errMsg){error(errMsg);}}else{var request=new XMLHttpRequest();request.open('GET',src,true);request.responseType='arraybuffer';request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){ok(request.response);}else{error('getLAS error : '+request.response);}}};request.send(null);}}},{key:"getManifest",value:function getManifest(manifestSrc,ok,error){utils.loadJSON(this._cacheBusterURL(manifestSrc),function(json){ok(json);},function(errMsg){error(errMsg);});}}]);return LASDefaultDataSource;}();// __VERSION__ is injected by babel-plugin-version-inline
|
|
32753
32788
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
32754
32789
|
var VERSION="4.3.2";/**
|
|
32755
32790
|
* Loader for the LAS (LASer) point cloud format
|
|
@@ -32788,7 +32823,7 @@ asmGlobalArg,asmLibraryArg,buffer);var __ZSt18uncaught_exceptionv=Module['__ZSt1
|
|
|
32788
32823
|
* @param offset
|
|
32789
32824
|
* @param count
|
|
32790
32825
|
* @returns number | number[] from incoming binary data
|
|
32791
|
-
*/function readAs(buf){var Type=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var offset=arguments.length>2?arguments[2]:undefined;var count=arguments.length>3?arguments[3]:undefined;count=count===undefined||count===0?1:count;var sub=buf.slice(offset,offset+Type.BYTES_PER_ELEMENT*count);var r=new Type(sub);if(count===1){return r[0];}var ret=[];for(var
|
|
32826
|
+
*/function readAs(buf){var Type=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var offset=arguments.length>2?arguments[2]:undefined;var count=arguments.length>3?arguments[3]:undefined;count=count===undefined||count===0?1:count;var sub=buf.slice(offset,offset+Type.BYTES_PER_ELEMENT*count);var r=new Type(sub);if(count===1){return r[0];}var ret=[];for(var _i659=0;_i659<count;_i659++){ret.push(r[_i659]);}return ret;}/**
|
|
32792
32827
|
* Parsing of header's attributes
|
|
32793
32828
|
* @param arraybuffer
|
|
32794
32829
|
* @returns header as LASHeader
|
|
@@ -32808,7 +32843,7 @@ return true;}/**
|
|
|
32808
32843
|
* @param count
|
|
32809
32844
|
* @param skip
|
|
32810
32845
|
* @returns new ArrayBuffer, count, hasMoreData
|
|
32811
|
-
*/},{key:"readData",value:function readData(count,skip){var header=this.header,arraybuffer=this.arraybuffer;if(!header){throw new Error('Cannot start reading data till a header request is issued');}var readOffset=this.readOffset;var start;if(skip<=1){count=Math.min(count,header.pointsCount-readOffset);start=header.pointsOffset+readOffset*header.pointsStructSize;var end=start+count*header.pointsStructSize;readOffset+=count;this.readOffset=readOffset;return{buffer:arraybuffer.slice(start,end),count:count,hasMoreData:readOffset<header.pointsCount};}var pointsToRead=Math.min(count*skip,header.pointsCount-readOffset);var bufferSize=Math.ceil(pointsToRead/skip);var pointsRead=0;var buf=new Uint8Array(bufferSize*header.pointsStructSize);for(var
|
|
32846
|
+
*/},{key:"readData",value:function readData(count,skip){var header=this.header,arraybuffer=this.arraybuffer;if(!header){throw new Error('Cannot start reading data till a header request is issued');}var readOffset=this.readOffset;var start;if(skip<=1){count=Math.min(count,header.pointsCount-readOffset);start=header.pointsOffset+readOffset*header.pointsStructSize;var end=start+count*header.pointsStructSize;readOffset+=count;this.readOffset=readOffset;return{buffer:arraybuffer.slice(start,end),count:count,hasMoreData:readOffset<header.pointsCount};}var pointsToRead=Math.min(count*skip,header.pointsCount-readOffset);var bufferSize=Math.ceil(pointsToRead/skip);var pointsRead=0;var buf=new Uint8Array(bufferSize*header.pointsStructSize);for(var _i660=0;_i660<pointsToRead;_i660++){if(_i660%skip===0){start=header.pointsOffset+readOffset*header.pointsStructSize;var src=new Uint8Array(arraybuffer,start,header.pointsStructSize);buf.set(src,pointsRead*header.pointsStructSize);pointsRead++;}readOffset++;}this.readOffset=readOffset;return{buffer:buf.buffer,count:pointsRead,hasMoreData:readOffset<header.pointsCount};}/**
|
|
32812
32847
|
* Method which brings data to null to close the file
|
|
32813
32848
|
* @returns
|
|
32814
32849
|
*/},{key:"close",value:function close(){// @ts-ignore Possibly null
|
|
@@ -32825,7 +32860,7 @@ Module=getModule();}}/**
|
|
|
32825
32860
|
* @param offset
|
|
32826
32861
|
* @param skip
|
|
32827
32862
|
* @returns Data
|
|
32828
|
-
*/},{key:"readData",value:function readData(count,offset,skip){if(!this.instance){throw new Error('You need to open the file before trying to read stuff');}var header=this.header,instance=this.instance;if(!header){throw new Error('You need to query header before reading, I maintain state that way, sorry :(');}try{var pointsToRead=Math.min(count*skip,header.pointsCount-instance.readOffset);var bufferSize=Math.ceil(pointsToRead/skip);var pointsRead=0;var thisBuf=new Uint8Array(bufferSize*header.pointsStructSize);var bufRead=Module._malloc(header.pointsStructSize);for(var
|
|
32863
|
+
*/},{key:"readData",value:function readData(count,offset,skip){if(!this.instance){throw new Error('You need to open the file before trying to read stuff');}var header=this.header,instance=this.instance;if(!header){throw new Error('You need to query header before reading, I maintain state that way, sorry :(');}try{var pointsToRead=Math.min(count*skip,header.pointsCount-instance.readOffset);var bufferSize=Math.ceil(pointsToRead/skip);var pointsRead=0;var thisBuf=new Uint8Array(bufferSize*header.pointsStructSize);var bufRead=Module._malloc(header.pointsStructSize);for(var _i661=0;_i661<pointsToRead;_i661++){instance.getPoint(bufRead);if(_i661%skip===0){var _a11=new Uint8Array(Module.HEAPU8.buffer,bufRead,header.pointsStructSize);thisBuf.set(_a11,pointsRead*header.pointsStructSize);pointsRead++;}instance.readOffset++;}Module._free(bufRead);return{buffer:thisBuf.buffer,count:pointsRead,hasMoreData:instance.readOffset<header.pointsCount};}catch(error){throw new Error("Failed to read data: ".concat(error.message));}}/**
|
|
32829
32864
|
* Deletes the instance
|
|
32830
32865
|
* @returns boolean
|
|
32831
32866
|
*/},{key:"close",value:function close(){try{if(this.instance!==null){Module._free(this.instance.buf);this.instance["delete"]();this.instance=null;}return true;}catch(error){throw new Error("Failed to close file: ".concat(error.message));}}}]);return LAZLoader;}();/**
|
|
@@ -32882,7 +32917,7 @@ schema:{fields:[],metadata:{}},header:{vertexCount:0,boundingBox:[[0,0,0],[0,0,0
|
|
|
32882
32917
|
};/* eslint-disable max-statements */ // @ts-ignore Possibly undefined
|
|
32883
32918
|
parseLASChunked(arrayBuffer,(_options$las=options.las)===null||_options$las===void 0?void 0:_options$las.skip,function(){var _options$las3,_options$onProgress;var decoder=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var lasHeader=arguments.length>1?arguments[1]:undefined;if(!originalHeader){var _options$las2;originalHeader=lasHeader;var total=lasHeader.totalToRead;var PositionsType=(_options$las2=options.las)!==null&&_options$las2!==void 0&&_options$las2.fp64?Float64Array:Float32Array;positions=new PositionsType(total*3);// laslaz-decoder.js `pointFormatReaders`
|
|
32884
32919
|
colors=lasHeader.pointsFormatId>=2?new Uint8Array(total*4):null;intensities=new Uint16Array(total);classifications=new Uint8Array(total);lasMesh.loaderData=lasHeader;lasMesh.attributes={POSITION:{value:positions,size:3},// non-gltf attributes, use non-capitalized names for now
|
|
32885
|
-
intensity:{value:intensities,size:1},classification:{value:classifications,size:1}};if(colors){lasMesh.attributes.COLOR_0={value:colors,size:4};}}var batchSize=decoder.pointsCount;var _lasHeader$scale=_slicedToArray(lasHeader.scale,3),scaleX=_lasHeader$scale[0],scaleY=_lasHeader$scale[1],scaleZ=_lasHeader$scale[2],_lasHeader$offset=_slicedToArray(lasHeader.offset,3),offsetX=_lasHeader$offset[0],offsetY=_lasHeader$offset[1],offsetZ=_lasHeader$offset[2];var twoByteColor=detectTwoByteColors(decoder,batchSize,(_options$las3=options.las)===null||_options$las3===void 0?void 0:_options$las3.colorDepth);for(var
|
|
32920
|
+
intensity:{value:intensities,size:1},classification:{value:classifications,size:1}};if(colors){lasMesh.attributes.COLOR_0={value:colors,size:4};}}var batchSize=decoder.pointsCount;var _lasHeader$scale=_slicedToArray(lasHeader.scale,3),scaleX=_lasHeader$scale[0],scaleY=_lasHeader$scale[1],scaleZ=_lasHeader$scale[2],_lasHeader$offset=_slicedToArray(lasHeader.offset,3),offsetX=_lasHeader$offset[0],offsetY=_lasHeader$offset[1],offsetZ=_lasHeader$offset[2];var twoByteColor=detectTwoByteColors(decoder,batchSize,(_options$las3=options.las)===null||_options$las3===void 0?void 0:_options$las3.colorDepth);for(var _i662=0;_i662<batchSize;_i662++){var _decoder$getPoint=decoder.getPoint(_i662),_position3=_decoder$getPoint.position,_color12=_decoder$getPoint.color,intensity=_decoder$getPoint.intensity,classification=_decoder$getPoint.classification;positions[pointIndex*3]=_position3[0]*scaleX+offsetX;positions[pointIndex*3+1]=_position3[1]*scaleY+offsetY;positions[pointIndex*3+2]=_position3[2]*scaleZ+offsetZ;if(_color12&&colors){if(twoByteColor){colors[pointIndex*4]=_color12[0]/256;colors[pointIndex*4+1]=_color12[1]/256;colors[pointIndex*4+2]=_color12[2]/256;}else{colors[pointIndex*4]=_color12[0];colors[pointIndex*4+1]=_color12[1];colors[pointIndex*4+2]=_color12[2];}colors[pointIndex*4+3]=255;}intensities[pointIndex]=intensity;classifications[pointIndex]=classification;pointIndex++;}var meshBatch=_objectSpread(_objectSpread({},lasMesh),{},{header:{vertexCount:lasHeader.totalRead},progress:lasHeader.totalRead/lasHeader.totalToRead});options===null||options===void 0?void 0:(_options$onProgress=options.onProgress)===null||_options$onProgress===void 0?void 0:_options$onProgress.call(options,meshBatch);});/* eslint-enable max-statements */lasMesh.header={vertexCount:originalHeader.totalToRead,boundingBox:getMeshBoundingBox((lasMesh===null||lasMesh===void 0?void 0:lasMesh.attributes)||{})};if(lasMesh){lasMesh.schema=getLASSchema(lasMesh.loaderData,lasMesh.attributes);}return lasMesh;}/**
|
|
32886
32921
|
* parse laz data
|
|
32887
32922
|
* @param rawData
|
|
32888
32923
|
* @param skip
|
|
@@ -32897,17 +32932,17 @@ onParseData(unpacker,header);if(!chunk.hasMoreData||totalRead>=totalToRead){brea
|
|
|
32897
32932
|
* @param batchSize
|
|
32898
32933
|
* @param colorDepth
|
|
32899
32934
|
* @returns boolean
|
|
32900
|
-
*/function detectTwoByteColors(){var decoder=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var batchSize=arguments.length>1?arguments[1]:undefined;var colorDepth=arguments.length>2?arguments[2]:undefined;var twoByteColor=false;switch(colorDepth){case 8:twoByteColor=false;break;case 16:twoByteColor=true;break;case'auto':if(decoder.getPoint(0).color){for(var
|
|
32935
|
+
*/function detectTwoByteColors(){var decoder=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var batchSize=arguments.length>1?arguments[1]:undefined;var colorDepth=arguments.length>2?arguments[2]:undefined;var twoByteColor=false;switch(colorDepth){case 8:twoByteColor=false;break;case 16:twoByteColor=true;break;case'auto':if(decoder.getPoint(0).color){for(var _i663=0;_i663<batchSize;_i663++){var _decoder$getPoint2=decoder.getPoint(_i663),_color13=_decoder$getPoint2.color;// eslint-disable-next-line max-depth
|
|
32901
32936
|
if(_color13[0]>255||_color13[1]>255||_color13[2]>255){twoByteColor=true;}}}break;default:// eslint-disable-next-line
|
|
32902
32937
|
console.warn('las: illegal value for options.las.colorDepth');break;}return twoByteColor;}/**
|
|
32903
32938
|
* Loader for the LAS (LASer) point cloud format
|
|
32904
32939
|
* @note Does not support LAS v1.4
|
|
32905
|
-
*/var LASLoader=_objectSpread(_objectSpread({},LASLoader$2),{},{parse:function(){var _parse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
32940
|
+
*/var LASLoader=_objectSpread(_objectSpread({},LASLoader$2),{},{parse:function(){var _parse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(arrayBuffer,options){return _regeneratorRuntime().wrap(function _callee18$(_context22){while(1){switch(_context22.prev=_context22.next){case 0:return _context22.abrupt("return",parseLAS(arrayBuffer,options));case 1:case"end":return _context22.stop();}}},_callee18);}));function parse(_x131,_x132){return _parse.apply(this,arguments);}return parse;}(),parseSync:function parseSync(arrayBuffer,options){return parseLAS(arrayBuffer,options);}});//import * as epsgCheck from 'epsg-index/all.json';
|
|
32906
32941
|
var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSoureceID',format:'uShort',size:2},{item:'GlobalEncoding',format:'uShort',size:2},{item:'ProjectID1',format:'notUsed',size:4},{item:'ProjectID2',format:'notUsed',size:2},{item:'ProjectID3',format:'notUsed',size:2},{item:'ProjectID4',format:'notUsed',size:8},{item:'VersionMajor',format:'uChar',size:1},{item:'VersionMinor',format:'uChar',size:1},{item:'SystemIdentifier',format:'char',size:32},{item:'GeneratingSoftware',format:'char',size:32},{item:'CreationDay',format:'uShort',size:2},{item:'CreationYear',format:'uShort',size:2},{item:'HeaderSize',format:'uShort',size:2},{item:'OffsetToPointData',format:'uLong',size:4},{item:'NumberOfVariableLengthRecords',format:'uLong',size:4},{item:'PointDataFormatID',format:'uChar',size:1},{item:'PointDataRecordLength',format:'uShort',size:2},{item:'NumberOfPoints',format:'uLong',size:4},{item:'NumberOfPointByReturn',format:'uLong',size:20},{item:'ScaleFactorX',format:'double',size:8},{item:'ScaleFactorY',format:'double',size:8},{item:'ScaleFactorZ',format:'double',size:8},{item:'OffsetX',format:'double',size:8},{item:'OffsetY',format:'double',size:8},{item:'OffsetZ',format:'double',size:8},{item:'MaxX',format:'double',size:8},{item:'MinX',format:'double',size:8},{item:'MaxY',format:'double',size:8},{item:'MinY',format:'double',size:8},{item:'MaxZ',format:'double',size:8},{item:'MinZ',format:'double',size:8}];var variableLengthRecord=[{item:'Reserved',format:'uShort',size:2},{item:'UserId',format:'char',size:16},{item:'RecordId',format:'uShort',size:2},{item:'RecordLengthAfterHeader',format:'uShort',size:2},{item:'Description',format:'char',size:32}];/**
|
|
32907
32942
|
* @private
|
|
32908
32943
|
* @param arrayBuffer
|
|
32909
32944
|
* @returns {{}}
|
|
32910
|
-
*/var loadLASHeader=function loadLASHeader(arrayBuffer){var currentByte=0;var numOfVarLenRecords=0;var projectionStart=0;var dataView=new DataView(arrayBuffer);var buffer=new Uint8Array(6000);var getGeoKeys=function getGeoKeys(geoRecord){if(geoRecord===undefined){return undefined;}var projectionEnd=projectionStart+geoRecord["RecordLengthAfterHeader"];var geoTag=buffer.slice(projectionStart,projectionEnd);var arrayBuffer=bufferFlipper(geoTag);var dataView=new DataView(arrayBuffer);var byteCount=6;var numberOfKeys=Number(dataView.getUint16(byteCount,true));var geoKeys=[];while(numberOfKeys--){var keyTmp={};keyTmp.key=dataView.getUint16(byteCount+=2,true);keyTmp.tiffTagLocation=dataView.getUint16(byteCount+=2,true);keyTmp.count=dataView.getUint16(byteCount+=2,true);keyTmp.valueOffset=dataView.getUint16(byteCount+=2,true);geoKeys.push(keyTmp);}var projRecord=geoKeys.find(function(x){return x.key===3072;});if(projRecord&&projRecord.hasOwnProperty('valueOffset')){var epsg=projRecord.valueOffset;{return epsg;}}return undefined;};var getValue=function getValue(
|
|
32945
|
+
*/var loadLASHeader=function loadLASHeader(arrayBuffer){var currentByte=0;var numOfVarLenRecords=0;var projectionStart=0;var dataView=new DataView(arrayBuffer);var buffer=new Uint8Array(6000);var getGeoKeys=function getGeoKeys(geoRecord){if(geoRecord===undefined){return undefined;}var projectionEnd=projectionStart+geoRecord["RecordLengthAfterHeader"];var geoTag=buffer.slice(projectionStart,projectionEnd);var arrayBuffer=bufferFlipper(geoTag);var dataView=new DataView(arrayBuffer);var byteCount=6;var numberOfKeys=Number(dataView.getUint16(byteCount,true));var geoKeys=[];while(numberOfKeys--){var keyTmp={};keyTmp.key=dataView.getUint16(byteCount+=2,true);keyTmp.tiffTagLocation=dataView.getUint16(byteCount+=2,true);keyTmp.count=dataView.getUint16(byteCount+=2,true);keyTmp.valueOffset=dataView.getUint16(byteCount+=2,true);geoKeys.push(keyTmp);}var projRecord=geoKeys.find(function(x){return x.key===3072;});if(projRecord&&projRecord.hasOwnProperty('valueOffset')){var epsg=projRecord.valueOffset;{return epsg;}}return undefined;};var getValue=function getValue(_ref32){var item=_ref32.item,format=_ref32.format,size=_ref32.size;var str,array;switch(format){case'char':array=new Uint8Array(arrayBuffer,currentByte,size);currentByte+=size;str=uint8arrayToString(array);return[item,str];case'uShort':str=dataView.getUint16(currentByte,true);currentByte+=size;return[item,str];case'uLong':str=dataView.getUint32(currentByte,true);if(item==='NumberOfVariableLengthRecords'){numOfVarLenRecords=str;}currentByte+=size;return[item,str];case'uChar':str=dataView.getUint8(currentByte);currentByte+=size;return[item,str];case'double':str=dataView.getFloat64(currentByte,true);currentByte+=size;return[item,str];default:currentByte+=size;}};var getValues=function getValues(){var publicHeaderBlock={};headerBlockItems.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));if(myObj!==undefined){if(myObj[0]==='FileSignature'&&myObj[1]!=='LASF'){throw new Error('Ivalid FileSignature. Is this a LAS/LAZ file');}publicHeaderBlock[myObj[0]]=myObj[1];}});var variableRecords=[];var variableLengthRecords=numOfVarLenRecords;var _loop11=function _loop11(){var variableObj={};variableLengthRecord.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));variableObj[myObj[0]]=myObj[1];if(myObj[0]==='UserId'&&myObj[1]==='LASF_Projection'){projectionStart=currentByte-18+54;}});variableRecords.push(variableObj);};while(variableLengthRecords--){_loop11();}var geoRecord=variableRecords.find(function(x){return x.UserId==='LASF_Projection';});var epsg=getGeoKeys(geoRecord);if(epsg){publicHeaderBlock['epsg']=epsg;}return publicHeaderBlock;};return getValues();};var bufferFlipper=function bufferFlipper(buf){var ab=new ArrayBuffer(buf.length);var view=new Uint8Array(ab);for(var _i664=0;_i664<buf.length;++_i664){view[_i664]=buf[_i664];}return ab;};var uint8arrayToString=function uint8arrayToString(array){var str='';array.forEach(function(item){var c=String.fromCharCode(item);if(c!=="\0"){str+=c;}});return str.trim();};var MAX_VERTICES=500000;// TODO: Rough estimate
|
|
32911
32946
|
/**
|
|
32912
32947
|
* {@link Viewer} plugin that loads lidar point cloud geometry from LAS files.
|
|
32913
32948
|
*
|
|
@@ -33098,7 +33133,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
33098
33133
|
*
|
|
33099
33134
|
* @class LASLoaderPlugin
|
|
33100
33135
|
* @since 2.0.17
|
|
33101
|
-
*/var LASLoaderPlugin=/*#__PURE__*/function(
|
|
33136
|
+
*/var LASLoaderPlugin=/*#__PURE__*/function(_Plugin21){_inherits(LASLoaderPlugin,_Plugin21);var _super169=_createSuper(LASLoaderPlugin);/**
|
|
33102
33137
|
* @constructor
|
|
33103
33138
|
*
|
|
33104
33139
|
* @param {Viewer} viewer The Viewer.
|
|
@@ -33112,7 +33147,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
33112
33147
|
* @param {Boolean} [cfg.rotateX=false] Whether to rotate the LAS point positions 90 degrees. Applied after "center".
|
|
33113
33148
|
* @param {Number[]} [cfg.rotate=[0,0,0]] Rotations to immediately apply to the LAS points, given as Euler angles in degrees, for each of the X, Y and Z axis. Rotation is applied after "center" and "rotateX".
|
|
33114
33149
|
* @param {Number[]} [cfg.transform] 4x4 transform matrix to immediately apply to the LAS points. This is applied after "center", "rotateX" and "rotate". Typically used instead of "rotateX" and "rotate".
|
|
33115
|
-
*/function LASLoaderPlugin(viewer){var
|
|
33150
|
+
*/function LASLoaderPlugin(viewer){var _this186;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LASLoaderPlugin);_this186=_super169.call(this,"lasLoader",viewer,cfg);_this186.dataSource=cfg.dataSource;_this186.skip=cfg.skip;_this186.fp64=cfg.fp64;_this186.colorDepth=cfg.colorDepth;_this186.center=cfg.center;_this186.rotate=cfg.rotate;_this186.rotateX=cfg.rotateX;_this186.transform=cfg.transform;return _this186;}/**
|
|
33116
33151
|
* Gets the custom data source through which the LASLoaderPlugin can load LAS files.
|
|
33117
33152
|
*
|
|
33118
33153
|
* Default value is {@link LASDefaultDataSource}, which loads via HTTP.
|
|
@@ -33231,6 +33266,8 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
33231
33266
|
* @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
|
|
33232
33267
|
* @param {String} [params.src] Path to a LAS file, as an alternative to the ````las```` parameter.
|
|
33233
33268
|
* @param {ArrayBuffer} [params.las] The LAS file data, as an alternative to the ````src```` parameter.
|
|
33269
|
+
* @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.laz```` || ````.las```` files to load as parts of the model. Use this option to load models that have been split into
|
|
33270
|
+
* @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.laz```` || ````.las```` files to load as parts of the model. Use this option to load models that have been split into
|
|
33234
33271
|
* @param {Boolean} [params.loadMetadata=true] Whether to load metadata for the LAS model.
|
|
33235
33272
|
* @param {Number[]} [params.origin=[0,0,0]] The model's World-space double-precision 3D origin. Use this to position the model within xeokit's World coordinate system, using double-precision coordinates.
|
|
33236
33273
|
* @param {Number[]} [params.position=[0,0,0]] The model single-precision 3D position, relative to the ````origin```` parameter.
|
|
@@ -33239,33 +33276,13 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
33239
33276
|
* @param {Number[]} [params.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] The model's world transform matrix. Overrides the position, scale and rotation parameters. Relative to ````origin````.
|
|
33240
33277
|
* @param {Object} [params.stats] Collects model statistics.
|
|
33241
33278
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
|
|
33242
|
-
*/},{key:"load",value:function load(){var
|
|
33243
|
-
}var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};
|
|
33244
|
-
|
|
33245
|
-
|
|
33246
|
-
const meshIds = [];
|
|
33247
|
-
|
|
33248
|
-
for (let i = 0, len = pointsChunks.length; i < len; i++) {
|
|
33249
|
-
|
|
33250
|
-
const geometryId = `geometryMesh${i}`;
|
|
33251
|
-
const meshId = `pointsMesh${i}`;
|
|
33252
|
-
meshIds.push(meshId);
|
|
33253
|
-
|
|
33254
|
-
sceneModel.createGeometry({
|
|
33255
|
-
id: geometryId,
|
|
33256
|
-
primitive: "points",
|
|
33257
|
-
positions: pointsChunks[i],
|
|
33258
|
-
colorsCompressed: (i < colorsChunks.length) ? colorsChunks[i] : null
|
|
33259
|
-
});
|
|
33260
|
-
|
|
33261
|
-
sceneModel.createMesh({
|
|
33262
|
-
id: meshId,
|
|
33263
|
-
geometryId
|
|
33264
|
-
});
|
|
33265
|
-
}
|
|
33266
|
-
*/var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this186.viewer.metaScene.createMetaModel(metaModelId,params.metaModelJSON,options);}else if(params.loadMetadata!==false){var rootMetaObjectId=math.createUUID();var metadata={projectId:"",author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[{id:rootMetaObjectId,name:"Model",type:"Model"},{id:pointsObjectId,name:"PointCloud (LAS)",type:"PointCloud",parent:rootMetaObjectId,attributes:lasHeader||{}}],propertySets:[]};var _metaModelId=sceneModel.id;_this186.viewer.metaScene.createMetaModel(_metaModelId,metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
33279
|
+
*/},{key:"load",value:function load(){var _this187=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{maxGeometryBatchSize:MAX_VERTICES,isModel:true}));if(!params.src&&!params.las&&!params.manifest&&!params.manifestSrc){this.error("load() param expected: src or las");return sceneModel;// Return new empty model
|
|
33280
|
+
}var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};var spinner=this.viewer.scene.canvas.spinner;var done=function done(){sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
33281
|
+
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
33282
|
+
});spinner.processes--;};var error=function error(errMsg){spinner.processes--;_this187.error(errMsg);sceneModel.fire("error",errMsg);};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else if(params.las){spinner.processes++;this._parseModel(params.las,params,options,sceneModel).then(done,error);}else if(params.manifest||params.manifestSrc){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadAllFiles=function loadAllFiles(lasFiles){var i=0;var modelsLoaded=new Array(lasFiles.length);var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=lasFiles.length){return;}else{modelsLoaded[i]=false;_this187._dataSource.getLAS("".concat(baseDir).concat(lasFiles[i]),function(arrayBuffer){var modelParams=utils.apply(params,{isManifest:true,index:i});_this187._parseModel(arrayBuffer,modelParams,options,sceneModel).then(function(){modelsLoaded[modelParams.index]=true;var allLoaded=true;modelsLoaded.forEach(function(loaded){if(!loaded)allLoaded=false;});if(allLoaded)done();});i++;_this187.scheduleTask(loadNext,200);},error);}};loadNext();};var loadManifestData=function loadManifestData(manifestData){if(sceneModel.destroyed)return;var files=manifestData.lasFiles||manifestData.lazFiles;if(!files||files.length<=0){_this187.error("load(): Failed to load model manifest - manifest not valid");return;}loadAllFiles(files);};if(params.manifestSrc){this._dataSource.getManifest(params.manifestSrc,function(manifestData){loadManifestData(manifestData);},function(errMsg){_this187.error(errMsg);sceneModel.fire("error",errMsg);});}else{var manifestData=params.manifest;loadManifestData(manifestData);}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this188=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this188._parseModel(arrayBuffer,params,options,sceneModel).then(function(){sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
33267
33283
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
33268
|
-
});resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);return LASLoaderPlugin;}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var
|
|
33284
|
+
});spinner.processes--;},function(errMsg){spinner.processes--;_this188.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this188.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this189=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this189._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i665=0,len=positionsValue.length;_i665<len;_i665+=3){centerPos[0]+=positionsValue[_i665+0];centerPos[1]+=positionsValue[_i665+1];centerPos[2]+=positionsValue[_i665+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i666=0,_len129=positionsValue.length;_i666<_len129;_i666+=3){positionsValue[_i666+0]-=centerPos[0];positionsValue[_i666+1]-=centerPos[1];positionsValue[_i666+2]-=centerPos[2];}}if(_this189._rotateX){if(positionsValue){for(var _i667=0,_len130=positionsValue.length;_i667<_len130;_i667+=3){var temp=positionsValue[_i667+1];positionsValue[_i667+1]=positionsValue[_i667+2];positionsValue[_i667+2]=temp;}}}if(_this189._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this189._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i668=0,_len131=positionsValue.length;_i668<_len131;_i668+=3){pos[0]=positionsValue[_i668+0];pos[1]=positionsValue[_i668+1];pos[2]=positionsValue[_i668+2];math.transformPoint3(mat,pos,pos);positionsValue[_i668+0]=pos[0];positionsValue[_i668+1]=pos[1];positionsValue[_i668+2]=pos[2];}}if(_this189._transform){var _mat=math.mat4(_this189._transform);var _pos=math.vec3();for(var _i669=0,_len132=positionsValue.length;_i669<_len132;_i669+=3){_pos[0]=positionsValue[_i669+0];_pos[1]=positionsValue[_i669+1];_pos[2]=positionsValue[_i669+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i669+0]=_pos[0];positionsValue[_i669+1]=_pos[1];positionsValue[_i669+2]=_pos[2];}}return positionsValue;};function readColorsAndIntensities(attributesColor,attributesIntensity){var colors=attributesColor.value;var colorSize=attributesColor.size;var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i670=0,j=0,k=0,len=intensities.length;_i670<len;_i670++,k+=colorSize,j+=4){colorsCompressed[j+0]=colors[k+0];colorsCompressed[j+1]=colors[k+1];colorsCompressed[j+2]=colors[k+2];colorsCompressed[j+3]=Math.round(intensities[_i670]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i671=0,j=0,len=intensities.length;_i671<len;_i671++,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i671]/65536*255);}return colorsCompressed;}return new Promise(function(resolve,reject){if(sceneModel.destroyed){reject();return;}var stats=params.stats||{};stats.sourceFormat="LAS";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;try{var lasHeader=loadLASHeader(arrayBuffer);parse$3(arrayBuffer,LASLoader,options).then(function(parsedData){var attributes=parsedData.attributes;var loaderData=parsedData.loaderData;var pointsFormatId=loaderData.pointsFormatId!==undefined?loaderData.pointsFormatId:-1;if(!attributes.POSITION){sceneModel.finalize();reject("No positions found in file");return;}var positionsValue;var colorsCompressed;switch(pointsFormatId){case 0:positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 1:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 2:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;case 3:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;}var pointsChunks=chunkArray(positionsValue,MAX_VERTICES*3);var colorsChunks=chunkArray(colorsCompressed,MAX_VERTICES*4);var meshIds=[];for(var _i672=0,len=pointsChunks.length;_i672<len;_i672++){var meshId="".concat(params.isManifest?'model'+params.index:'',"pointsMesh").concat(_i672);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i672],colorsCompressed:_i672<colorsChunks.length?colorsChunks[_i672]:null});}var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this189.viewer.metaScene.createMetaModel(metaModelId,params.metaModelJSON,options);}else if(params.loadMetadata!==false){var rootMetaObjectId=math.createUUID();var metadata={projectId:"",author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[{id:rootMetaObjectId,name:"Model",type:"Model"},{id:pointsObjectId,name:"PointCloud (LAS)",type:"PointCloud",parent:rootMetaObjectId,attributes:lasHeader||{}}],propertySets:[]};var _metaModelId=sceneModel.id;_this189.viewer.metaScene.createMetaModel(_metaModelId,metadata,options);}resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);return LASLoaderPlugin;}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i673=0;_i673<array.length;_i673+=chunkSize){result.push(array.slice(_i673,_i673+chunkSize));}return result;}function getBaseDirectory(filePath){if(filePath.indexOf('?')>-1){filePath=filePath.split('?')[0];}var pathArray=filePath.split('/');pathArray.pop();// Remove the file name or the last segment of the path
|
|
33285
|
+
return pathArray.join('/')+'/';}/**
|
|
33269
33286
|
* Default data access strategy for {@link CityJSONLoaderPlugin}.
|
|
33270
33287
|
*/var CityJSONDefaultDataSource=/*#__PURE__*/function(){function CityJSONDefaultDataSource(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,CityJSONDefaultDataSource);this.cacheBuster=cfg.cacheBuster!==false;}_createClass(CityJSONDefaultDataSource,[{key:"_cacheBusterURL",value:function _cacheBusterURL(url){if(!this.cacheBuster){return url;}var timestamp=new Date().getTime();if(url.indexOf('?')>-1){return url+'&_='+timestamp;}else{return url+'?_='+timestamp;}}/**
|
|
33271
33288
|
* Gets the contents of the given CityJSON file.
|
|
@@ -33375,7 +33392,7 @@ sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscri
|
|
|
33375
33392
|
*
|
|
33376
33393
|
* @class CityJSONLoaderPlugin
|
|
33377
33394
|
* @since 2.0.13
|
|
33378
|
-
*/var CityJSONLoaderPlugin=/*#__PURE__*/function(
|
|
33395
|
+
*/var CityJSONLoaderPlugin=/*#__PURE__*/function(_Plugin22){_inherits(CityJSONLoaderPlugin,_Plugin22);var _super170=_createSuper(CityJSONLoaderPlugin);/**
|
|
33379
33396
|
* @constructor
|
|
33380
33397
|
*
|
|
33381
33398
|
* @param {Viewer} viewer The Viewer.
|
|
@@ -33383,7 +33400,7 @@ sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscri
|
|
|
33383
33400
|
* @param {String} [cfg.id="cityJSONLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
33384
33401
|
* @param {Object} [cfg.dataSource] A custom data source through which the CityJSONLoaderPlugin can load model and
|
|
33385
33402
|
* metadata files. Defaults to an instance of {@link CityJSONDefaultDataSource}, which loads over HTTP.
|
|
33386
|
-
*/function CityJSONLoaderPlugin(viewer){var
|
|
33403
|
+
*/function CityJSONLoaderPlugin(viewer){var _this190;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CityJSONLoaderPlugin);_this190=_super170.call(this,"cityJSONLoader",viewer,cfg);_this190.dataSource=cfg.dataSource;return _this190;}/**
|
|
33387
33404
|
* Gets the custom data source through which the CityJSONLoaderPlugin can load CityJSON files.
|
|
33388
33405
|
*
|
|
33389
33406
|
* Default value is {@link CityJSONDefaultDataSource}, which loads via HTTP.
|
|
@@ -33415,18 +33432,18 @@ sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscri
|
|
|
33415
33432
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
33416
33433
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
|
|
33417
33434
|
*/},{key:"load",value:function load(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,edges:true}));if(!params.src&&!params.cityJSON){this.error("load() param expected: src or cityJSON");return sceneModel;// Return new empty model
|
|
33418
|
-
}var options={};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.cityJSON,params,options,sceneModel);spinner.processes--;}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var
|
|
33435
|
+
}var options={};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.cityJSON,params,options,sceneModel);spinner.processes--;}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this191=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getCityJSON(params.src,function(data){_this191._parseModel(data,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this191.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(data,params,options,sceneModel){if(sceneModel.destroyed){return;}var vertices=data.transform?this._transformVertices(data.vertices,data.transform,options.rotateX):data.vertices;var stats=params.stats||{};stats.sourceFormat=data.type||"CityJSON";stats.schemaVersion=data.version||"";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;var loadMetadata=params.loadMetadata!==false;var rootMetaObject=loadMetadata?{id:math.createUUID(),name:"Model",type:"Model"}:null;var metadata=loadMetadata?{id:"",projectId:"",author:"",createdAt:"",schema:data.version||"",creatingApplication:"",metaObjects:[rootMetaObject],propertySets:[]}:null;var ctx={data:data,vertices:vertices,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,rootMetaObject:rootMetaObject,nextId:0,stats:stats};this._parseCityJSON(ctx);sceneModel.finalize();if(loadMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
33419
33436
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
33420
|
-
});}},{key:"_transformVertices",value:function _transformVertices(vertices,transform,rotateX){var transformedVertices=[];var scale=transform.scale||math.vec3([1,1,1]);var translate=transform.translate||math.vec3([0,0,0]);for(var
|
|
33437
|
+
});}},{key:"_transformVertices",value:function _transformVertices(vertices,transform,rotateX){var transformedVertices=[];var scale=transform.scale||math.vec3([1,1,1]);var translate=transform.translate||math.vec3([0,0,0]);for(var _i674=0,j=0;_i674<vertices.length;_i674++,j+=3){var x=vertices[_i674][0]*scale[0]+translate[0];var y=vertices[_i674][1]*scale[1]+translate[1];var _z5=vertices[_i674][2]*scale[2]+translate[2];if(rotateX){transformedVertices.push([x,_z5,y]);}else{transformedVertices.push([x,y,_z5]);}}return transformedVertices;}},{key:"_parseCityJSON",value:function _parseCityJSON(ctx){var data=ctx.data;var cityObjects=data.CityObjects;for(var objectId in cityObjects){if(cityObjects.hasOwnProperty(objectId)){var cityObject=cityObjects[objectId];this._parseCityObject(ctx,cityObject,objectId);}}}},{key:"_parseCityObject",value:function _parseCityObject(ctx,cityObject,objectId){var sceneModel=ctx.sceneModel;var data=ctx.data;if(ctx.loadMetadata){var metaObjectId=objectId;var metaObjectType=cityObject.type;var metaObjectName=metaObjectType+" : "+objectId;var parentMetaObjectId=cityObject.parents?cityObject.parents[0]:ctx.rootMetaObject.id;ctx.metadata.metaObjects.push({id:metaObjectId,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId});}ctx.stats.numMetaObjects++;if(!(cityObject.geometry&&cityObject.geometry.length>0)){return;}var meshIds=[];for(var _i675=0,len=cityObject.geometry.length;_i675<len;_i675++){var geometry=cityObject.geometry[_i675];var objectMaterial=void 0;var surfaceMaterials=void 0;var appearance=data.appearance;if(appearance){var materials=appearance.materials;if(materials){var geometryMaterial=geometry.material;if(geometryMaterial){var themeIds=Object.keys(geometryMaterial);if(themeIds.length>0){var themeId=themeIds[0];var theme=geometryMaterial[themeId];if(theme.value!==undefined){objectMaterial=materials[theme.value];}else{var values=theme.values;if(values){surfaceMaterials=[];for(var j=0,lenj=values.length;j<lenj;j++){var value=values[_i675];var surfaceMaterial=materials[value];surfaceMaterials.push(surfaceMaterial);}}}}}}}if(surfaceMaterials){this._parseGeometrySurfacesWithOwnMaterials(ctx,geometry,surfaceMaterials,meshIds);}else{this._parseGeometrySurfacesWithSharedMaterial(ctx,geometry,objectMaterial,meshIds);}}if(meshIds.length>0){sceneModel.createEntity({id:objectId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;}}},{key:"_parseGeometrySurfacesWithOwnMaterials",value:function _parseGeometrySurfacesWithOwnMaterials(ctx,geometry,surfaceMaterials,meshIds){var geomType=geometry.type;switch(geomType){case"MultiPoint":break;case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":var surfaces=geometry.boundaries;this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,surfaces,meshIds);break;case"Solid":var shells=geometry.boundaries;for(var j=0;j<shells.length;j++){var _surfaces=shells[j];this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,_surfaces,meshIds);}break;case"MultiSolid":case"CompositeSolid":var solids=geometry.boundaries;for(var _j6=0;_j6<solids.length;_j6++){for(var k=0;k<solids[_j6].length;k++){var _surfaces2=solids[_j6][k];this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,_surfaces2,meshIds);}}break;}}},{key:"_parseSurfacesWithOwnMaterials",value:function _parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,surfaces,meshIds){var vertices=ctx.vertices;var sceneModel=ctx.sceneModel;for(var _i676=0;_i676<surfaces.length;_i676++){var surface=surfaces[_i676];var surfaceMaterial=surfaceMaterials[_i676]||{diffuseColor:[0.8,0.8,0.8],transparency:1.0};var face=[];var holes=[];var sharedIndices=[];var geometryCfg={positions:[],indices:[]};for(var j=0;j<surface.length;j++){if(face.length>0){holes.push(face.length);}var newFace=this._extractLocalIndices(ctx,surface[j],sharedIndices,geometryCfg);face.push.apply(face,_toConsumableArray(newFace));}if(face.length===3){// Triangle
|
|
33421
33438
|
geometryCfg.indices.push(face[0]);geometryCfg.indices.push(face[1]);geometryCfg.indices.push(face[2]);}else if(face.length>3){// Polygon
|
|
33422
33439
|
// Prepare to triangulate
|
|
33423
33440
|
var pList=[];for(var k=0;k<face.length;k++){pList.push({x:vertices[sharedIndices[face[k]]][0],y:vertices[sharedIndices[face[k]]][1],z:vertices[sharedIndices[face[k]]][2]});}var normal=this._getNormalOfPositions(pList,math.vec3());// Convert to 2D
|
|
33424
33441
|
var pv=[];for(var _k3=0;_k3<pList.length;_k3++){this._to2D(pList[_k3],normal,tempVec2a);pv.unshift(tempVec2a[0]);pv.unshift(tempVec2a[1]);}// Triangulate
|
|
33425
33442
|
var tr=earcut(pv,holes,2);// Create triangles
|
|
33426
33443
|
for(var _k4=0;_k4<tr.length;_k4+=3){geometryCfg.indices.unshift(face[tr[_k4]]);geometryCfg.indices.unshift(face[tr[_k4+1]]);geometryCfg.indices.unshift(face[tr[_k4+2]]);}}var meshId=""+ctx.nextId++;sceneModel.createMesh({id:meshId,primitive:"triangles",positions:geometryCfg.positions,indices:geometryCfg.indices,color:surfaceMaterial&&surfaceMaterial.diffuseColor?surfaceMaterial.diffuseColor:[0.8,0.8,0.8],opacity:surfaceMaterial&&surfaceMaterial.transparency!==undefined?1.0-surfaceMaterial.transparency:1.0});meshIds.push(meshId);ctx.stats.numGeometries++;ctx.stats.numVertices+=geometryCfg.positions.length/3;ctx.stats.numTriangles+=geometryCfg.indices.length/3;}}},{key:"_parseGeometrySurfacesWithSharedMaterial",value:function _parseGeometrySurfacesWithSharedMaterial(ctx,geometry,objectMaterial,meshIds){var sceneModel=ctx.sceneModel;var sharedIndices=[];var geometryCfg={positions:[],indices:[]};var geomType=geometry.type;switch(geomType){case"MultiPoint":break;case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":var surfaces=geometry.boundaries;this._parseSurfacesWithSharedMaterial(ctx,surfaces,sharedIndices,geometryCfg);break;case"Solid":var shells=geometry.boundaries;for(var j=0;j<shells.length;j++){var _surfaces3=shells[j];this._parseSurfacesWithSharedMaterial(ctx,_surfaces3,sharedIndices,geometryCfg);}break;case"MultiSolid":case"CompositeSolid":var solids=geometry.boundaries;for(var _j7=0;_j7<solids.length;_j7++){for(var k=0;k<solids[_j7].length;k++){var _surfaces4=solids[_j7][k];this._parseSurfacesWithSharedMaterial(ctx,_surfaces4,sharedIndices,geometryCfg);}}break;}if(geometryCfg.positions.length>0&&geometryCfg.indices.length>0){var meshId=""+ctx.nextId++;sceneModel.createMesh({id:meshId,primitive:"triangles",positions:geometryCfg.positions,indices:geometryCfg.indices,color:objectMaterial&&objectMaterial.diffuseColor?objectMaterial.diffuseColor:[0.8,0.8,0.8],opacity:1.0//opacity: (objectMaterial && objectMaterial.transparency !== undefined) ? (1.0 - objectMaterial.transparency) : 1.0
|
|
33427
|
-
});meshIds.push(meshId);ctx.stats.numGeometries++;ctx.stats.numVertices+=geometryCfg.positions.length/3;ctx.stats.numTriangles+=geometryCfg.indices.length/3;}}},{key:"_parseSurfacesWithSharedMaterial",value:function _parseSurfacesWithSharedMaterial(ctx,surfaces,sharedIndices,primitiveCfg){var vertices=ctx.vertices;for(var
|
|
33444
|
+
});meshIds.push(meshId);ctx.stats.numGeometries++;ctx.stats.numVertices+=geometryCfg.positions.length/3;ctx.stats.numTriangles+=geometryCfg.indices.length/3;}}},{key:"_parseSurfacesWithSharedMaterial",value:function _parseSurfacesWithSharedMaterial(ctx,surfaces,sharedIndices,primitiveCfg){var vertices=ctx.vertices;for(var _i677=0;_i677<surfaces.length;_i677++){var boundary=[];var holes=[];for(var j=0;j<surfaces[_i677].length;j++){if(boundary.length>0){holes.push(boundary.length);}var newBoundary=this._extractLocalIndices(ctx,surfaces[_i677][j],sharedIndices,primitiveCfg);boundary.push.apply(boundary,_toConsumableArray(newBoundary));}if(boundary.length===3){// Triangle
|
|
33428
33445
|
primitiveCfg.indices.push(boundary[0]);primitiveCfg.indices.push(boundary[1]);primitiveCfg.indices.push(boundary[2]);}else if(boundary.length>3){// Polygon
|
|
33429
|
-
var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedIndices[boundary[k]]][0],y:vertices[sharedIndices[boundary[k]]][1],z:vertices[sharedIndices[boundary[k]]][2]});}var normal=this._getNormalOfPositions(pList,math.vec3());var pv=[];for(var _k5=0;_k5<pList.length;_k5++){this._to2D(pList[_k5],normal,tempVec2a);pv.unshift(tempVec2a[0]);pv.unshift(tempVec2a[1]);}var tr=earcut(pv,holes,2);for(var _k6=0;_k6<tr.length;_k6+=3){primitiveCfg.indices.unshift(boundary[tr[_k6]]);primitiveCfg.indices.unshift(boundary[tr[_k6+1]]);primitiveCfg.indices.unshift(boundary[tr[_k6+2]]);}}}}},{key:"_extractLocalIndices",value:function _extractLocalIndices(ctx,boundary,sharedIndices,geometryCfg){var vertices=ctx.vertices;var newBoundary=[];for(var
|
|
33446
|
+
var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedIndices[boundary[k]]][0],y:vertices[sharedIndices[boundary[k]]][1],z:vertices[sharedIndices[boundary[k]]][2]});}var normal=this._getNormalOfPositions(pList,math.vec3());var pv=[];for(var _k5=0;_k5<pList.length;_k5++){this._to2D(pList[_k5],normal,tempVec2a);pv.unshift(tempVec2a[0]);pv.unshift(tempVec2a[1]);}var tr=earcut(pv,holes,2);for(var _k6=0;_k6<tr.length;_k6+=3){primitiveCfg.indices.unshift(boundary[tr[_k6]]);primitiveCfg.indices.unshift(boundary[tr[_k6+1]]);primitiveCfg.indices.unshift(boundary[tr[_k6+2]]);}}}}},{key:"_extractLocalIndices",value:function _extractLocalIndices(ctx,boundary,sharedIndices,geometryCfg){var vertices=ctx.vertices;var newBoundary=[];for(var _i678=0,len=boundary.length;_i678<len;_i678++){var index=boundary[_i678];if(sharedIndices.includes(index)){var vertexIndex=sharedIndices.indexOf(index);newBoundary.push(vertexIndex);}else{geometryCfg.positions.push(vertices[index][0]);geometryCfg.positions.push(vertices[index][1]);geometryCfg.positions.push(vertices[index][2]);newBoundary.push(sharedIndices.length);sharedIndices.push(index);}}return newBoundary;}},{key:"_getNormalOfPositions",value:function _getNormalOfPositions(positions,normal){for(var _i679=0;_i679<positions.length;_i679++){var nexti=_i679+1;if(nexti===positions.length){nexti=0;}normal[0]+=(positions[_i679].y-positions[nexti].y)*(positions[_i679].z+positions[nexti].z);normal[1]+=(positions[_i679].z-positions[nexti].z)*(positions[_i679].x+positions[nexti].x);normal[2]+=(positions[_i679].x-positions[nexti].x)*(positions[_i679].y+positions[nexti].y);}return math.normalizeVec3(normal);}},{key:"_to2D",value:function _to2D(_p,_n,re){var p=tempVec3a;var n=tempVec3b;var x3=tempVec3c;p[0]=_p.x;p[1]=_p.y;p[2]=_p.z;n[0]=_n.x;n[1]=_n.y;n[2]=_n.z;x3[0]=1.1;x3[1]=1.1;x3[2]=1.1;var dist=math.lenVec3(math.subVec3(x3,n));if(dist<0.01){x3[0]+=1.0;x3[1]+=2.0;x3[2]+=3.0;}var dot=math.dotVec3(x3,n);var tmp2=math.mulVec3Scalar(n,dot,math.vec3());x3[0]-=tmp2[0];x3[1]-=tmp2[1];x3[2]-=tmp2[2];math.normalizeVec3(x3);var y3=math.cross3Vec3(n,x3,math.vec3());var x=math.dotVec3(p,x3);var y=math.dotVec3(p,y3);re[0]=x;re[1]=y;}}]);return CityJSONLoaderPlugin;}(Plugin);/**
|
|
33430
33447
|
* Default data access strategy for {@link DotBIMLoaderPlugin}.
|
|
33431
33448
|
*
|
|
33432
33449
|
* This just loads assets using XMLHttpRequest.
|
|
@@ -33647,7 +33664,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
33647
33664
|
* });
|
|
33648
33665
|
* ````
|
|
33649
33666
|
* @class DotBIMLoaderPlugin
|
|
33650
|
-
*/var DotBIMLoaderPlugin=/*#__PURE__*/function(
|
|
33667
|
+
*/var DotBIMLoaderPlugin=/*#__PURE__*/function(_Plugin23){_inherits(DotBIMLoaderPlugin,_Plugin23);var _super171=_createSuper(DotBIMLoaderPlugin);/**
|
|
33651
33668
|
* @constructor
|
|
33652
33669
|
*
|
|
33653
33670
|
* @param {Viewer} viewer The Viewer.
|
|
@@ -33655,7 +33672,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
33655
33672
|
* @param {String} [cfg.id="DotBIMLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
33656
33673
|
* @param {Object} [cfg.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
33657
33674
|
* @param {Object} [cfg.dataSource] A custom data source through which the DotBIMLoaderPlugin can load metadata, glTF and binary attachments. Defaults to an instance of {@link DotBIMDefaultDataSource}, which loads over HTTP.
|
|
33658
|
-
*/function DotBIMLoaderPlugin(viewer){var
|
|
33675
|
+
*/function DotBIMLoaderPlugin(viewer){var _this192;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DotBIMLoaderPlugin);_this192=_super171.call(this,"DotBIMLoader",viewer,cfg);_this192.dataSource=cfg.dataSource;_this192.objectDefaults=cfg.objectDefaults;return _this192;}/**
|
|
33659
33676
|
* Sets a custom data source through which the DotBIMLoaderPlugin can .BIM files.
|
|
33660
33677
|
*
|
|
33661
33678
|
* Default value is {@link DotBIMDefaultDataSource}, which loads via an XMLHttpRequest.
|
|
@@ -33699,17 +33716,17 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
33699
33716
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
33700
33717
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
33701
33718
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
|
|
33702
|
-
*/,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var
|
|
33719
|
+
*/,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this193=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,backfaces:params.backfaces,dtxEnabled:params.dtxEnabled,rotation:params.rotation,origin:params.origin}));var modelId=sceneModel.id;// In case ID was auto-generated
|
|
33703
33720
|
if(!params.src&&!params.dotBIM){this.error("load() param expected: src or dotBIM");return sceneModel;// Return new empty model
|
|
33704
|
-
}var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var
|
|
33721
|
+
}var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i680=0,len=params.includeTypes.length;_i680<len;_i680++){includeTypes[params.includeTypes[_i680]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i681=0,_len133=params.excludeTypes.length;_i681<_len133;_i681++){includeTypes[params.excludeTypes[_i681]]=true;}}var parseDotBIM=function parseDotBIM(ctx){var fileData=ctx.fileData;var sceneModel=ctx.sceneModel;var dbMeshLoaded={};var projectId=math.createUUID();var siteId=math.createUUID();var buildingId=math.createUUID();var buildingStoryId=math.createUUID();var metaModelData={metaObjects:[{id:projectId,name:"Project",type:"Project",parent:null},{id:siteId,name:"Site",type:"Site",parent:projectId},{id:buildingId,name:"Building",type:"Building",parent:siteId},{id:buildingStoryId,name:"BuildingStorey",type:"BuildingStorey",parent:buildingId}],propertySets:[]};var parseDBMesh=function parseDBMesh(dbMeshId,element){if(dbMeshLoaded[dbMeshId]){return;}var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});sceneModel.createGeometry({id:dbMeshId,primitive:"triangles",positions:dbMesh.coordinates,indices:dbMesh.indices});dbMeshLoaded[dbMeshId]=true;};var dbElements=fileData.elements;var _loop12=function _loop12(_i682,_len134){var element=dbElements[_i682];var elementType=element.type;if(excludeTypes&&excludeTypes[elementType]){return"continue";}if(includeTypes&&!includeTypes[elementType]){return"continue";}var info=element.info;var objectId=element.guid!==undefined?"".concat(element.guid):info!==undefined&&info.id!==undefined?info.id:_i682;var dbMeshId=element.mesh_id;var vector=element.vector;var rotation=element.rotation;var props=objectDefaults?objectDefaults[elementType]||objectDefaults["DEFAULT"]:null;var visible=true;var pickable=true;if(element.face_colors===undefined){parseDBMesh(dbMeshId,element);var meshId="".concat(objectId,"-mesh");var _color14=element.color?[element.color.r/255.0,element.color.g/255.0,element.color.b/255.0]:[1,1,1];var _opacity7=element.color?element.color.a/255.0:1.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color14=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity7=props.opacity;}}sceneModel.createMesh({id:meshId,geometryId:dbMeshId,color:_color14,opacity:_opacity7,quaternion:rotation&&(rotation.qz!==0||rotation.qy!==0||rotation.qx!==0||rotation.qw!==1.0)?[rotation.qx,rotation.qy,rotation.qz,rotation.qw]:undefined,position:vector?[vector.x,vector.y,vector.z]:undefined});sceneModel.createEntity({id:objectId,meshIds:[meshId],visible:visible,pickable:pickable,isObject:true});}else{var faceColors=element.face_colors;var coloredTrianglesDictionary={};var currentTriangleIndicesCount=0;var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});for(var _i683=0,_len135=faceColors.length;_i683<_len135;_i683+=4){var faceColor=[faceColors[_i683],faceColors[_i683+1],faceColors[_i683+2],faceColors[_i683+3]];if(coloredTrianglesDictionary[faceColor]===undefined){coloredTrianglesDictionary[faceColor]=[];}var indexForPoint0=dbMesh.indices[currentTriangleIndicesCount];var x0=dbMesh.coordinates[indexForPoint0*3];var y0=dbMesh.coordinates[indexForPoint0*3+1];var z0=dbMesh.coordinates[indexForPoint0*3+2];var indexForPoint1=dbMesh.indices[currentTriangleIndicesCount+1];var x1=dbMesh.coordinates[indexForPoint1*3];var y1=dbMesh.coordinates[indexForPoint1*3+1];var z1=dbMesh.coordinates[indexForPoint1*3+2];var indexForPoint2=dbMesh.indices[currentTriangleIndicesCount+2];var x2=dbMesh.coordinates[indexForPoint2*3];var y2=dbMesh.coordinates[indexForPoint2*3+1];var z2=dbMesh.coordinates[indexForPoint2*3+2];coloredTrianglesDictionary[faceColor].push(x0,y0,z0,x1,y1,z1,x2,y2,z2);currentTriangleIndicesCount+=3;}var meshIds=[];for(var _i684=0,_Object$entries8=Object.entries(coloredTrianglesDictionary);_i684<_Object$entries8.length;_i684++){var _Object$entries8$_i=_slicedToArray(_Object$entries8[_i684],2),_faceColor=_Object$entries8$_i[0],trianglesCoordinates=_Object$entries8$_i[1];sceneModel.createGeometry({id:"".concat(dbMeshId,"-").concat(_faceColor),primitive:"triangles",positions:trianglesCoordinates,indices:_toConsumableArray(Array(trianglesCoordinates.length/3).keys())});var _meshId3="".concat(objectId,"-mesh-").concat(_faceColor);var faceColorArray=_faceColor.split(',').map(Number);var _color15=[faceColorArray[0]/255.0,faceColorArray[1]/255.0,faceColorArray[2]/255.0];var _opacity8=faceColorArray[3]/255.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color15=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity8=props.opacity;}}sceneModel.createMesh({id:_meshId3,geometryId:"".concat(dbMeshId,"-").concat(_faceColor),color:_color15,opacity:_opacity8,quaternion:rotation&&(rotation.qz!==0||rotation.qy!==0||rotation.qx!==0||rotation.qw!==1.0)?[rotation.qx,rotation.qy,rotation.qz,rotation.qw]:undefined,position:vector?[vector.x,vector.y,vector.z]:undefined});meshIds.push(_meshId3);}sceneModel.createEntity({id:objectId,meshIds:meshIds,visible:visible,pickable:pickable,isObject:true});}var properties=[];for(var infoKey in info){properties.push({name:infoKey,value:info[infoKey]});}metaModelData.propertySets.push({id:objectId,name:"Properties",properties:properties});metaModelData.metaObjects.push({id:objectId,name:info&&info.Name&&info.Name!=="None"?info.Name:"".concat(element.type," ").concat(objectId),type:element.type,parent:buildingStoryId,propertySetIds:[objectId]});};for(var _i682=0,_len134=dbElements.length;_i682<_len134;_i682++){var _ret2=_loop12(_i682,_len134);if(_ret2==="continue")continue;}sceneModel.finalize();_this193.viewer.metaScene.createMetaModel(modelId,metaModelData);sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
33705
33722
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
33706
33723
|
});};if(params.src){var src=params.src;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getDotBIM(src,function(fileData){// OK
|
|
33707
|
-
var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);
|
|
33724
|
+
var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);_this193.viewer.scene.canvas.spinner.processes--;},function(err){_this193.viewer.scene.canvas.spinner.processes--;_this193.error(err);});}else if(params.dotBIM){var ctx={fileData:params.dotBIM,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);}sceneModel.once("destroyed",function(){_this193.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
|
|
33708
33725
|
* Destroys this DotBIMLoaderPlugin.
|
|
33709
|
-
*/},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(DotBIMLoaderPlugin.prototype),"destroy",this).call(this);}}]);return DotBIMLoaderPlugin;}(Plugin);var hex2rgb=function hex2rgb(color){var rgb=function rgb(idx){return parseInt(color.substr(idx+1,2),16)/255;};return[rgb(0),rgb(2),rgb(4)];};var triangulateEarClipping=function triangulateEarClipping(planeCoords){var polygonVertices=[];for(var
|
|
33726
|
+
*/},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(DotBIMLoaderPlugin.prototype),"destroy",this).call(this);}}]);return DotBIMLoaderPlugin;}(Plugin);var hex2rgb=function hex2rgb(color){var rgb=function rgb(idx){return parseInt(color.substr(idx+1,2),16)/255;};return[rgb(0),rgb(2),rgb(4)];};var triangulateEarClipping=function triangulateEarClipping(planeCoords){var polygonVertices=[];for(var _i685=0;_i685<planeCoords.length;++_i685){polygonVertices.push(_i685);}var isCCW=function(){var ba=math.vec2();var bc=math.vec2();var anglesSum=0;for(var _i686=0;_i686<polygonVertices.length;++_i686){var _a12=planeCoords[polygonVertices[_i686]];var b=planeCoords[polygonVertices[(_i686+1)%polygonVertices.length]];var c=planeCoords[polygonVertices[(_i686+2)%polygonVertices.length]];math.subVec2(_a12,b,ba);math.subVec2(c,b,bc);var theta=math.dotVec2(ba,bc)/Math.sqrt(math.sqLenVec2(ba)*math.sqLenVec2(bc));var angle=Math.acos(Math.max(-1,Math.min(theta,1)));var convex=ba[0]*bc[1]-ba[1]*bc[0]>=0;anglesSum+=convex?angle:2*Math.PI-angle;}return anglesSum<polygonVertices.length*Math.PI;}();var pointInTriangle=function(){var sign=function sign(p1,p2,p3){return(p1[0]-p3[0])*(p2[1]-p3[1])-(p2[0]-p3[0])*(p1[1]-p3[1]);};return function(pt,v1,v2,v3){var d1=sign(pt,v1,v2);var d2=sign(pt,v2,v3);var d3=sign(pt,v3,v1);var has_neg=d1<0||d2<0||d3<0;var has_pos=d1>0||d2>0||d3>0;return!(has_neg&&has_pos);};}();var baseTriangles=[];var vertices=(isCCW?polygonVertices:polygonVertices.slice(0).reverse()).map(function(i){return{idx:i};});vertices.forEach(function(v,i){v.prev=vertices[(i-1+vertices.length)%vertices.length];v.next=vertices[(i+1)%vertices.length];});var ba=math.vec2();var bc=math.vec2();while(vertices.length>2){var earIdx=0;var _loop13=function _loop13(){if(earIdx>=vertices.length){throw"isCCW = ".concat(isCCW,"; earIdx = ").concat(earIdx,"; len = ").concat(vertices.length);}var v=vertices[earIdx];var a=planeCoords[v.prev.idx];var b=planeCoords[v.idx];var c=planeCoords[v.next.idx];math.subVec2(a,b,ba);math.subVec2(c,b,bc);if(ba[0]*bc[1]-ba[1]*bc[0]>=0// a convex vertex
|
|
33710
33727
|
&&vertices.every(// no other vertices inside
|
|
33711
|
-
function(vv){return vv===v||vv===v.prev||vv===v.next||!pointInTriangle(planeCoords[vv.idx],a,b,c);}))return"break";++earIdx;};while(true){var _ret3=
|
|
33712
|
-
var ind=(
|
|
33728
|
+
function(vv){return vv===v||vv===v.prev||vv===v.next||!pointInTriangle(planeCoords[vv.idx],a,b,c);}))return"break";++earIdx;};while(true){var _ret3=_loop13();if(_ret3==="break")break;}var ear=vertices[earIdx];vertices.splice(earIdx,1);baseTriangles.push([ear.idx,ear.next.idx,ear.prev.idx]);var prev=ear.prev;prev.next=ear.next;var next=ear.next;next.prev=ear.prev;}return[planeCoords,baseTriangles,isCCW];};var marker3D=function marker3D(scene,color){var marker=new Dot3D(scene,{},scene.canvas.canvas.parentNode,{borderColor:"white",fillColor:color,zIndex:100});return{update:function update(worldPos){if(worldPos){marker.worldPos=worldPos;}marker.setVisible(!!worldPos);},setHighlighted:function setHighlighted(h){return marker.setHighlighted(h);},getCanvasPos:function getCanvasPos(){return marker.canvasPos;},getWorldPos:function getWorldPos(){return marker.worldPos;},destroy:function destroy(){return marker.destroy();}};};var wire3D=function wire3D(scene,color,startWorldPos){var wire=new Wire3D(scene,scene.canvas.canvas.ownerDocument.body,{color:color,thickness:1,thicknessClickable:6});wire.setVisible(false);return{update:function update(endWorldPos){if(endWorldPos){wire.setEnds(startWorldPos,endWorldPos);}wire.setVisible(!!endWorldPos);},destroy:function destroy(){return wire.destroy();}};};var basePolygon3D=function basePolygon3D(scene,color,alpha){var mesh=null;var updateBase=function updateBase(points){if(points){if(mesh){mesh.destroy();}try{var _ref33,_ref34;var _triangulateEarClippi=triangulateEarClipping(points.map(function(p){return[p[0],p[2]];})),_triangulateEarClippi2=_slicedToArray(_triangulateEarClippi,2),baseVertices=_triangulateEarClippi2[0],baseTriangles=_triangulateEarClippi2[1];var positions=(_ref33=[]).concat.apply(_ref33,_toConsumableArray(baseVertices.map(function(p){return[p[0],points[0][1],p[1]];})));// To convert from Float64Array into an Array
|
|
33729
|
+
var ind=(_ref34=[]).concat.apply(_ref34,_toConsumableArray(baseTriangles));mesh=new Mesh(scene,{pickable:false,// otherwise there's a WebGL error inside PickMeshRenderer.prototype.drawMesh
|
|
33713
33730
|
geometry:new ReadableGeometry(scene,{positions:positions,indices:ind,normals:math.buildNormals(positions,ind)}),material:new PhongMaterial(scene,{alpha:alpha!==undefined?alpha:0.5,backfaces:true,diffuse:hex2rgb(color)})});}catch(e){mesh=null;}}if(mesh){mesh.visible=!!points;}};updateBase(null);return{updateBase:updateBase,destroy:function destroy(){return mesh&&mesh.destroy();}};};var startAARectCreateUI=function startAARectCreateUI(scene,markersColor,pointerLens,select3dPoint,withPoints,onPointsSelected){var marker1=marker3D(scene,markersColor);var marker2=marker3D(scene,markersColor);var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker1.update(null);},function(canvasPos,worldPos){updatePointerLens(canvasPos);marker1.update(worldPos);},function(point1CanvasPos,point1WorldPos){marker1.update(point1WorldPos);deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker2.update(null);withPoints(null);},function(canvasPos,point2WorldPos){updatePointerLens(canvasPos);marker2.update(point2WorldPos);withPoints(math.distVec3(point1WorldPos,point2WorldPos)>0.01&&[point1WorldPos,point2WorldPos]);},function(point2CanvasPos,point2WorldPos){// `marker2.update' makes sure marker's position has been updated from its default [0,0,0]
|
|
33714
33731
|
// This works around an unidentified bug somewhere around OcclusionLayer, that causes error
|
|
33715
33732
|
// [.WebGL-0x13400c47e00] GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call
|
|
@@ -33717,22 +33734,22 @@ marker2.update(point2WorldPos);marker1.destroy();marker2.destroy();updatePointer
|
|
|
33717
33734
|
* @desc Renders a transparent box between two 3D points.
|
|
33718
33735
|
*
|
|
33719
33736
|
* See {@link ZonesPlugin} for more info.
|
|
33720
|
-
*/var Zone=/*#__PURE__*/function(_Component42){_inherits(Zone,_Component42);var
|
|
33737
|
+
*/var Zone=/*#__PURE__*/function(_Component42){_inherits(Zone,_Component42);var _super172=_createSuper(Zone);/**
|
|
33721
33738
|
* @private
|
|
33722
|
-
*/function Zone(plugin){var
|
|
33739
|
+
*/function Zone(plugin){var _this194;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Zone);_this194=_super172.call(this,plugin.viewer.scene,cfg);/**
|
|
33723
33740
|
* The {@link ZonesPlugin} that owns this Zone.
|
|
33724
33741
|
* @type {ZonesPlugin}
|
|
33725
|
-
*/
|
|
33742
|
+
*/_this194.plugin=plugin;_this194._container=cfg.container;if(!_this194._container){throw"config missing: container";}_this194._eventSubs={};_this194.plugin.viewer.scene;_this194._geometry=cfg.geometry;cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this194));_this194.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover',event));}:null;cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this194));_this194.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave',event));}:null;cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this194));}:null;_this194._alpha="alpha"in cfg&&cfg.alpha!==undefined?cfg.alpha:0.5;_this194.color=cfg.color;_this194._visible=true;_this194._rebuildMesh();return _this194;}_createClass(Zone,[{key:"_rebuildMesh",value:function _rebuildMesh(){var _ref35,_this195=this;var scene=this.plugin.viewer.scene;var planeCoords=this._geometry.planeCoordinates.slice();var downward=this._geometry.height<0;var altitude=this._geometry.altitude+(downward?this._geometry.height:0);var height=this._geometry.height*(downward?-1:1);var _triangulateEarClippi3=triangulateEarClipping(planeCoords),_triangulateEarClippi4=_slicedToArray(_triangulateEarClippi3,3),baseVertices=_triangulateEarClippi4[0],baseTriangles=_triangulateEarClippi4[1],isCCW=_triangulateEarClippi4[2];// TODO: prevent crossing edges
|
|
33726
33743
|
var pos=[];var ind=[];var addPlane=function addPlane(isCeiling){var baseIdx=pos.length;var _iterator60=_createForOfIteratorHelper(baseVertices),_step60;try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var c=_step60.value;pos.push([c[0],altitude+(isCeiling?height:0),c[1]]);}}catch(err){_iterator60.e(err);}finally{_iterator60.f();}var _iterator61=_createForOfIteratorHelper(baseTriangles),_step61;try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var t=_step61.value;ind.push.apply(ind,_toConsumableArray((isCeiling?t:t.slice(0).reverse()).map(function(i){return i+baseIdx;})));}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}};addPlane(false);// floor
|
|
33727
33744
|
addPlane(true);// ceiling
|
|
33728
33745
|
// sides
|
|
33729
|
-
var
|
|
33730
|
-
var volume=0;var _area4=0;var geo=this._zoneMesh.geometry;var pts=[math.vec3(),math.vec3(),math.vec3()];var tmpVec3=math.vec3();for(var
|
|
33746
|
+
var _loop14=function _loop14(_i687){var a=baseVertices[_i687];var b=baseVertices[(baseVertices.length+_i687+(isCCW?1:-1))%baseVertices.length];var f=altitude;var c=altitude+height;var baseIdx=pos.length;pos.push([a[0],f,a[1]],[b[0],f,b[1]],[b[0],c,b[1]],[a[0],c,a[1]]);ind.push.apply(ind,_toConsumableArray([0,1,2,0,2,3].map(function(i){return i+baseIdx;})));};for(var _i687=0;_i687<baseVertices.length;++_i687){_loop14(_i687);}if(this._zoneMesh){this._zoneMesh.destroy();}var min=function min(idx){return Math.min.apply(Math,_toConsumableArray(pos.map(function(p){return p[idx];})));};var max=function max(idx){return Math.max.apply(Math,_toConsumableArray(pos.map(function(p){return p[idx];})));};var xmin=min(0);var ymin=min(1);var zmin=min(2);var xmax=max(0);var ymax=max(1);var zmax=max(2);this._center=math.vec3([(xmin+xmax)/2,(ymin+ymax)/2,(zmin+zmax)/2]);var positions=(_ref35=[]).concat.apply(_ref35,_toConsumableArray(pos.map(function(p){return math.subVec3(p,_this195._center,p);})));this._zoneMesh=new Mesh(scene,{origin:this._center,edges:this._edges,geometry:new ReadableGeometry(scene,{positions:positions,indices:ind,normals:math.buildNormals(positions,ind)}),material:new PhongMaterial(scene,{alpha:this._alpha,backfaces:true,diffuse:hex2rgb(this._color)}),visible:this._visible});this._zoneMesh.highlighted=this._highlighted;this._zoneMesh.zone=this;{var _u2=math.vec2();var v=math.vec2();var baseArea=0;var _iterator62=_createForOfIteratorHelper(baseTriangles),_step62;try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var t=_step62.value;var p0=baseVertices[t[0]];var p1=baseVertices[t[1]];var p2=baseVertices[t[2]];math.subVec2(p1,p0,_u2);math.subVec2(p2,p0,v);baseArea+=Math.abs(_u2[0]*v[1]-_u2[1]*v[0]);}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}this._baseArea=baseArea/2;}this._metrics=null;}},{key:"baseArea",get:function get(){return this._baseArea;}},{key:"area",get:function get(){return this._getMetrics().area;}},{key:"volume",get:function get(){return this._getMetrics().volume;}},{key:"_getMetrics",value:function _getMetrics(){if(this._metrics===null){// Sum the volume of tetrahedrons formed by the origin and face triangles
|
|
33747
|
+
var volume=0;var _area4=0;var geo=this._zoneMesh.geometry;var pts=[math.vec3(),math.vec3(),math.vec3()];var tmpVec3=math.vec3();for(var _i688=0;_i688<geo.indices.length;_i688+=3){for(var off=0;off<3;++off){var _p5=pts[off];var pIdx=3*geo.indices[_i688+off];for(var c=0;c<3;++c){_p5[c]=geo.positions[pIdx+c];}}volume+=math.dotVec3(pts[0],math.cross3Vec3(pts[1],pts[2],tmpVec3));math.subVec3(pts[1],pts[0],pts[1]);math.subVec3(pts[2],pts[0],pts[2]);_area4+=math.lenVec3(math.cross3Vec3(pts[1],pts[2],tmpVec3));}this._metrics={area:_area4/2,volume:volume/6};}return this._metrics;}},{key:"sectionedAverage",value:function sectionedAverage(sectionPlanes){var planeCoords=this._geometry.planeCoordinates.slice();var faces=[];{var h=this._geometry.height;var _a13=this._geometry.altitude;var c=_a13+Math.max(0,h);var _f2=_a13+Math.min(0,h);var addPlane=function addPlane(isCeiling){var face=planeCoords.map(function(p){return[p[0],isCeiling?c:_f2,p[1]];});faces.push(isCeiling?face:face.slice(0).reverse());};addPlane(true);// ceiling
|
|
33731
33748
|
addPlane(false);// floor
|
|
33732
33749
|
// sides
|
|
33733
|
-
var _p6=function _p6(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var
|
|
33734
|
-
var polygonType=0;var
|
|
33735
|
-
switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.push(face);break;case BACK:break;case SPANNING:var _f4=[];for(var
|
|
33750
|
+
var _p6=function _p6(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var _i689=0;_i689<planeCoords.length;++_i689){var _j8=(_i689+1)%planeCoords.length;faces.push([_p6(_i689,_f2),_p6(_j8,_f2),_p6(_j8,c),_p6(_i689,c)]);}}var _iterator63=_createForOfIteratorHelper(sectionPlanes),_step63;try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){var s=_step63.value;var dir=s.dir;var dist=s.dist;var newFaces=[];var _iterator66=_createForOfIteratorHelper(faces),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var face=_step66.value;var _EPSILON=1e-5;var COPLANAR=0;var FRONT=1;var BACK=2;var SPANNING=3;// Classify each point as well as the entire polygon into one of the above four classes.
|
|
33751
|
+
var polygonType=0;var _types=[];for(var _i690=0;_i690<face.length;_i690++){var t=math.dotVec3(dir,face[_i690])+dist;var type=t<-_EPSILON?BACK:t>_EPSILON?FRONT:COPLANAR;polygonType|=type;_types.push(type);}// Put the polygon in the correct list, splitting it when necessary.
|
|
33752
|
+
switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.push(face);break;case BACK:break;case SPANNING:var _f4=[];for(var _i691=0;_i691<face.length;_i691++){var j=(_i691+1)%face.length;var ti=_types[_i691];var tj=_types[j];var vi=face[_i691];var vj=face[j];if(ti!==BACK){_f4.push(vi);}if((ti|tj)===SPANNING){var diff=math.vec3();math.subVec3(vj,vi,diff);var _t7=-(dist+math.dotVec3(dir,vi))/math.dotVec3(dir,diff);var v=[0,0,0];math.lerpVec3(_t7,0,1,vi,vj,v);_f4.push(v);}}if(_f4.length>=3){newFaces.push(_f4);}break;}}}catch(err){_iterator66.e(err);}finally{_iterator66.f();}faces=newFaces;}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}if(faces.length===0){return null;}else{var avg=math.vec3([0,0,0]);var unique=new Set();var _iterator64=_createForOfIteratorHelper(faces),_step64;try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var _f3=_step64.value;var _iterator65=_createForOfIteratorHelper(_f3),_step65;try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var _p7=_step65.value;var id=_p7.map(function(x){return x.toFixed(3);}).join(":");if(!unique.has(id)){unique.add(id);math.addVec3(avg,_p7,avg);}}}catch(err){_iterator65.e(err);}finally{_iterator65.f();}}}catch(err){_iterator64.e(err);}finally{_iterator64.f();}math.mulVec3Scalar(avg,1/unique.size,avg);return avg;}}},{key:"center",get:function get(){return this._center;}},{key:"altitude",get:function get(){return this._geometry.altitude;},set:function set(value){this._geometry.altitude=value;this._rebuildMesh();}},{key:"height",get:function get(){return this._geometry.height;},set:function set(value){this._geometry.height=value;this._rebuildMesh();}},{key:"highlighted",get:function get(){return this._highlighted;},set:function set(value){this._highlighted=value;if(this._zoneMesh){this._zoneMesh.highlighted=value;}}},{key:"color",get:function get(){return this._color;},set:function set(value){this._color=value;if(this._zoneMesh){this._zoneMesh.material.diffuse=hex2rgb(this._color);}}},{key:"alpha",get:function get(){return this._alpha;},set:function set(value){this._alpha=value;if(this._zoneMesh){this._zoneMesh.material.alpha=this._alpha;}}},{key:"edges",get:function get(){return this._edges;},set:function set(edges){this._edges=edges;if(this._zoneMesh){this._zoneMesh.edges=this._edges;}}/**
|
|
33736
33753
|
* Sets whether this Zone is visible or not.
|
|
33737
33754
|
*
|
|
33738
33755
|
* @type {Boolean}
|
|
@@ -33775,19 +33792,19 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
33775
33792
|
*
|
|
33776
33793
|
* const zonesControl = new ZonesMouseControl(Zones)
|
|
33777
33794
|
* ````
|
|
33778
|
-
*/var ZonesAAZoneControl=/*#__PURE__*/function(_Component43){_inherits(ZonesAAZoneControl,_Component43);var
|
|
33795
|
+
*/var ZonesAAZoneControl=/*#__PURE__*/function(_Component43){_inherits(ZonesAAZoneControl,_Component43);var _super173=_createSuper(ZonesAAZoneControl);/**
|
|
33779
33796
|
* Creates a ZonesMouseControl bound to the given ZonesPlugin.
|
|
33780
33797
|
*
|
|
33781
33798
|
* @param {ZonesPlugin} zonesPlugin The ZonesPlugin to control.
|
|
33782
33799
|
* @param [cfg] Configuration
|
|
33783
33800
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
33784
|
-
*/function ZonesAAZoneControl(zonesPlugin,cfg,createSelect3dPoint){var
|
|
33801
|
+
*/function ZonesAAZoneControl(zonesPlugin,cfg,createSelect3dPoint){var _this196;_classCallCheck(this,ZonesAAZoneControl);_this196=_super173.call(this,zonesPlugin.viewer.scene);_this196.zonesPlugin=zonesPlugin;_this196.pointerLens=cfg.pointerLens;_this196.createSelect3dPoint=createSelect3dPoint;_this196._deactivate=null;return _this196;}_createClass(ZonesAAZoneControl,[{key:"active",get:function get(){return!!this._deactivate;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(this._deactivate){return;}if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=this.createSelect3dPoint(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){var basePolygon=basePolygon3D(scene,zoneColor,zoneAlpha);var deactivate=startAARectCreateUI(scene,zoneColor,self.pointerLens,select3dPoint,function(points){if(points){var p0=points[0];var p1=points[1];var min=function min(idx){return Math.min(p0[idx],p1[idx]);};var max=function max(idx){return Math.max(p0[idx],p1[idx]);};var xmin=min(0);var ymin=min(1);var zmin=min(2);var xmax=max(0);max(1);var zmax=max(2);basePolygon.updateBase([[xmin,ymin,zmax],[xmax,ymin,zmax],[xmax,ymin,zmin],[xmin,ymin,zmin]]);}else{basePolygon.updateBase(null);}},function(points){basePolygon.destroy();var zone=createAAZoneFromPoints(points[0],points[1],zoneAltitude,zoneHeight,zoneColor,zoneAlpha,zonesPlugin);var reactivate=true;self._deactivate=function(){reactivate=false;};self.fire("zoneEnd",zone);if(reactivate){rec();}}).deactivate;self._deactivate=function(){deactivate();basePolygon.destroy();};})();}},{key:"deactivate",value:function deactivate(){if(this._deactivate){this._deactivate();this._deactivate=null;}}/**
|
|
33785
33802
|
* Destroys this ZonesMouseControl.
|
|
33786
33803
|
*
|
|
33787
33804
|
* Destroys any {@link Zone} under construction by this ZonesMouseControl.
|
|
33788
|
-
*/},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesAAZoneControl.prototype),"destroy",this).call(this);}}]);return ZonesAAZoneControl;}(Component);var ZonesMouseControl=/*#__PURE__*/function(_ZonesAAZoneControl){_inherits(ZonesMouseControl,_ZonesAAZoneControl);var
|
|
33805
|
+
*/},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesAAZoneControl.prototype),"destroy",this).call(this);}}]);return ZonesAAZoneControl;}(Component);var ZonesMouseControl=/*#__PURE__*/function(_ZonesAAZoneControl){_inherits(ZonesMouseControl,_ZonesAAZoneControl);var _super174=_createSuper(ZonesMouseControl);function ZonesMouseControl(zonesPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesMouseControl);return _super174.call(this,zonesPlugin,cfg,function(viewer,ray2WorldPos){return mousePointSelector(viewer,ray2WorldPos);});}return _createClass(ZonesMouseControl);}(ZonesAAZoneControl);var ZonesTouchControl=/*#__PURE__*/function(_ZonesAAZoneControl2){_inherits(ZonesTouchControl,_ZonesAAZoneControl2);var _super175=_createSuper(ZonesTouchControl);function ZonesTouchControl(zonesPlugin){var _this197;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesTouchControl);var pointerCircle=new PointerCircle(zonesPlugin.viewer);_this197=_super175.call(this,zonesPlugin,cfg,function(viewer,ray2WorldPos){return touchPointSelector(viewer,pointerCircle,ray2WorldPos);});_this197.pointerCircle=pointerCircle;return _this197;}_createClass(ZonesTouchControl,[{key:"destroy",value:function destroy(){this.pointerCircle.destroy();_get(_getPrototypeOf(ZonesTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesTouchControl;}(ZonesAAZoneControl);/**
|
|
33789
33806
|
* ZonesPlugin documentation to be added, mostly compatible with DistanceMeasurementsPlugin.
|
|
33790
|
-
*/var ZonesPlugin=/*#__PURE__*/function(
|
|
33807
|
+
*/var ZonesPlugin=/*#__PURE__*/function(_Plugin24){_inherits(ZonesPlugin,_Plugin24);var _super176=_createSuper(ZonesPlugin);/**
|
|
33791
33808
|
* @constructor
|
|
33792
33809
|
* @param {Viewer} viewer The Viewer.
|
|
33793
33810
|
* @param {Object} [cfg] Plugin configuration.
|
|
@@ -33796,7 +33813,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
33796
33813
|
* @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
|
|
33797
33814
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
33798
33815
|
* @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
|
|
33799
|
-
*/function ZonesPlugin(viewer){var
|
|
33816
|
+
*/function ZonesPlugin(viewer){var _this198;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPlugin);_this198=_super176.call(this,"Zones",viewer);_this198._pointerLens=cfg.pointerLens;_this198._container=cfg.container||document.body;_this198._zones=[];_this198.defaultColor=cfg.defaultColor!==undefined?cfg.defaultColor:"#00BBFF";_this198.zIndex=cfg.zIndex||10000;_this198._onMouseOver=function(event,zone){_this198.fire("mouseOver",{plugin:_assertThisInitialized(_this198),zone:zone,event:event});};_this198._onMouseLeave=function(event,zone){_this198.fire("mouseLeave",{plugin:_assertThisInitialized(_this198),zone:zone,event:event});};_this198._onContextMenu=function(event,zone){_this198.fire("contextMenu",{plugin:_assertThisInitialized(_this198),zone:zone,event:event});};return _this198;}/**
|
|
33800
33817
|
* Creates a {@link Zone}.
|
|
33801
33818
|
*
|
|
33802
33819
|
* The Zone is then registered by {@link Zone#id} in {@link ZonesPlugin#zones}.
|
|
@@ -33809,7 +33826,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
33809
33826
|
* @param {Entity} params.target.entity Target Entity.
|
|
33810
33827
|
* @param {string} [params.color] The color of the length dot, wire and label.
|
|
33811
33828
|
* @returns {Zone} The new {@link Zone}.
|
|
33812
|
-
*/_createClass(ZonesPlugin,[{key:"createZone",value:function createZone(){var
|
|
33829
|
+
*/_createClass(ZonesPlugin,[{key:"createZone",value:function createZone(){var _this199=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(this.viewer.scene.components[params.id]){this.error("Viewer scene component with this ID already exists: "+params.id);delete params.id;}var zone=new Zone(this,{id:params.id,plugin:this,container:this._container,geometry:params.geometry,alpha:params.alpha,color:params.color,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});this._zones.push(zone);zone.on("destroyed",function(){var idx=_this199._zones.indexOf(zone);if(idx>=0){_this199._zones.splice(idx,1);}});this.fire("zoneCreated",zone);return zone;}/**
|
|
33813
33830
|
* Gets the existing {@link Zone}s, each mapped to its {@link Zone#id}.
|
|
33814
33831
|
*
|
|
33815
33832
|
* @type {{String:Zone}}
|
|
@@ -33820,7 +33837,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
33820
33837
|
*/},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(ZonesPlugin.prototype),"destroy",this).call(this);}}]);return ZonesPlugin;}(Plugin);var startPolysurfaceZoneCreateUI=function startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,pointerLens,zonesPlugin,select3dPoint,onZoneCreated){var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var deactivatePointSelection;var cleanups=[function(){return updatePointerLens(null);}];var basePolygon=basePolygon3D(scene,zoneColor,zoneAlpha);cleanups.push(function(){return basePolygon.destroy();});(function selectNextPoint(markers){var marker=marker3D(scene,zoneColor);var wire=markers.length>0&&wire3D(scene,zoneColor,markers[markers.length-1].getWorldPos());cleanups.push(function(){marker.destroy();wire&&wire.destroy();});var firstMarker=markers.length>0&&markers[0];var getSnappedFirst=function getSnappedFirst(canvasPos){var firstCanvasPos=firstMarker&&firstMarker.getCanvasPos();var snapToFirst=firstCanvasPos&&math.distVec2(firstCanvasPos,canvasPos)<10;return snapToFirst&&{canvasPos:firstCanvasPos,worldPos:firstMarker.getWorldPos()};};var lastSegmentIntersects=function(){var onSegment=function onSegment(p,q,r){return q[0]<=Math.max(p[0],r[0])&&q[0]>=Math.min(p[0],r[0])&&q[1]<=Math.max(p[1],r[1])&&q[1]>=Math.min(p[1],r[1]);};var orient=function orient(p,q,r){var val=(q[1]-p[1])*(r[0]-q[0])-(q[0]-p[0])*(r[1]-q[1]);// collinear
|
|
33821
33838
|
// clockwise
|
|
33822
33839
|
// counterclockwise
|
|
33823
|
-
return val===0?0:val>0?1:2;};return function(pos2D,excludeFirstSegment){var a=pos2D[pos2D.length-2];var b=pos2D[pos2D.length-1];for(var
|
|
33840
|
+
return val===0?0:val>0?1:2;};return function(pos2D,excludeFirstSegment){var a=pos2D[pos2D.length-2];var b=pos2D[pos2D.length-1];for(var _i692=excludeFirstSegment?1:0;_i692<pos2D.length-2-1;++_i692){var c=pos2D[_i692];var d=pos2D[_i692+1];var o1=orient(a,b,c);var o2=orient(a,b,d);var o3=orient(c,d,a);var o4=orient(c,d,b);if(o1!==o2&&o3!==o4||// General case
|
|
33824
33841
|
o1===0&&onSegment(a,c,b)||// a, b and c are collinear and c lies on segment ab
|
|
33825
33842
|
o2===0&&onSegment(a,d,b)||// a, b and d are collinear and d lies on segment ab
|
|
33826
33843
|
o3===0&&onSegment(c,a,d)||// c, d and a are collinear and a lies on segment cd
|
|
@@ -33828,4 +33845,4 @@ o4===0&&onSegment(c,b,d))// c, d and b are collinear and b lies on segment cd
|
|
|
33828
33845
|
{return true;}}return false;};}();deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker.update(null);wire&&wire.update(null);basePolygon.updateBase(markers.length>2?markers.map(function(m){return m.getWorldPos();}):null);},function(canvasPos,worldPos){var snappedFirst=markers.length>2&&getSnappedFirst(canvasPos);firstMarker&&firstMarker.setHighlighted(!!snappedFirst);updatePointerLens(snappedFirst?snappedFirst.canvasPos:canvasPos);marker.update(!snappedFirst&&worldPos);wire&&wire.update(snappedFirst?snappedFirst.worldPos:worldPos);if(markers.length>=2){var pos=markers.map(function(m){return m.getWorldPos();}).concat(snappedFirst?[]:[worldPos]);var inter=lastSegmentIntersects(pos.map(function(p){return[p[0],p[2]];}),snappedFirst);basePolygon.updateBase(inter?null:pos);}else basePolygon.updateBase(null);},function(canvasPos,worldPos){var snappedFirst=markers.length>2&&getSnappedFirst(canvasPos);var pos=markers.map(function(m){return m.getWorldPos();}).concat(snappedFirst?[]:[worldPos]);basePolygon.updateBase(pos);var pos2D=pos.map(function(p){return[p[0],p[2]];});if(markers.length>2&&lastSegmentIntersects(pos2D,snappedFirst)){cleanups.pop()();selectNextPoint(markers);}else if(snappedFirst){// `marker2.update' makes sure marker's position has been updated from its default [0,0,0]
|
|
33829
33846
|
// This works around an unidentified bug somewhere around OcclusionLayer, that causes error
|
|
33830
33847
|
// [.WebGL-0x13400c47e00] GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call
|
|
33831
|
-
marker.update(worldPos);cleanups.forEach(function(c){return c();});onZoneCreated(zonesPlugin.createZone({id:math.createUUID(),geometry:{planeCoordinates:pos2D,altitude:zoneAltitude,height:zoneHeight},alpha:zoneAlpha,color:zoneColor}));}else{marker.update(worldPos);wire&&wire.update(worldPos);selectNextPoint(markers.concat(marker));}});})([]);return{closeSurface:function closeSurface(){throw"TODO";},deactivate:function deactivate(){deactivatePointSelection();cleanups.forEach(function(c){return c();});}};};var ZonesPolysurfaceMouseControl=/*#__PURE__*/function(_Component44){_inherits(ZonesPolysurfaceMouseControl,_Component44);var _super174=_createSuper(ZonesPolysurfaceMouseControl);function ZonesPolysurfaceMouseControl(zonesPlugin){var _this197;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceMouseControl);_this197=_super174.call(this,zonesPlugin.viewer.scene);_this197.zonesPlugin=zonesPlugin;_this197.pointerLens=cfg.pointerLens;_this197._action=null;return _this197;}_createClass(ZonesPolysurfaceMouseControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=mousePointSelector(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceMouseControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceMouseControl;}(Component);var ZonesPolysurfaceTouchControl=/*#__PURE__*/function(_Component45){_inherits(ZonesPolysurfaceTouchControl,_Component45);var _super175=_createSuper(ZonesPolysurfaceTouchControl);function ZonesPolysurfaceTouchControl(zonesPlugin){var _this198;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceTouchControl);_this198=_super175.call(this,zonesPlugin.viewer.scene);_this198.zonesPlugin=zonesPlugin;_this198.pointerLens=cfg.pointerLens;_this198.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this198._action=null;return _this198;}_createClass(ZonesPolysurfaceTouchControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceTouchControl;}(Component);var ZoneEditControl=/*#__PURE__*/function(_Component46){_inherits(ZoneEditControl,_Component46);var _super176=_createSuper(ZoneEditControl);function ZoneEditControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this199;_classCallCheck(this,ZoneEditControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;_this199=_super176.call(this,scene);var altitude=zone._geometry.altitude;var dots=zone._geometry.planeCoordinates.map(function(planeCoord){var dotParent=scene.canvas.canvas.ownerDocument.body;var dot=new Dot3D(scene,{},dotParent,{fillColor:zone._color});dot.worldPos=math.vec3([planeCoord[0],altitude,planeCoord[1]]);dot.on("worldPos",function(){planeCoord[0]=dot.worldPos[0];planeCoord[1]=dot.worldPos[2];try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}});return dot;});var cleanupDrag=activateDraggableDots({viewer:viewer,handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,pointerLens:cfg&&cfg.pointerLens,dots:dots,ray2WorldPos:function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);},onEnd:function onEnd(initPos,dot){if(zone._zoneMesh){_this199.fire("edited");}return!!zone._zoneMesh;}});var cleanup=function cleanup(){cleanupDrag();dots.forEach(function(d){return d.destroy();});};var destroyCb=zone.on("destroyed",cleanup);_this199._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this199;}_createClass(ZoneEditControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneEditControl.prototype),"destroy",this).call(this);}}]);return ZoneEditControl;}(Component);var ZoneEditMouseControl=/*#__PURE__*/function(_ZoneEditControl){_inherits(ZoneEditMouseControl,_ZoneEditControl);var _super177=_createSuper(ZoneEditMouseControl);function ZoneEditMouseControl(zone,cfg){_classCallCheck(this,ZoneEditMouseControl);return _super177.call(this,zone,cfg,true,false);}return _createClass(ZoneEditMouseControl);}(ZoneEditControl);var ZoneEditTouchControl=/*#__PURE__*/function(_ZoneEditControl2){_inherits(ZoneEditTouchControl,_ZoneEditControl2);var _super178=_createSuper(ZoneEditTouchControl);function ZoneEditTouchControl(zone,cfg){_classCallCheck(this,ZoneEditTouchControl);return _super178.call(this,zone,cfg,false,true);}return _createClass(ZoneEditTouchControl);}(ZoneEditControl);var ZoneTranslateControl=/*#__PURE__*/function(_Component47){_inherits(ZoneTranslateControl,_Component47);var _super179=_createSuper(ZoneTranslateControl);function ZoneTranslateControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this200;_classCallCheck(this,ZoneTranslateControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;_this200=_super179.call(this,scene);var self=_assertThisInitialized(_this200);var altitude=zone._geometry.altitude;var pointerLens=cfg&&cfg.pointerLens;var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var ray2WorldPos=function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var canvasHandle=function canvasHandle(type,cb){var callback=function callback(event){event.preventDefault();cb(event);};canvas.addEventListener(type,callback);return function(){return canvas.removeEventListener(type,callback);};};var _cleanupCurrentDrag=function cleanupCurrentDrag(){};var startDrag=function startDrag(event,onMoveType,onEndType,matchesEvent){var e=matchesEvent(event);var canvasPos=copyCanvasPos(e,math.vec2());var pickRecord=viewer.scene.pick({canvasPos:canvasPos,includeEntities:[zone._zoneMesh.id]});var pickZone=pickRecord&&pickRecord.entity&&pickRecord.entity.zone;if(pickZone===zone){_cleanupCurrentDrag();canvas.style.cursor="move";viewer.cameraControl.active=false;var onChange=function(){var initCoords=zone._geometry.planeCoordinates.map(function(c){return c.slice();});var initWorldPos=pickWorldPos(canvasPos);var initDragCoord=math.vec2([initWorldPos[0],initWorldPos[2]]);var dPos=math.vec2();return function(canvasPos){var worldPos=pickWorldPos(canvasPos);dPos[0]=worldPos[0];dPos[1]=worldPos[2];math.subVec2(initDragCoord,dPos,dPos);zone._geometry.planeCoordinates.forEach(function(planeCoord,idx){math.subVec2(initCoords[idx],dPos,planeCoord);});try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}};}();var cleanupMove=canvasHandle(onMoveType,function(event){var e=matchesEvent(event);if(e){var _canvasPos5=copyCanvasPos(e,math.vec2());onChange(_canvasPos5);updatePointerLens(_canvasPos5);}});var cleanupEnd=canvasHandle(onEndType,function(event){var e=matchesEvent(event);if(e){var _canvasPos6=copyCanvasPos(e,math.vec2());onChange(_canvasPos6);updatePointerLens(null);_cleanupCurrentDrag();self.fire("translated");}});_cleanupCurrentDrag=function cleanupCurrentDrag(){_cleanupCurrentDrag=function cleanupCurrentDrag(){};canvas.style.cursor="default";viewer.cameraControl.active=true;cleanupMove();cleanupEnd();};}};var startDragCbs=[];if(handleMouseEvents){startDragCbs.push(canvasHandle("mousedown",function(event){if(event.which===1){startDrag(event,"mousemove","mouseup",function(event){return event.which===1&&event;});}}));}if(handleTouchEvents){startDragCbs.push(canvasHandle("touchstart",function(event){if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,"touchmove","touchend",function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}}));}var cleanup=function cleanup(){_cleanupCurrentDrag();startDragCbs.forEach(function(cb){return cb();});updatePointerLens(null);};var destroyCb=zone.on("destroyed",cleanup);_this200._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this200;}_createClass(ZoneTranslateControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneTranslateControl.prototype),"destroy",this).call(this);}}]);return ZoneTranslateControl;}(Component);var ZoneTranslateMouseControl=/*#__PURE__*/function(_ZoneTranslateControl){_inherits(ZoneTranslateMouseControl,_ZoneTranslateControl);var _super180=_createSuper(ZoneTranslateMouseControl);function ZoneTranslateMouseControl(zone,cfg){_classCallCheck(this,ZoneTranslateMouseControl);return _super180.call(this,zone,cfg,true,false);}return _createClass(ZoneTranslateMouseControl);}(ZoneTranslateControl);var ZoneTranslateTouchControl=/*#__PURE__*/function(_ZoneTranslateControl2){_inherits(ZoneTranslateTouchControl,_ZoneTranslateControl2);var _super181=_createSuper(ZoneTranslateTouchControl);function ZoneTranslateTouchControl(zone,cfg){_classCallCheck(this,ZoneTranslateTouchControl);return _super181.call(this,zone,cfg,false,true);}return _createClass(ZoneTranslateTouchControl);}(ZoneTranslateControl);export{AlphaFormat,AmbientLight,AngleMeasurementEditMouseControl,AngleMeasurementEditTouchControl,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,CityJSONLoaderPlugin,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,ContextMenu,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementEditControl,DistanceMeasurementEditMouseControl,DistanceMeasurementEditTouchControl,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsTouchControl,Dot3D,DotBIMDefaultDataSource,DotBIMLoaderPlugin,EdgeMaterial,EmphasisMaterial,FaceAlignedSectionPlanesPlugin,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,Label3D,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,MarqueePicker,MarqueePickerMouseControl,Mesh,MeshSurfaceArea,MeshVolume,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$1 as Node,OBJLoaderPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,PickResult,Plugin,PointLight,PointerCircle,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,RepeatWrapping,STLDefaultDataSource,STLLoaderPlugin,SceneModel,SceneModelMesh,SceneModelTransform,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,Wire3D,WorkerPool$1 as WorkerPool,XKTDefaultDataSource,XKTLoaderPlugin,XML3DLoaderPlugin,ZoneEditControl,ZoneEditMouseControl,ZoneEditTouchControl,ZoneTranslateControl,ZoneTranslateMouseControl,ZoneTranslateTouchControl,ZonesMouseControl,ZonesPlugin,ZonesPolysurfaceMouseControl,ZonesPolysurfaceTouchControl,ZonesTouchControl,activateDraggableDot,activateDraggableDots,buildBoxGeometry,buildBoxLinesGeometry,buildBoxLinesGeometryFromAABB,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,isTriangleMeshSolid,load3DSGeometry,loadOBJGeometry,math,meshSurfaceArea,meshVolume,os,rtcToWorldPos,sRGBEncoding,setFrustum,stats,touchPointSelector,transformToNode,utils,worldToRTCPos,worldToRTCPositions};
|
|
33848
|
+
marker.update(worldPos);cleanups.forEach(function(c){return c();});onZoneCreated(zonesPlugin.createZone({id:math.createUUID(),geometry:{planeCoordinates:pos2D,altitude:zoneAltitude,height:zoneHeight},alpha:zoneAlpha,color:zoneColor}));}else{marker.update(worldPos);wire&&wire.update(worldPos);selectNextPoint(markers.concat(marker));}});})([]);return{closeSurface:function closeSurface(){throw"TODO";},deactivate:function deactivate(){deactivatePointSelection();cleanups.forEach(function(c){return c();});}};};var ZonesPolysurfaceMouseControl=/*#__PURE__*/function(_Component44){_inherits(ZonesPolysurfaceMouseControl,_Component44);var _super177=_createSuper(ZonesPolysurfaceMouseControl);function ZonesPolysurfaceMouseControl(zonesPlugin){var _this200;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceMouseControl);_this200=_super177.call(this,zonesPlugin.viewer.scene);_this200.zonesPlugin=zonesPlugin;_this200.pointerLens=cfg.pointerLens;_this200._action=null;return _this200;}_createClass(ZonesPolysurfaceMouseControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=mousePointSelector(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceMouseControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceMouseControl;}(Component);var ZonesPolysurfaceTouchControl=/*#__PURE__*/function(_Component45){_inherits(ZonesPolysurfaceTouchControl,_Component45);var _super178=_createSuper(ZonesPolysurfaceTouchControl);function ZonesPolysurfaceTouchControl(zonesPlugin){var _this201;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceTouchControl);_this201=_super178.call(this,zonesPlugin.viewer.scene);_this201.zonesPlugin=zonesPlugin;_this201.pointerLens=cfg.pointerLens;_this201.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this201._action=null;return _this201;}_createClass(ZonesPolysurfaceTouchControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceTouchControl;}(Component);var ZoneEditControl=/*#__PURE__*/function(_Component46){_inherits(ZoneEditControl,_Component46);var _super179=_createSuper(ZoneEditControl);function ZoneEditControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this202;_classCallCheck(this,ZoneEditControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;_this202=_super179.call(this,scene);var altitude=zone._geometry.altitude;var dots=zone._geometry.planeCoordinates.map(function(planeCoord){var dotParent=scene.canvas.canvas.ownerDocument.body;var dot=new Dot3D(scene,{},dotParent,{fillColor:zone._color});dot.worldPos=math.vec3([planeCoord[0],altitude,planeCoord[1]]);dot.on("worldPos",function(){planeCoord[0]=dot.worldPos[0];planeCoord[1]=dot.worldPos[2];try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}});return dot;});var cleanupDrag=activateDraggableDots({viewer:viewer,handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,pointerLens:cfg&&cfg.pointerLens,dots:dots,ray2WorldPos:function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);},onEnd:function onEnd(initPos,dot){if(zone._zoneMesh){_this202.fire("edited");}return!!zone._zoneMesh;}});var cleanup=function cleanup(){cleanupDrag();dots.forEach(function(d){return d.destroy();});};var destroyCb=zone.on("destroyed",cleanup);_this202._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this202;}_createClass(ZoneEditControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneEditControl.prototype),"destroy",this).call(this);}}]);return ZoneEditControl;}(Component);var ZoneEditMouseControl=/*#__PURE__*/function(_ZoneEditControl){_inherits(ZoneEditMouseControl,_ZoneEditControl);var _super180=_createSuper(ZoneEditMouseControl);function ZoneEditMouseControl(zone,cfg){_classCallCheck(this,ZoneEditMouseControl);return _super180.call(this,zone,cfg,true,false);}return _createClass(ZoneEditMouseControl);}(ZoneEditControl);var ZoneEditTouchControl=/*#__PURE__*/function(_ZoneEditControl2){_inherits(ZoneEditTouchControl,_ZoneEditControl2);var _super181=_createSuper(ZoneEditTouchControl);function ZoneEditTouchControl(zone,cfg){_classCallCheck(this,ZoneEditTouchControl);return _super181.call(this,zone,cfg,false,true);}return _createClass(ZoneEditTouchControl);}(ZoneEditControl);var ZoneTranslateControl=/*#__PURE__*/function(_Component47){_inherits(ZoneTranslateControl,_Component47);var _super182=_createSuper(ZoneTranslateControl);function ZoneTranslateControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this203;_classCallCheck(this,ZoneTranslateControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;_this203=_super182.call(this,scene);var self=_assertThisInitialized(_this203);var altitude=zone._geometry.altitude;var pointerLens=cfg&&cfg.pointerLens;var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var ray2WorldPos=function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var canvasHandle=function canvasHandle(type,cb){var callback=function callback(event){event.preventDefault();cb(event);};canvas.addEventListener(type,callback);return function(){return canvas.removeEventListener(type,callback);};};var _cleanupCurrentDrag=function cleanupCurrentDrag(){};var startDrag=function startDrag(event,onMoveType,onEndType,matchesEvent){var e=matchesEvent(event);var canvasPos=copyCanvasPos(e,math.vec2());var pickRecord=viewer.scene.pick({canvasPos:canvasPos,includeEntities:[zone._zoneMesh.id]});var pickZone=pickRecord&&pickRecord.entity&&pickRecord.entity.zone;if(pickZone===zone){_cleanupCurrentDrag();canvas.style.cursor="move";viewer.cameraControl.active=false;var onChange=function(){var initCoords=zone._geometry.planeCoordinates.map(function(c){return c.slice();});var initWorldPos=pickWorldPos(canvasPos);var initDragCoord=math.vec2([initWorldPos[0],initWorldPos[2]]);var dPos=math.vec2();return function(canvasPos){var worldPos=pickWorldPos(canvasPos);dPos[0]=worldPos[0];dPos[1]=worldPos[2];math.subVec2(initDragCoord,dPos,dPos);zone._geometry.planeCoordinates.forEach(function(planeCoord,idx){math.subVec2(initCoords[idx],dPos,planeCoord);});try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}};}();var cleanupMove=canvasHandle(onMoveType,function(event){var e=matchesEvent(event);if(e){var _canvasPos5=copyCanvasPos(e,math.vec2());onChange(_canvasPos5);updatePointerLens(_canvasPos5);}});var cleanupEnd=canvasHandle(onEndType,function(event){var e=matchesEvent(event);if(e){var _canvasPos6=copyCanvasPos(e,math.vec2());onChange(_canvasPos6);updatePointerLens(null);_cleanupCurrentDrag();self.fire("translated");}});_cleanupCurrentDrag=function cleanupCurrentDrag(){_cleanupCurrentDrag=function cleanupCurrentDrag(){};canvas.style.cursor="default";viewer.cameraControl.active=true;cleanupMove();cleanupEnd();};}};var startDragCbs=[];if(handleMouseEvents){startDragCbs.push(canvasHandle("mousedown",function(event){if(event.which===1){startDrag(event,"mousemove","mouseup",function(event){return event.which===1&&event;});}}));}if(handleTouchEvents){startDragCbs.push(canvasHandle("touchstart",function(event){if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,"touchmove","touchend",function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}}));}var cleanup=function cleanup(){_cleanupCurrentDrag();startDragCbs.forEach(function(cb){return cb();});updatePointerLens(null);};var destroyCb=zone.on("destroyed",cleanup);_this203._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this203;}_createClass(ZoneTranslateControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneTranslateControl.prototype),"destroy",this).call(this);}}]);return ZoneTranslateControl;}(Component);var ZoneTranslateMouseControl=/*#__PURE__*/function(_ZoneTranslateControl){_inherits(ZoneTranslateMouseControl,_ZoneTranslateControl);var _super183=_createSuper(ZoneTranslateMouseControl);function ZoneTranslateMouseControl(zone,cfg){_classCallCheck(this,ZoneTranslateMouseControl);return _super183.call(this,zone,cfg,true,false);}return _createClass(ZoneTranslateMouseControl);}(ZoneTranslateControl);var ZoneTranslateTouchControl=/*#__PURE__*/function(_ZoneTranslateControl2){_inherits(ZoneTranslateTouchControl,_ZoneTranslateControl2);var _super184=_createSuper(ZoneTranslateTouchControl);function ZoneTranslateTouchControl(zone,cfg){_classCallCheck(this,ZoneTranslateTouchControl);return _super184.call(this,zone,cfg,false,true);}return _createClass(ZoneTranslateTouchControl);}(ZoneTranslateControl);export{AlphaFormat,AmbientLight,AngleMeasurementEditMouseControl,AngleMeasurementEditTouchControl,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,CityJSONLoaderPlugin,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,ContextMenu,CubicBezierCurve,Curve,CxConverterIFCLoaderPlugin,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementEditControl,DistanceMeasurementEditMouseControl,DistanceMeasurementEditTouchControl,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsTouchControl,Dot3D,DotBIMDefaultDataSource,DotBIMLoaderPlugin,EdgeMaterial,EmphasisMaterial,FaceAlignedSectionPlanesPlugin,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,Label3D,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,MarqueePicker,MarqueePickerMouseControl,Mesh,MeshSurfaceArea,MeshVolume,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$1 as Node,OBJLoaderPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,PickResult,Plugin,PointLight,PointerCircle,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,RepeatWrapping,STLDefaultDataSource,STLLoaderPlugin,SceneModel,SceneModelMesh,SceneModelTransform,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,Wire3D,WorkerPool$1 as WorkerPool,XKTDefaultDataSource,XKTLoaderPlugin,XML3DLoaderPlugin,ZoneEditControl,ZoneEditMouseControl,ZoneEditTouchControl,ZoneTranslateControl,ZoneTranslateMouseControl,ZoneTranslateTouchControl,ZonesMouseControl,ZonesPlugin,ZonesPolysurfaceMouseControl,ZonesPolysurfaceTouchControl,ZonesTouchControl,activateDraggableDot,activateDraggableDots,buildBoxGeometry,buildBoxLinesGeometry,buildBoxLinesGeometryFromAABB,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,isTriangleMeshSolid,load3DSGeometry,loadOBJGeometry,math,meshSurfaceArea,meshVolume,os,rtcToWorldPos,sRGBEncoding,setFrustum,stats,touchPointSelector,transformToNode,utils,worldToRTCPos,worldToRTCPositions};
|