UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

3 lines (2 loc) 1.82 kB
import{aE as n,V as e,Q as t}from"./index-Bw2N6w1y.esm.min.js";import{S as a}from"./objectModelMapping-DX92iJ8M.esm.min.js";function o(n,t,a,o){return e.FromArray(t,a).scaleInPlace(o)}function i(n,e,a,o){return t.FromArray(e,a).scaleInPlace(o)}function s(n,e,t,a){const o=new Array(n._numMorphTargets);for(let n=0;n<o.length;n++)o[n]=e[t++]*a;return o}class r{constructor(n,e,t,a){this.type=n,this.name=e,this.getValue=t,this.getStride=a}_buildAnimation(e,t,a){const o=new n(e,this.name,t,this.type);return o.setKeys(a),o}}class l extends r{buildAnimations(n,e,t,a){const o=[];return o.push({babylonAnimatable:n._babylonTransformNode,babylonAnimation:this._buildAnimation(e,t,a)}),o}}class m extends r{buildAnimations(e,t,a,o){const i=[];if(e._numMorphTargets)for(let s=0;s<e._numMorphTargets;s++){const r=new n(`${t}_${s}`,this.name,a,this.type);if(r.setKeys(o.map((n=>({frame:n.frame,inTangent:n.inTangent?n.inTangent[s]:void 0,value:n.value[s],outTangent:n.outTangent?n.outTangent[s]:void 0,interpolation:n.interpolation})))),e._primitiveBabylonMeshes)for(const n of e._primitiveBabylonMeshes)if(n.morphTargetManager){const e=n.morphTargetManager.getTarget(s),t=r.clone();e.animations.push(t),i.push({babylonAnimatable:e,babylonAnimation:t})}}return i}}a("/nodes/{}/translation",[new l(n.ANIMATIONTYPE_VECTOR3,"position",o,(()=>3))]),a("/nodes/{}/rotation",[new l(n.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",i,(()=>4))]),a("/nodes/{}/scale",[new l(n.ANIMATIONTYPE_VECTOR3,"scaling",o,(()=>3))]),a("/nodes/{}/weights",[new m(n.ANIMATIONTYPE_FLOAT,"influence",s,(n=>n._numMorphTargets))]);export{r as AnimationPropertyInfo,l as TransformNodeAnimationPropertyInfo,m as WeightAnimationPropertyInfo,i as getQuaternion,o as getVector3,s as getWeights}; //# sourceMappingURL=glTFLoaderAnimation-yBwOAuFp.esm.min.js.map