phantasmal-world/7.4df0781393f9bc9777c8.js

1 line
9.7 KiB
JavaScript
Raw Normal View History

2020-01-01 04:15:35 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{"4/Uj":function(t,i,s){"use strict";s.r(i),s.d(i,"TextureStore",(function(){return c}));var e=s("ouMO"),n=s("yub1"),r=s("Sa3/"),o=s("NRxM"),h=s("bcBH"),u=s("kcKQ"),_=s("rwco"),a=function(t,i,s,e){return new(s||(s=Promise))((function(n,r){function o(t){try{u(e.next(t))}catch(t){r(t)}}function h(t){try{u(e.throw(t))}catch(t){r(t)}}function u(t){var i;t.done?n(t.value):(i=t.value,i instanceof s?i:new s((function(t){t(i)}))).then(o,h)}u((e=e.apply(t,i||[])).next())}))};const f=_.c.get("viewer/stores/TextureStore");class c extends u.a{constructor(){super(...arguments),this._current_xvm=Object(e.e)(void 0),this.current_xvm=this._current_xvm,this.load_file=t=>a(this,void 0,void 0,(function*(){try{const i=yield Object(r.a)(t);this._current_xvm.val=Object(n.a)(new o.a(i,h.a.Little))}catch(t){f.error("Couldn't read file.",t)}}))}}},"9Ykw":function(t,i,s){"use strict";function e(t){const i=[];for(;t.bytes_left;){const s=t.u32(),e=t.u32();if(e>t.bytes_left)break;i.push({type:s,data:t.take(e)})}return i}s.d(i,"a",(function(){return e}))},"9dYx":function(t,i,s){"use strict";var e=s("bcBH");class n{constructor(t,i){this._position=0,this.endianness=t,this.offset=i}get position(){return this._position}get endianness(){return this.little_endian?e.a.Little:e.a.Big}set endianness(t){this.little_endian=t===e.a.Little}get bytes_left(){return this.size-this.position}seek(t){return this.seek_start(this.position+t)}seek_start(t){if(t<0||t>this.size)throw new Error(`Offset ${t} is out of bounds.`);return this._position=t,this}seek_end(t){if(t<0||t>this.size)throw new Error(`Offset ${t} is out of bounds.`);return this._position=this.size-t,this}u8(){return this.u8_at(this._position++)}u8_at(t){return this.check_offset(t,1),this.dv.getUint8(this.offset+t)}u16(){const t=this.u16_at(this.position);return this._position+=2,t}u16_at(t){return this.check_offset(t,2),this.dv.getUint16(this.offset+t,this.little_endian)}u32(){const t=this.u32_at(this.position);return this._position+=4,t}u32_at(t){return this.check_offset(t,4),this.dv.getUint32(this.offset+t,this.little_endian)}i8(){return this.i8_at(this._position++)}i8_at(t){return this.check_offset(t,1),this.dv.getInt8(this.offset+t)}i16(){const t=this.i16_at(this.position);return this._position+=2,t}i16_at(t){return this.check_offset(t,2),this.dv.getInt16(this.offset+t,this.little_endian)}i32(){const t=this.i32_at(this.position);return this._position+=4,t}i32_at(t){return this.check_offset(t,4),this.dv.getInt32(this.offset+t,this.little_endian)}f32(){const t=this.f32_at(this.position);return this._position+=4,t}f32_at(t){return this.check_offset(t,4),this.dv.getFloat32(this.offset+t,this.little_endian)}u8_array(t){this.check_size("n",t,t);const i=[];for(let s=0;s<t;++s)i.push(this.dv.getUint8(this.offset+this._position++));return i}u16_array(t){this.check_size("n",t,2*t);const i=[];for(let s=0;s<t;++s)i.push(this.dv.getUint16(this.offset+this.position,this.little_endian)),this._position+=2;return i}u32_array(t){this.check_size("n",t,4*t);const i=[];for(let s=0;s<t;++s)i.push(this.dv.getUint32(this.offset+this.position,this.little_endian)),this._position+=4;return i}i32_array(t){this.check_size("n",t,4*t);const i=[];for(let s=0;s<t;++s)i.push(this.dv.getInt32(this.offset+this.position,this.little_endian)),this._position+=4;return i}vec2_f32(){return{x:this.f32(),y:this.f32()}}vec3_f32(){return{x:this.f32(),y:this.f32(),z:this.f32()}}string_ascii(t,i,s){const e=[];for(let n=0;n<t;n++){const r=this.u8();if(i&&0===r){s&&this.seek(t-n-1);break}e.push(r)}return String.fromCodePoint(...e)}string_utf16(t,i,s){const e=[],n=Math.floor(t/2);for(let t=0;t<n;t++){const r=this.u16();if(i&&0===r){s&&this.seek(2*(n-t-1));break}e.push(r)}return String.fromCodePoint(...e)}string_ascii_at(t,i,s){const e=[];for(let n=0;n<i;n++){const i=this.u8_at(t+n);if(s&&0===i)break;e.push(i)}return String.fromCodePoint(...e)}string_utf16_at(t,i,s){const e=[],n=Math.floor(i/2);for(let i=0;i<n;i++){const n=this.u16_at(t+2*i);if(s&&0===n)break;e.push(n)}return String.fromCodePoint(