1 |
- !function(e){var t={};function r(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,r),s.l=!0,s.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)r.d(n,s,function(t){return e[t]}.bind(null,s));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";function n(e,t,r,n,i,h,a){this.queue=[],this.max_depth=t,this.res=r;var u=0;this.root=new s(1,i,h,a),this.queue.push(this.root);for(var l=0,c=0,f=0,p=0;this.queue.length;){var d=this.queue.shift();if(u>=e.length)throw"Premature end of octree data";var y=d.keys[3];y<t?o(d,y,this.queue,e[u++]):y==t?(l=e[u++],c=d.keys[0]<<1,f=d.keys[1]<<1,p=d.keys[2]<<1,1&l&&n(this,d.children[0],c,f,p),2&l&&n(this,d.children[1],c,f,p+1),4&l&&n(this,d.children[2],c,f+1,p),8&l&&n(this,d.children[3],c,f+1,p+1),16&l&&n(this,d.children[4],c+1,f,p),32&l&&n(this,d.children[5],c+1,f,p+1),64&l&&n(this,d.children[6],c+1,f+1,p),128&l&&n(this,d.children[7],c+1,f+1,p+1)):console.error("shouldn't be here...")}}function s(e,t,r,n){this.children=new Array(8),this.keys=new Int32Array(4),this.keys[0]=t,this.keys[1]=r,this.keys[2]=n,this.keys[3]=e}function i(e){return e.keys[3]}function o(e,t,r,n){var i=e.keys[0]<<1,o=e.keys[1]<<1,h=e.keys[2]<<1,a=null,u=t+1;1&n&&(a=new s(u,i,o,h),e.children[0]=a,r.push(a)),2&n&&(a=new s(u,i,o,h+1),e.children[1]=a,r.push(a)),4&n&&(a=new s(u,i,o+1,h),e.children[2]=a,r.push(a)),8&n&&(a=new s(u,i,o+1,h+1),e.children[3]=a,r.push(a)),16&n&&(a=new s(u,i+1,o,h),e.children[4]=a,r.push(a)),32&n&&(a=new s(u,i+1,o,h+1),e.children[5]=a,r.push(a)),64&n&&(a=new s(u,i+1,o+1,h),e.children[6]=a,r.push(a)),128&n&&(a=new s(u,i+1,o+1,h+1),e.children[7]=a,r.push(a))}function h(e,t){this.length=e,this.arr=new Float32Array(t)}function a(e,t){this.length=e,this.arr=new Int32Array(t)}r.r(t),h.prototype.capacity=function(){return this.arr.length},h.prototype.push=function(e){if(this.length==this.arr.length){var t=2*this.length,r=new Float32Array(t);r.set(this.arr,0),this.arr=r}this.arr[this.length]=e,++this.length},h.prototype.unwrap=function(){return Array.apply([],this.arr)},h.prototype.toString=function(){for(var e=" ["+this.length+"/"+this.arr.length+": ",t=0;t<this.length;++t)e+=this.arr[t]+" ";return e+="]"},a.prototype.capacity=function(){return this.arr.length},a.prototype.push=function(e){if(this.length==this.arr.length){var t=this.length<<1,r=new Int32Array(t);r.set(this.arr,0),this.arr=r}this.arr[this.length]=e,++this.length},a.prototype.unwrap=function(){return Array.apply([],this.arr)},a.prototype.toString=function(){for(var e=" ["+this.length+"/"+this.arr.length+": ",t=0;t<this.length;++t)e+=this.arr[t]+" ";return e+="]"};var u={},l=1,c=null;function f(e){return e.octreeConfigStruct.prefix+e.sub_octree.file+"/"+e.sub_octree.key+"/"+e.load_depth}function p(e){delete u[f(e)],0==Object.keys(u).length&&(l=1);var t=Object.keys(u).length;self.postMessage({cmd:"status",message:0==t?"Loading complete.":"Loading voxel "+(l-t)+" of "+l,items:t,percent:100-100/l*t})}self.addEventListener("message",(function(e){var t=e.data;switch(t.cmd){case"load":u[f(t)]?self.postMessage({msg:"already_loading"}):(u[f(t)]=!0,l=Math.max(l,Object.keys(u).length),function(e,t,r){var s=e.sub_octree.levelOffset[0],o=e.sub_octree.levelOffset[e.load_depth]-1,a=new XMLHttpRequest;a.open("GET",e.octreeConfigStruct.prefix+e.sub_octree.file,!0),Object.keys(e.headers).length>0&&a.setRequestHeader(Object.keys(e.headers)[0],e.headers[Object.keys(e.headers)[0]]);a.responseType="arraybuffer",a.setRequestHeader("Range","bytes="+s+"-"+o),a.onload=function(){if(200!=this.status&&206!=this.status)return console.log("Loading sub-octree data failed: "+this.status+" ("+this.statusText+")"),void r();u[f(e)]?(c=new Uint8Array(a.response),function(e,t){var r=Math.pow(2,i(e.sub_octree)-e.load_depth),s=new h(0,4),o=e.sub_octree.res*(1<<i(e.sub_octree))/2,a=e.sub_octree.res*r,u=.5*a-o;new n(t,e.load_depth,a,(function(e,t,r,n,i){s.push(r),s.push(n),s.push(i)}));var l=s.length/3;e.sub_octree.res_scale=r,e.sub_octree.load_depth=e.load_depth,e.sub_octree.leaves=l;for(var c=s.arr,f=3*l,p=0;p<f;p++)c[p]*=a,c[p]+=u;e.vertices=s.arr}(e,c),t(e.vertices)):r()},a.send()}(t,(function(){t.cmd="pointcloud",t.error=!1,self.postMessage(t),p(t)}),(function(){t.cmd="pointcloud",t.error=!0,self.postMessage(t),p(t)})))}}),!1)}]);
|