@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) • 4.76 kB
JavaScript
import{F as t,e as o}from"./KHR_interactivity-CKt1TdMW.esm.min.js";import{j as e,l as r,f as s,h as a,m as n,g as c,n as l,R as i}from"./declarationMapper-13w1YGqM.esm.min.js";import{Q as u,bU as h,V as p,i as m,R as w}from"./index-Bw2N6w1y.esm.min.js";import{F as x}from"./flowGraphBinaryOperationBlock-DFsKb2yF.esm.min.js";import{F as d}from"./flowGraphUnaryOperationBlock-CLj2X1HB.esm.min.js";import"./objectModelMapping-DX92iJ8M.esm.min.js";import"./flowGraphCachedOperationBlock-rvkBwo1v.esm.min.js";function g(t,o){const e=new u;return function(t,o,e){const r=p.Cross(t,o),s=Math.acos(h(p.Dot(t,o),-1,1));u.RotationAxisToRef(r,s,e)}(t,o,e),e}const V="cachedOperationAxis",F="cachedOperationAngle",B="cachedExecutionId";class f extends d{constructor(t){super(i,s,(t=>this._polymorphicLength(t)),"FlowGraphLengthBlock",t)}_polymorphicLength(t){switch(o(t)){case"Vector2":case"Vector3":case"Vector4":case"Quaternion":return t.length();default:throw new Error(`Cannot compute length of value ${t}`)}}}w("FlowGraphLengthBlock",f);class k extends d{constructor(t){super(i,i,(t=>this._polymorphicNormalize(t)),"FlowGraphNormalizeBlock",t)}_polymorphicNormalize(t){let e;switch(o(t)){case"Vector2":case"Vector3":case"Vector4":case"Quaternion":if(e=t.normalizeToNew(),this.config?.nanOnZeroLength){0===t.length()&&e.setAll(NaN)}return e;default:throw new Error(`Cannot normalize value ${t}`)}}}w("FlowGraphNormalizeBlock",k);class G extends x{constructor(t){super(i,i,s,((t,o)=>this._polymorphicDot(t,o)),"FlowGraphDotBlock",t)}_polymorphicDot(t,e){switch(o(t)){case"Vector2":case"Vector3":case"Vector4":case"Quaternion":return t.dot(e);default:throw new Error(`Cannot get dot product of ${t} and ${e}`)}}}w("FlowGraphDotBlock",G);class A extends x{constructor(t){super(e,e,e,((t,o)=>p.Cross(t,o)),"FlowGraphCrossBlock",t)}}w("FlowGraphCrossBlock",A);class D extends x{constructor(t){super(l,s,l,((t,o)=>t.rotate(o)),"FlowGraphRotate2DBlock",t)}}w("FlowGraphRotate2DBlock",D);class y extends x{constructor(t){super(e,r,e,((t,o)=>t.applyRotationQuaternion(o)),"FlowGraphRotate3DBlock",t)}}function C(t,e){switch(o(t)){case"Vector2":case"Vector3":return e.transformVector(t);case"Vector4":return new m(t.x*e.m[0]+t.y*e.m[1]+t.z*e.m[2]+t.w*e.m[3],t.x*e.m[4]+t.y*e.m[5]+t.z*e.m[6]+t.w*e.m[7],t.x*e.m[8]+t.y*e.m[9]+t.z*e.m[10]+t.w*e.m[11],t.x*e.m[12]+t.y*e.m[13]+t.z*e.m[14]+t.w*e.m[15]);default:throw new Error(`Cannot transform value ${t}`)}}w("FlowGraphRotate3DBlock",y);class _ extends x{constructor(t){const o=t?.vectorType||"Vector3",e="Vector2"===o?"Matrix2D":"Vector3"===o?"Matrix3D":"Matrix";super(c(o),c(e),c(o),C,"FlowGraphTransformVectorBlock",t)}}w("FlowGraphTransformVectorBlock",_);class j extends x{constructor(t){super(e,n,e,((t,o)=>p.TransformCoordinates(t,o)),"FlowGraphTransformCoordinatesBlock",t)}}w("FlowGraphTransformCoordinatesBlock",j);class E extends d{constructor(t){super(r,r,(t=>t.conjugate()),"FlowGraphConjugateBlock",t)}}w("FlowGraphConjugateBlock",E);class R extends x{constructor(t){super(r,r,s,((t,o)=>{return e=t,r=o,2*Math.acos(h(u.Dot(e,r)));var e,r}),"FlowGraphAngleBetweenBlock",t)}}w("FlowGraphAngleBetweenBlock",R);class z extends x{constructor(t){super(e,s,r,((t,o)=>u.RotationAxis(t,o)),"FlowGraphQuaternionFromAxisAngleBlock",t)}}w("FlowGraphQuaternionFromAxisAngleBlock",z);class O extends t{constructor(t){super(t),this.a=this.registerDataInput("a",r),this.axis=this.registerDataOutput("axis",e),this.angle=this.registerDataOutput("angle",s),this.isValid=this.registerDataOutput("isValid",a)}_updateOutputs(t){const o=t._getExecutionVariable(this,B,-1),e=t._getExecutionVariable(this,V,null),r=t._getExecutionVariable(this,F,null);if(null!=e&&null!=r&&o===t.executionId)this.axis.setValue(e,t),this.angle.setValue(r,t);else try{const{axis:o,angle:e}=this.a.getValue(t).toAxisAngle();t._setExecutionVariable(this,V,o),t._setExecutionVariable(this,F,e),t._setExecutionVariable(this,B,t.executionId),this.axis.setValue(o,t),this.angle.setValue(e,t),this.isValid.setValue(!0,t)}catch(o){this.isValid.setValue(!1,t)}}getClassName(){return"FlowGraphAxisAngleFromQuaternionBlock"}}w("FlowGraphAxisAngleFromQuaternionBlock",O);class Q extends x{constructor(t){super(e,e,r,((t,o)=>g(t,o)),"FlowGraphQuaternionFromDirectionsBlock",t)}}export{R as FlowGraphAngleBetweenBlock,O as FlowGraphAxisAngleFromQuaternionBlock,E as FlowGraphConjugateBlock,A as FlowGraphCrossBlock,G as FlowGraphDotBlock,f as FlowGraphLengthBlock,k as FlowGraphNormalizeBlock,z as FlowGraphQuaternionFromAxisAngleBlock,Q as FlowGraphQuaternionFromDirectionsBlock,D as FlowGraphRotate2DBlock,y as FlowGraphRotate3DBlock,_ as FlowGraphTransformBlock,j as FlowGraphTransformCoordinatesBlock};
//# sourceMappingURL=flowGraphVectorMathBlocks-DPooL6gG.esm.min.js.map