mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-05 15:28:29 +08:00
1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
![]() |
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{"9Ykw":function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return a}));var s=n("BAAx"),r=n("rwco"),i=n("5cb6");const o=r.a.get("core/data_formats/parsing/iff");function u(e,t=!1){return c(e,t,[],(e,t,n)=>({type:t,data:e.take(n)}))}function a(e,t=!1){return c(e,t,[],(e,t,n)=>({type:t,size:n}))}function c(e,t,n,r){const u=Object(s.b)(o);let a=!1;for(;e.bytes_left>=8;){const s=e.u32(),o=e.position,c=e.u32();if(c>e.bytes_left){a=!0,t||u.add_problem(0===n.length?i.b.Error:i.b.Warning,"Invalid IFF format.",`Size ${c} was too large (only ${e.bytes_left} bytes left) at position ${o}.`);break}n.push(r(e,s,c))}return a&&0===n.length?u.failure():u.success(n)}},BAAx:function(e,t,n){"use strict";function s(e,t){return{success:!0,value:e,problems:null!=t?t:[]}}function r(e){return{success:!1,problems:null!=e?e:[]}}function i(e){if(e.success)return e.value;throw new Error(e.problems.join("\n"))}function o(e){return new u(e)}n.d(t,"c",(function(){return s})),n.d(t,"a",(function(){return r})),n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return o}));class u{constructor(e){this.logger=e,this.problems=[]}add_problem(e,t,n,s){return this.logger.log(e,n,s),this.problems.push({severity:e,ui_message:t}),this}add_result(e){return this.problems.push(...e.problems),this}success(e){return s(e,this.problems)}failure(){return r(this.problems)}}},VwSi:function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return u}));var s=n("kwt4");const r=1296321870;var i,o;function u(e,t){return e.u32()===r?function(e,t){const n=e.u32();return a(e.take(n),t)}(e,t):(e.seek_start(0),function(e,t){e.seek_end(16);const n=e.u32();e.seek_start(n);const s=e.u32();return e.seek_start(s),function(e,t){e.seek(4);const n=e.u32();return e.seek_start(n),a(e,t)}(e,t)}(e,t))}function a(e,t){let n=e.u32();const s=e.u32(),r=e.u16(),i=e.u16(),u=(192&i)>>6,a=15&i,f=[];for(let i=0;i<t;i++){e.seek_start(n),n=n+=8*a;const t={tracks:[]};f.push(t);const i=[],u=[];for(let t=0;t<a;t++)i.push(e.u32());for(let t=0;t<a;t++){const t=e.u32();u.push(t)}if(1&r){e.seek_start(i.shift());const n=u.shift();n&&t.tracks.push({type:o.Position,keyframes:c(e,n)})}if(2&r){e.seek_start(i.shift());const n=u.shift();n&&t.tracks.push({type:o.Rotation,keyframes:l(e,n,s)})}if(4&r){e.seek_start(i.shift());const n=u.shift();n&&t.tracks.push({type:o.Scale,keyframes:c(e,n)})}}return{motion_data:f,frame_count:s,type:r,interpolation:u,element_count:a}}function c(e,t){const n=[];for(let s=0;s<t;++s)n.push({frame:e.u32(),value:e.vec3_f32()});return n}function l(e,t,n){const r=[],i=e.position;for(let n=0;n<t;++n)r.push({frame:e.u16(),value:{x:e.u16()*s.a,y:e.u16()*s.a,z:e.u16()*s.a}});let o=-1;for(const{frame:s}of r){if(s<o||s>=n)return e.seek_start(i),f(e,t);o=s}return r}function f(e,t){const n=[];for(let r=0;r<t;++r)n.push({frame:e.u32(),value:{x:e.i32()*s.a,y:e.i32()*s.a,z:e.i32()*s.a}});return n}!function(e){e[e.Linear=0]="Linear",e[e.Spline=1]="Spline",e[e.UserFunction=2]="UserFunction"}(i||(i={})),function(e){e[e.Position=0]="Position",e[e.Rotation=1]="Rotation",e[e.Scale=2]="Scale"}(o||(o={}))},kwt4:function(e,t,n){"use strict";var s=n("9Ykw"),r=n("rwco");const i=r.a.get("core/data_formats/parsing/ninja/njcm");var o;function u(e,t){const n=e.u32(),s=e.u32(),r=e.vec3_f32(),i=e.f32(),u=[],c=[];if(n){e.seek_start(n);for(const n of a(e,t,!0))if(n.type===o.Vertex)for(const e of n.vertices)u[e.index]={position:e.position,normal:e.normal,bone_weight:e.bone_weight,bone_weight_status:e.bone_weight_status,calc_continue:e.calc_continue}}if(s){e.seek_start(s);let n=void 0,r=void 0,i=void 0;for(const s of a(e,t,!1))switch(s.type){case o.Bits:r=s.src_alpha,i=s.dst_alpha;break;case o.Tiny:n=s.texture_id;break;case o.Material:r=s.src_alpha,i=s.dst_alpha;break;case o.Strip:for(const e of s.triangle_strips)e.texture_id=n,e.src_alpha=r,e.dst_alpha=i;c.push(...s.triangle_strips)}}return{type:"njcm",vertices:u,meshes:c,collision_sphere_center:r,collision_sphere_radius:i}}f
|