PageSourceSearch

https://aminedirohf-async-grpo-mimo.hf.space/assets/bvhFileLoader-BwafIXbz.js

js aminedirohf-async-grpo-mimo.hf.space collected 2026-10-04 16:41:02 UTC 7,189 bytes, 3 lines download raw bytes

1import{RegisterSceneLoaderPlugin as Y}from"./sceneLoader-CutT-qCn.js";import{A as U}from"./assetContainer-OIgMc4u0.js";import{A as h}from"./animation-IftAdLIx.js";import{B as R}from"./dynamic-B0TG-CUB.js";import{B as V}from"./bone-B35odufe.js";import{S as b}from"./skeleton-BVUVDN0a.js";import{V as w,M as u,Q as y}from"./math.vector-C1xyPDEl.js";import{T as D}from"./tools-D01N7ptR.js";import"./scene-gn_hoGMy.js";import"./decorators.serialization-C7d7ykGG.js";import"./bufferUtils-DTRdUD8L.js";import"./math.color-CzLaKyb6.js";import"./math.scalar.functions-DkeaWAWz.js";import"./smartArray-CO6iJ0u5.js";import"./lightConstants-B1TSTh-k.js";import"./sceneComponent-Dflhczui.js";import"./math.plane-Ce_75-g5.js";import"./buffer-DqKlo1ts.js";import"./dataBuffer-CgoqiUzT.js";import"./renderingManager-CiY2OUrf.js";import"./deviceInputEvents-BTza-zoR.js";import"./perfCounter-DusmGz8t.js";import"./sceneLoaderFlags-wywyb9ml.js";import"./mesh-oYr96VDh.js";import"./mesh.vertexData-Cr3zcPIw.js";import"./subMesh-UWDo5wjI.js";import"./drawWrapper-CZVk0xN-.js";import"./node-C-Iu0ALa.js";import"./math.viewport-CgkTt1RS.js";import"./index-DeFvE6lu.js";import"./math.axis-Ck7JfPPj.js";import"./material-CrEsrP1R.js";import"./texture-BEqhDl5Y.js";import"./baseTexture-CgAggsey.js";import"./drawWrapper.functions-Dzz0ghog.js";import"./instancedMesh-QYXOajBy.js";import"./light-DT53MGnW.js";import"./rawTexture-Cp8_XuDs.js";const O="Xposition",F="Yposition",k="Zposition",x="Xrotation",M="Yrotation",v="Zrotation",j="HIERARCHY",K="MOTION";class X{constructor(e){this.loopMode=h.ANIMATIONLOOPMODE_CYCLE,this.list=[],this.root=_(),this.numFrames=0,this.frameRate=0,this.skeleton=e}}function _(){return{name:"",type:"",offset:new w,channels:[],children:[],frames:[],parent:null}}function Z(){return{frame:0,position:new w,rotation:new y}}function z(r){const e=r.offset.x,o=r.offset.y,a=r.offset.z;return u.Translation(e,o,a)}function Q(r,e){if(r.frames.length===0)return[];const o=[],a=r.channels.some(s=>s===O||s===F||s===k),t=r.channels.some(s=>s===x||s===M||s===v),i=new h(`${r.name}_pos`,"position",e.frameRate,h.ANIMATIONTYPE_VECTOR3,e.loopMode),m=new h(`${r.name}_rot`,"rotationQuaternion",e.frameRate,h.ANIMATIONTYPE_QUATERNION,e.loopMode),n=[],p=[];for(let s=0;s<r.frames.length;s++){const f=r.frames[s];a&&f.position&&n.push({frame:f.frame,value:f.position.clone()}),t&&p.push({frame:f.frame,value:f.rotation.clone()})}return n.length>0&&(i.setKeys(n),o.push(i)),p.length>0&&(m.setKeys(p),o.push(m)),o}function B(r,e,o){const a=z(r),t=new V(r.name,o.skeleton,e,a),i=Q(r,o);for(const m of i)m.getKeys()&&m.getKeys().length>0&&t.animations.push(m);for(const m of r.children)B(m,t,o)}function P(r,e,o,a){if(o.type==="ENDSITE")return;const t=Z();t.frame=e,t.position=new w,t.rotation=new y,o.frames.push(t);let i=u.Identity();for(let m=0;m<o.channels.length;++m){const n=o.channels[m],p=r[a.i++];if(!p)continue;const s=parseFloat(p.trim());if(n.endsWith("position"))switch(n){case O:t.position.x=s;break;case F:t.position.y=s;break;case k:t.position.z=s;break}else if(n.endsWith("rotation")){const f=D.ToRadians(s);let l;switch(n){case x:l=u.RotationX(f);break;case M:l=u.RotationY(f);break;case v:l=u.RotationZ(f);break}i=l.multiply(i)}}y.FromRotationMatrixToRef(i,t.rotation);for(const m of o.children)P(r,e,m,a)}function L(r,e,o,a){var p,s,f,l;const t=_();t.parent=o,a.list.push(t);let i=e.trim().split(/\s+/);if(i[0].toUpperCase()==="END"&&i[1].toUpperCase()==="SITE"?(t.type="ENDSITE",t.name="ENDSITE"):(t.name=i[1],t.type=i[0].toUpperCase()),((p=r.shift())==null?void 0:p.trim())!="{")throw new Error("Expected opening { after type & name");const m=(s=r.shift())==null?void 0:s.trim().split(/\s+/);if(!m)throw new Error("Unexpected end of file: missing OFFSET");if(i=m,i[0].toUpperCase()!="OFFSET")throw new Error("Expected OFFSET, but got: "+i[0]);if(i.length!=4)throw new Error("OFFSET: Invalid number of values");const n=new w(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3]));if(isNaN(n.x)||isNaN(n.y)||isNaN(n.z))throw new Error("OFFSET: Invalid values");if(t.offset=n,t.type!="ENDSITE"){if(i=(f=r.shift())==null?void 0:f.trim().split(/\s+/),!i)throw new Error("Unexpected end of file: missing CHANNELS");
1if(i[0].toUpperCase()!="CHANNELS")throw new Error("Expected CHANNELS definition");const c=parseInt(i[1]);t.channels=i.splice(2,c),t.children=[]}for(;r.length>0;){const c=(l=r.shift())==null?void 0:l.trim();if(c==="}")return t;c&&t.children.push(L(r,c,t,a))}throw new Error("Unexpected end of file: missing closing brace")}function I(r,e,o,a){const t=r.split(`
2`),{loopMode:i}=a;e._blockEntityCollection=!!o;const m=new b("","",e);m._parentContainer=o,e._blockEntityCollection=!1;const n=new X(m);n.loopMode=i;const p=t.shift();if(!p||p.trim().toUpperCase()!==j)throw new Error("HIERARCHY expected");const s=t.shift();if(!s)throw new Error("Unexpected end of file after HIERARCHY");const f=L(t,s.trim(),null,n),l=t.shift();if(!l||l.trim().toUpperCase()!==K)throw new Error("MOTION expected");const c=t.shift();if(!c)throw new Error("Unexpected end of file before frame count");const C=c.trim().split(/[\s]+/);if(C.length<2)throw new Error("Invalid frame count line");const N=parseInt(C[1]);if(isNaN(N))throw new Error("Failed to read number of frames.");n.numFrames=N;const H=t.shift();if(!H)throw new Error("Unexpected end of file before frame time");const A=H.trim().split(/[\s]+/);if(A.length<3)throw new Error("Invalid frame time line");const d=parseFloat(A[2]);if(isNaN(d))throw new Error("Failed to read frame time.");if(d<=0)throw new Error("Failed to read frame time. Invalid value "+d);n.frameRate=1/d;for(let g=0;g<N;++g){const T=t.shift();if(!T)continue;const S=T.trim().split(/[\s]+/)||[];P(S,g,f,{i:0})}return n.root=f,B(n.root,null,n),n.skeleton.returnToRest(),n.skeleton}class E{constructor(e){this.name=R.name,this.extensions=R.extensions,this._loadingOptions={...E._DefaultLoadingOptions,...e??{}}}static get _DefaultLoadingOptions(){return{loopMode:h.ANIMATIONLOOPMODE_CYCLE}}createPlugin(e){return new E(e[R.name])}canDirectLoad(e){return this.isBvhHeader(e)}isBvhHeader(e){return e.split(`
3`)[0]=="HIERARCHY"}isNotBvhHeader(e){return!this.isBvhHeader(e)}importMeshAsync(e,o,a){if(typeof a!="string")return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(a))return Promise.reject("BVH loader expects HIERARCHY header.");try{const t=I(a,o,null,this._loadingOptions);return Promise.resolve({meshes:[],particleSystems:[],skeletons:[t],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]})}catch(t){return Promise.reject(t)}}loadAsync(e,o){return typeof o!="string"?Promise.reject("BVH loader expects string data."):this.isNotBvhHeader(o)?Promise.reject("BVH loader expects HIERARCHY header."):this.importMeshAsync(null,e,o).then(()=>{})}loadAssetContainerAsync(e,o){if(typeof o!="string")return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(o))return Promise.reject("BVH loader expects HIERARCHY header.");const a=new U(e);try{const t=I(o,e,a,this._loadingOptions);return a.skeletons.push(t),Promise.resolve(a)}catch(t){return Promise.reject(t)}}}Y(new E);export{E as BVHFileLoader};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.