Files
fad_oa/ruoyi-ui/public/file-viewer/assets/ColladaLoader-DTiuvWJL.js

3 lines
53 KiB
JavaScript
Raw Normal View History

import{$ as e,Bt as t,C as n,Ct as r,Dt as i,E as a,Et as o,F as s,Ft as c,Ht as l,I as u,K as d,Lt as f,Mt as p,Ot as m,R as h,Tt as g,U as _,V as v,Z as y,b,bt as x,et as S,f as C,ft as w,ht as T,m as E,n as D,nt as O,o as k,p as A,pt as j,q as M,r as N,rt as P,tt as F,u as I,w as L,wt as R,x as z,yt as B,z as V,zt as H}from"./three.module-BFsVh7r1.js";var U=class extends b{constructor(e){super(e)}parse(e){function t(e){switch(e.image_type){case d:case m:if(e.colormap_length>256||e.colormap_size!==24||e.colormap_type!==1)throw Error(`THREE.TGALoader: Invalid type colormap data for indexed type.`);break;case f:case p:case h:case g:if(e.colormap_type)throw Error(`THREE.TGALoader: Invalid type colormap data for colormap type.`);break;case u:throw Error(`THREE.TGALoader: No data.`);default:throw Error(`THREE.TGALoader: Invalid type `+e.image_type)}if(e.width<=0||e.height<=0)throw Error(`THREE.TGALoader: Invalid image size.`);if(e.pixel_size!==8&&e.pixel_size!==16&&e.pixel_size!==24&&e.pixel_size!==32)throw Error(`THREE.TGALoader: Invalid pixel size `+e.pixel_size)}function n(e,t,n,r,i){let a,o,s=n.pixel_size>>3,c=n.width*n.height*s;if(t&&(o=i.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),e){a=new Uint8Array(c);let e,t,n,o=0,l=new Uint8Array(s);for(;o<c;)if(e=i[r++],t=(e&127)+1,e&128){for(n=0;n<s;++n)l[n]=i[r++];for(n=0;n<t;++n)a.set(l,o+n*s);o+=s*t}else{for(t*=s,n=0;n<t;++n)a[o+n]=i[r++];o+=t}}else a=i.subarray(r,r+=t?n.width*n.height:c);return{pixel_data:a,palettes:o}}function r(e,t,n,r,i,a,o,s,c){let l=c,u,d=0,f,p,m=E.width;for(p=t;p!==r;p+=n)for(f=i;f!==o;f+=a,d++)u=s[d],e[(f+m*p)*4+3]=255,e[(f+m*p)*4+2]=l[u*3+0],e[(f+m*p)*4+1]=l[u*3+1],e[(f+m*p)*4+0]=l[u*3+2];return e}function i(e,t,n,r,i,a,o,s){let c,l=0,u,d,f=E.width;for(d=t;d!==r;d+=n)for(u=i;u!==o;u+=a,l+=2)c=s[l+0]+(s[l+1]<<8),e[(u+f*d)*4+0]=(c&31744)>>7,e[(u+f*d)*4+1]=(c&992)>>2,e[(u+f*d)*4+2]=(c&31)<<3,e[(u+f*d)*4+3]=c&32768?0:255;return e}function a(e,t,n,r,i,a,o,s){let c=0,l,u,d=E.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=3)e[(l+d*u)*4+3]=255,e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2];return e}function o(e,t,n,r,i,a,o,s){let c=0,l,u,d=E.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=4)e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2],e[(l+d*u)*4+3]=s[c+3];return e}function s(e,t,n,r,i,a,o,s){let c,l=0,u,d,f=E.width;for(d=t;d!==r;d+=n)for(u=i;u!==o;u+=a,l++)c=s[l],e[(u+f*d)*4+0]=c,e[(u+f*d)*4+1]=c,e[(u+f*d)*4+2]=c,e[(u+f*d)*4+3]=255;return e}function c(e,t,n,r,i,a,o,s){let c=0,l,u,d=E.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=2)e[(l+d*u)*4+0]=s[c+0],e[(l+d*u)*4+1]=s[c+0],e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+3]=s[c+1];return e}function l(e,t,n,l,u){let d,f,p,m,h,g;switch((E.flags&v)>>y){default:case S:d=0,p=1,h=t,f=0,m=1,g=n;break;case b:d=0,p=1,h=t,f=n-1,m=-1,g=-1;break;case C:d=t-1,p=-1,h=-1,f=0,m=1,g=n;break;case x:d=t-1,p=-1,h=-1,f=n-1,m=-1,g=-1;break}if(k)switch(E.pixel_size){case 8:s(e,f,m,g,d,p,h,l);break;case 16:c(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}else switch(E.pixel_size){case 8:r(e,f,m,g,d,p,h,l,u);break;case 16:i(e,f,m,g,d,p,h,l);break;case 24:a(e,f,m,g,d,p,h,l);break;case 32:o(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}return e}let u=0,d=1,f=2,p=3,m=9,h=10,g=11,v=48,y=4,b=0,x=1,S=2,C=3;if(e.length<19)throw Error(`THREE.TGALoader: Not enough data to contain header.`);let w=0,T=new Uint8Array(e),E={id_length:T[w++],colormap_type:T[w++],image_type:T[w++],colormap_index:T[w++]|T[w++]<<8,colormap_length:T[w++]|T[w++]<<8,colormap_size:T[w++],origin:[T[w++]|T[w++]<<8,T[w++]|T[w++]<<8],width:T[w++]|T[w++]<<8,height:T[w++]|T[w++]<<8,pixel_size:T[w++],flags:T[w++]};if(t(E),E.id_length+w>e.length)throw Error(`THREE.TGALoader: No data.`);w+=E.id_length;let D=!1,O=!1,k=!1;switch(E.image_type){case 9:D=!0,O=!0;break;case 1:O=!0;break;case 10:D=!0;break;case 2:break;case 11:D=!0,k=!0;break;case 3:k=!0;break}let A=new Uint8Array(E.width*E.height*4),j=n(D,O,E,w,T);return l(A,E.width,E.height,j.pixel_data,j.palettes),{dat
`,t),null}let i=n.getAttribute(`version`);console.debug(`THREE.ColladaLoader: File version`,i);let a=this.parseAsset(W(n,`asset`)[0]),o={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{},joints:{}};return this.library=o,this.collada=n,this.parseLibrary(n,`library_animations`,`animation`,this.parseAnimation.bind(this)),this.parseLibrary(n,`library_animation_clips`,`animation_clip`,this.parseAnimationClip.bind(this)),this.parseLibrary(n,`library_controllers`,`controller`,this.parseController.bind(this)),this.parseLibrary(n,`library_images`,`image`,this.parseImage.bind(this)),this.parseLibrary(n,`library_effects`,`effect`,this.parseEffect.bind(this)),this.parseLibrary(n,`library_materials`,`material`,this.parseMaterial.bind(this)),this.parseLibrary(n,`library_cameras`,`camera`,this.parseCamera.bind(this)),this.parseLibrary(n,`library_lights`,`light`,this.parseLight.bind(this)),this.parseLibrary(n,`library_geometries`,`geometry`,this.parseGeometry.bind(this)),this.parseLibrary(n,`library_nodes`,`node`,this.parseNode.bind(this)),this.parseLibrary(n,`library_visual_scenes`,`visual_scene`,this.parseVisualScene.bind(this)),this.parseLibrary(n,`library_joints`,`joint`,this.parseLibraryJoint.bind(this)),this.parseLibrary(n,`library_kinematics_models`,`kinematics_model`,this.parseKinematicsModel.bind(this)),this.parseLibrary(n,`library_physics_models`,`physics_model`,this.parsePhysicsModel.bind(this)),this.parseLibrary(n,`scene`,`instance_kinematics_scene`,this.parseKinematicsScene.bind(this)),{library:o,asset:a,collada:n}}parserErrorToText(e){let t=[],n=[e];for(;n.length;){let e=n.shift();e.nodeType===Node.TEXT_NODE?t.push(e.textContent):(t.push(`
`),n.push(...e.childNodes))}return t.join(``).trim()}parseAsset(e){return{unit:this.parseAssetUnit(W(e,`unit`)[0]),upAxis:this.parseAssetUpAxis(W(e,`up_axis`)[0])}}parseAssetUnit(e){return e!==void 0&&e.hasAttribute(`meter`)===!0?parseFloat(e.getAttribute(`meter`)):1}parseAssetUpAxis(e){return e===void 0?`Y_UP`:e.textContent}parseLibrary(e,t,n,r){let i=W(e,t)[0];if(i!==void 0){let e=W(i,n);for(let t=0;t<e.length;t++)r(e[t])}}parseAnimation(e){let t={sources:{},samplers:{},channels:{}},n=!1;for(let r=0,i=e.childNodes.length;r<i;r++){let i=e.childNodes[r];if(i.nodeType!==1)continue;let a;switch(i.nodeName){case`source`:a=i.getAttribute(`id`),t.sources[a]=this.parseSource(i);break;case`sampler`:a=i.getAttribute(`id`),t.samplers[a]=this.parseAnimationSampler(i);break;case`channel`:a=i.getAttribute(`target`),t.channels[a]=this.parseAnimationChannel(i);break;case`animation`:this.parseAnimation(i),n=!0;break;default:}}n===!1&&(this.library.animations[e.getAttribute(`id`)||y.generateUUID()]=t)}parseAnimationSampler(e){let t={inputs:{}};for(let n=0,r=e.childNodes.length;n<r;n++){let r=e.childNodes[n];if(r.nodeType===1)switch(r.nodeName){case`input`:let e=J(r.getAttribute(`source`)),n=r.getAttribute(`semantic`);t.inputs[n]=e;break}}return t}parseAnimationChannel(e){let t={},n=e.getAttribute(`target`).split(`/`),r=n.shift(),i=n.shift(),a=i.indexOf(`(`)!==-1,o=i.indexOf(`.`)!==-1;if(o)n=i.split(`.`),i=n.shift(),t.member=n.shift();else if(a){let e=i.split(`(`);i=e.shift();for(let t=0;t<e.length;t++)e[t]=parseInt(e[t].replace(/\)/,``));t.indices=e}return t.id=r,t.sid=i,t.arraySyntax=a,t.memberSyntax=o,t.sampler=J(e.getAttribute(`source`)),t}parseAnimationClip(e){let t={name:e.getAttribute(`id`)||`default`,start:parseFloat(e.getAttribute(`start`)||0),end:parseFloat(e.getAttribute(`end`)||0),animations:[]};for(let n=0,r=e.childNodes.length;n<r;n++){let r=e.childNodes[n];if(r.nodeType===1)switch(r.nodeName){case`instance_animation`:t.animations.push(J(r.getAttribute(`url`)));break}}this.library.clips[e.getAttribute(`id`)]=t}parseController(e){let t={};for(let n=0,r=e.childNodes.length;n<r;n++){let r=e.childNodes[n];if(r.nodeType===1)switch(r.nodeName){case`skin`:t.id=J(r.getAttribute(`source`)),t.skin=this.parseSkin(r);break;case`morph`:t.id=J(r.getAttribute(`source`)),console.warn(`THREE.ColladaLoader: Morph target animation not supported yet.`);break}}this.library.controllers[e.getAttribute(`id`)]=t}parseSkin(e){let t={sources:{}};for(let n=0,r=e.childNodes.length;n<r;n++){let r=e.childNodes[n];if(r.nodeType===1)switch(r.nodeName){case`bind_shape_matrix`:t.bindShapeMatrix=K(r.textContent);break;case`source`:let e=r.getAttribute(`id`);t.sources[e]=this.parseSource(r);break;case`joints`:t.joints=this.parseJoints(r);break;case`vertex_weights`:t.vertexWeights=this.parseVertexWeights(r);break}}return t}parseJoints(e){let t={inputs:{}};for(let n=0,r=e.childNodes.length;n<r;n++){let r=e.childNodes[n];if(r.nodeType===1)switch(r.nodeName){case`input`:let e=r.getAttribute(`semantic`),n=J(r.getAttribute(`source`));t.inputs[e]=n;break}}return t}parseVertexWeights(e){let t={inputs:{}};for(let n=0,r=e.childNodes.length;n<r;n++){let r=e.childNodes[n];if(r.nodeType===1)switch(r.nodeName){case`input`:let e=r.getAttribute(`semantic`),n=J(r.getAttribute(`source`)),i=parseInt(r.getAttribute(`offset`));t.inputs[e]={id:n,offset:i};break;case`vcount`:t.vcount=q(r.textContent);break;case`v`:t.v=q(r.textContent);break}}return t}parseImage(e){let t={init_from:W(e,`init_from`)[0].textContent};this.library.images[e.getAttribute(`id`)]=t}parseEffect(e){let t={};for(let n=0,r=e.childNodes.length;n<r;n++){let r=e.childNodes[n];if(r.nodeType===1)switch(r.nodeName){case`profile_COMMON`:t.profile=this.parseEffectProfileCOMMON(r);break}}this.library.effects[e.getAttribute(`id`)]=t}parseEffectProfileCOMMON(e){let t={surfaces:{},samplers:{}};for(let n=0,r=e.childNodes.length;n<r;n++){let r=e.childNodes[n];if(r.nodeType===1)switch(r.nodeName){case`newparam`:this.parseEffectNewparam(r,t);break;case`technique`:t.technique=this.parseEffectTechnique(r);break;case`extra`:t.ext