@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
JavaScript
import{V as n,Q as e,ay as t}from"./index-yNtOWHHe.esm.min.js";import{S as a}from"./objectModelMapping-DJGnHmCN.esm.min.js";function o(e,t,a,o){return n.FromArray(t,a).scaleInPlace(o)}function i(n,t,a,o){return e.FromArray(t,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(n,e,a){const o=new t(n,this.name,e,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(n,e,a,o){const i=[];if(n._numMorphTargets)for(let s=0;s<n._numMorphTargets;s++){const r=new t(`${e}_${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})))),n._primitiveBabylonMeshes)for(const e of n._primitiveBabylonMeshes)if(e.morphTargetManager){const n=e.morphTargetManager.getTarget(s),t=r.clone();n.animations.push(t),i.push({babylonAnimatable:n,babylonAnimation:t})}}return i}}a("/nodes/{}/translation",[new l(t.ANIMATIONTYPE_VECTOR3,"position",o,(()=>3))]),a("/nodes/{}/rotation",[new l(t.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",i,(()=>4))]),a("/nodes/{}/scale",[new l(t.ANIMATIONTYPE_VECTOR3,"scaling",o,(()=>3))]),a("/nodes/{}/weights",[new m(t.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-vLdcgcMX.esm.min.js.map