@pixiv/three-vrm-springbone 2.1.2 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/lib/three-vrm-springbone.cjs +1135 -0
  2. package/lib/three-vrm-springbone.min.cjs +2 -0
  3. package/lib/three-vrm-springbone.module.js +1041 -1075
  4. package/lib/three-vrm-springbone.module.min.js +2 -2
  5. package/package.json +21 -19
  6. package/lib/three-vrm-springbone.js +0 -1175
  7. package/lib/three-vrm-springbone.min.js +0 -2
  8. package/ts3.4/types/VRMSpringBoneCollider.d.ts +0 -12
  9. package/ts3.4/types/VRMSpringBoneColliderGroup.d.ts +0 -14
  10. package/ts3.4/types/VRMSpringBoneColliderShape.d.ts +0 -21
  11. package/ts3.4/types/VRMSpringBoneColliderShapeCapsule.d.ts +0 -23
  12. package/ts3.4/types/VRMSpringBoneColliderShapeSphere.d.ts +0 -18
  13. package/ts3.4/types/VRMSpringBoneJoint.d.ts +0 -116
  14. package/ts3.4/types/VRMSpringBoneJointSettings.d.ts +0 -11
  15. package/ts3.4/types/VRMSpringBoneLoaderPlugin.d.ts +0 -34
  16. package/ts3.4/types/VRMSpringBoneLoaderPluginOptions.d.ts +0 -15
  17. package/ts3.4/types/VRMSpringBoneManager.d.ts +0 -47
  18. package/ts3.4/types/helpers/VRMSpringBoneColliderHelper.d.ts +0 -10
  19. package/ts3.4/types/helpers/VRMSpringBoneJointHelper.d.ts +0 -10
  20. package/ts3.4/types/helpers/index.d.ts +0 -2
  21. package/ts3.4/types/helpers/utils/ColliderShapeBufferGeometry.d.ts +0 -5
  22. package/ts3.4/types/helpers/utils/ColliderShapeCapsuleBufferGeometry.d.ts +0 -16
  23. package/ts3.4/types/helpers/utils/ColliderShapeSphereBufferGeometry.d.ts +0 -15
  24. package/ts3.4/types/helpers/utils/SpringBoneBufferGeometry.d.ts +0 -14
  25. package/ts3.4/types/index.d.ts +0 -10
  26. package/ts3.4/types/tests/VRMSpringBoneColliderShapeCapsule.test.d.ts +0 -1
  27. package/ts3.4/types/tests/VRMSpringBoneColliderShapeSphere.test.d.ts +0 -1
  28. package/ts3.4/types/tests/matchers/toBeCloseToArray.d.ts +0 -9
  29. package/ts3.4/types/tests/matchers/toBeCloseToVector3.d.ts +0 -10
  30. package/ts3.4/types/utils/Matrix4InverseCache.d.ts +0 -28
  31. package/ts3.4/types/utils/getWorldQuaternionLite.d.ts +0 -10
  32. package/ts3.4/types/utils/mat4InvertCompat.d.ts +0 -8
  33. package/ts3.4/types/utils/traverseAncestorsFromRoot.d.ts +0 -2
  34. package/ts3.4/types/utils/traverseChildrenUntilConditionMet.d.ts +0 -9
  35. package/types/tests/VRMSpringBoneColliderShapeCapsule.test.d.ts +0 -1
  36. package/types/tests/VRMSpringBoneColliderShapeSphere.test.d.ts +0 -1
  37. package/types/tests/matchers/toBeCloseToArray.d.ts +0 -9
  38. package/types/tests/matchers/toBeCloseToVector3.d.ts +0 -10
@@ -1,2 +0,0 @@
1
- /*! (c) 2020-2024 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
2
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).THREE_VRM_SPRINGBONE={},t.THREE)}(this,(function(t,e){"use strict";function i(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var r=i(e);class s{}const n=new r.Vector3,o=new r.Vector3;class a extends s{get type(){return"capsule"}constructor(t){var e,i,s;super(),this.offset=null!==(e=null==t?void 0:t.offset)&&void 0!==e?e:new r.Vector3(0,0,0),this.tail=null!==(i=null==t?void 0:t.tail)&&void 0!==i?i:new r.Vector3(0,0,0),this.radius=null!==(s=null==t?void 0:t.radius)&&void 0!==s?s:0}calculateCollision(t,e,i,r){n.copy(this.offset).applyMatrix4(t),o.copy(this.tail).applyMatrix4(t),o.sub(n);const s=o.lengthSq();r.copy(e).sub(n);const a=o.dot(r);a<=0||(s<=a||o.multiplyScalar(a/s),r.sub(o));const l=i+this.radius,d=r.length()-l;return r.normalize(),d}}class l extends s{get type(){return"sphere"}constructor(t){var e,i;super(),this.offset=null!==(e=null==t?void 0:t.offset)&&void 0!==e?e:new r.Vector3(0,0,0),this.radius=null!==(i=null==t?void 0:t.radius)&&void 0!==i?i:0}calculateCollision(t,e,i,r){r.copy(this.offset).applyMatrix4(t),r.negate().add(e);const s=i+this.radius,n=r.length()-s;return r.normalize(),n}}const d=new r.Vector3;class c extends r.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new r.Vector3,this._currentTail=new r.Vector3,this._shape=t,this._attrPos=new r.BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new r.BufferAttribute(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0);const i=d.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(i)>1e-10&&(this._currentTail.copy(i),t=!0),t&&this._buildPosition()}_buildPosition(){d.copy(this._currentTail).sub(this._currentOffset);const t=d.length()/this._currentRadius;for(let e=0;e<=16;e++){const i=e/16*Math.PI;this._attrPos.setXYZ(e,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+e,t+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+e,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+e,t+Math.sin(i),0,Math.cos(i))}for(let e=0;e<32;e++){const i=e/16*Math.PI;this._attrPos.setXYZ(68+e,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+e,t,Math.sin(i),Math.cos(i))}const e=Math.atan2(d.y,Math.sqrt(d.x*d.x+d.z*d.z)),i=-Math.atan2(d.z,d.x);this.rotateZ(e),this.rotateY(i),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){const e=(t+1)%34;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(68+2*t,34+t,34+e)}for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(136+2*t,68+t,68+e),this._attrIndex.setXY(200+2*t,100+t,100+e)}this._attrIndex.needsUpdate=!0}}class h extends r.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new r.Vector3,this._shape=t,this._attrPos=new r.BufferAttribute(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new r.BufferAttribute(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(64+2*t,32+t,32+e),this._attrIndex.setXY(128+2*t,64+t,64+e)}this._attrIndex.needsUpdate=!0}}const u=new r.Vector3;class p extends r.Group{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof l)this._geometry=new h(this.collider.shape);else{if(!(this.collider.shape instanceof a))throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");this._geometry=new c(this.collider.shape)}const e=new r.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new r.LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=u.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}}class _ extends r.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new r.Vector3,this._springBone=t,this._attrPos=new r.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new r.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(64+2*t,32+t,32+e),this._attrIndex.setXY(128+2*t,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const f=new r.Vector3;class g extends r.Group{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new _(this.springBone);const e=new r.LineBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1});this._line=new r.LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=f.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}}class y extends r.Object3D{constructor(t){super(),this.shape=t}}const v=new r.Matrix4;function x(t){return t.invert?t.invert():t.getInverse(v.copy(t)),t}class M{get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),x(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}constructor(t){this._inverseCache=new r.Matrix4,this._shouldUpdateInverse=!0,this.matrix=t;const e={set:(t,e,i)=>(this._shouldUpdateInverse=!0,t[e]=i,!0)};this._originalElements=t.elements,t.elements=new Proxy(t.elements,e)}revert(){this.matrix.elements=this._originalElements}}const w=new r.Matrix4,m=new r.Vector3,S=new r.Vector3,b=new r.Vector3,P=new r.Vector3,R=new r.Vector3,B=new r.Vector3,V=new r.Quaternion,I=new r.Matrix4,T=new r.Matrix4;class C{get center(){return this._center}set center(t){var e;(null===(e=this._center)||void 0===e?void 0:e.userData.inverseCacheProxy)&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=t,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new M(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:w}constructor(t,e,i={},s=[]){var n,o,a,l,d,c;this._currentTail=new r.Vector3,this._prevTail=new r.Vector3,this._boneAxis=new r.Vector3,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new r.Matrix4,this._initialLocalRotation=new r.Quaternion,this._initialLocalChildPosition=new r.Vector3,this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:null!==(n=i.hitRadius)&&void 0!==n?n:0,stiffness:null!==(o=i.stiffness)&&void 0!==o?o:1,gravityPower:null!==(a=i.gravityPower)&&void 0!==a?a:0,gravityDir:null!==(d=null===(l=i.gravityDir)||void 0===l?void 0:l.clone())&&void 0!==d?d:new r.Vector3(0,-1,0),dragForce:null!==(c=i.dragForce)&&void 0!==c?c:.4},this.colliderGroups=s}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const t=this._getMatrixWorldToCenter(I);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const t=this._getMatrixWorldToCenter(I);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail)}update(t){if(t<=0)return;this._calcWorldSpaceBoneLength(),P.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(I);R.copy(P).applyMatrix4(e);const i=V.setFromRotationMatrix(e),r=T.copy(e).multiply(this._parentMatrixWorld),s=S.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(r).sub(R).normalize(),n=b.copy(this.settings.gravityDir).applyQuaternion(i).normalize(),o=this._getMatrixCenterToWorld(I);B.copy(this._currentTail).add(m.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(m.copy(s).multiplyScalar(this.settings.stiffness*t)).add(m.copy(n).multiplyScalar(this.settings.gravityPower*t)).applyMatrix4(o),B.sub(P).normalize().multiplyScalar(this._worldSpaceBoneLength).add(P),this._collision(B),e=this._getMatrixWorldToCenter(I),this._prevTail.copy(this._currentTail),this._currentTail.copy(m.copy(B).applyMatrix4(e));const a=x(I.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),l=V.setFromUnitVectors(this._boneAxis,m.copy(B).applyMatrix4(a).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(l),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(t){this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{const i=e.shape.calculateCollision(e.matrixWorld,t,this.settings.hitRadius,m);i<0&&(t.add(m.multiplyScalar(-i)),t.sub(P).normalize().multiplyScalar(this._worldSpaceBoneLength).add(P))}))}))}_calcWorldSpaceBoneLength(){m.setFromMatrixPosition(this.bone.matrixWorld),this.child?S.setFromMatrixPosition(this.child.matrixWorld):(S.copy(this._initialLocalChildPosition),S.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=m.sub(S).length()}_getMatrixCenterToWorld(t){return this._center?t.copy(this._center.matrixWorld):t.identity(),t}_getMatrixWorldToCenter(t){return this._center?t.copy(this._center.userData.inverseCacheProxy.inverse):t.identity(),t}}function E(t,e,i,r){return new(i||(i=Promise))((function(s,n){function o(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((r=r.apply(t,e||[])).next())}))}function W(t,e){const i=[];let r=t;for(;null!==r;)i.unshift(r),r=r.parent;i.forEach((t=>{e(t)}))}function O(t,e){t.children.forEach((t=>{e(t)||O(t,e)}))}"function"==typeof SuppressedError&&SuppressedError;class L{constructor(){this._joints=new Set,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const t=new Set;return this._joints.forEach((e=>{e.colliderGroups.forEach((e=>{t.add(e)}))})),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{t.add(e)}))})),Array.from(t)}addJoint(t){this._joints.add(t);let e=this._objectSpringBonesMap.get(t.bone);null==e&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t)}addSpringBone(t){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(t)}deleteJoint(t){this._joints.delete(t);this._objectSpringBonesMap.get(t.bone).delete(t)}deleteSpringBone(t){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(t)}setInitState(){const t=new Set,e=new Set,i=new Set;for(const r of this._joints)this._processSpringBone(r,t,e,i,(t=>t.setInitState()))}reset(){const t=new Set,e=new Set,i=new Set;for(const r of this._joints)this._processSpringBone(r,t,e,i,(t=>t.reset()))}update(t){const e=new Set,i=new Set,r=new Set;for(const s of this._joints)this._processSpringBone(s,e,i,r,(e=>e.update(t))),O(s.bone,(t=>{var e,i;return(null!==(i=null===(e=this._objectSpringBonesMap.get(t))||void 0===e?void 0:e.size)&&void 0!==i?i:0)>0||(t.updateWorldMatrix(!1,!1),!1)}))}_processSpringBone(t,e,i,r,s){if(i.has(t))return;if(e.has(t))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");e.add(t);const n=this._getDependencies(t);for(const t of n)W(t,(t=>{const n=this._objectSpringBonesMap.get(t);if(n)for(const t of n)this._processSpringBone(t,e,i,r,s);else r.has(t)||(t.updateWorldMatrix(!1,!1),r.add(t))}));t.bone.updateMatrix(),t.bone.updateWorldMatrix(!1,!1),s(t),r.add(t.bone),i.add(t)}_getDependencies(t){const e=new Set,i=t.bone.parent;return i&&e.add(i),t.colliderGroups.forEach((t=>{t.colliders.forEach((t=>{e.add(t)}))})),e}}const j=new Set(["1.0","1.0-beta"]);class A{get name(){return A.EXTENSION_NAME}constructor(t,e){this.parser=t,this.jointHelperRoot=null==e?void 0:e.jointHelperRoot,this.colliderHelperRoot=null==e?void 0:e.colliderHelperRoot}afterRoot(t){return E(this,void 0,void 0,(function*(){t.userData.vrmSpringBoneManager=yield this._import(t)}))}_import(t){return E(this,void 0,void 0,(function*(){const e=yield this._v1Import(t);if(null!=e)return e;const i=yield this._v0Import(t);return null!=i?i:null}))}_v1Import(t){var e,i,s,n,o;return E(this,void 0,void 0,(function*(){const a=t.parser.json;if(!(-1!==(null===(e=a.extensionsUsed)||void 0===e?void 0:e.indexOf(A.EXTENSION_NAME))))return null;const l=new L,d=yield t.parser.getDependencies("node"),c=null===(i=a.extensions)||void 0===i?void 0:i[A.EXTENSION_NAME];if(!c)return null;const h=c.specVersion;if(!j.has(h))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${A.EXTENSION_NAME} specVersion "${h}"`),null;const u=null===(s=c.colliders)||void 0===s?void 0:s.map(((t,e)=>{var i,s,n,o,a;const l=d[t.node],c=t.shape;if(c.sphere)return this._importSphereCollider(l,{offset:(new r.Vector3).fromArray(null!==(i=c.sphere.offset)&&void 0!==i?i:[0,0,0]),radius:null!==(s=c.sphere.radius)&&void 0!==s?s:0});if(c.capsule)return this._importCapsuleCollider(l,{offset:(new r.Vector3).fromArray(null!==(n=c.capsule.offset)&&void 0!==n?n:[0,0,0]),radius:null!==(o=c.capsule.radius)&&void 0!==o?o:0,tail:(new r.Vector3).fromArray(null!==(a=c.capsule.tail)&&void 0!==a?a:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${e} has no valid shape`)})),p=null===(n=c.colliderGroups)||void 0===n?void 0:n.map(((t,e)=>{var i;return{colliders:(null!==(i=t.colliders)&&void 0!==i?i:[]).map((t=>{const i=null==u?void 0:u[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${e} attempted to use a collider #${t} but not found`);return i})),name:t.name}}));return null===(o=c.springs)||void 0===o||o.forEach(((t,e)=>{var i;const s=t.joints,n=null===(i=t.colliderGroups)||void 0===i?void 0:i.map((t=>{const i=null==p?void 0:p[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${e} attempted to use a colliderGroup ${t} but not found`);return i})),o=null!=t.center?d[t.center]:void 0;let a;s.forEach((t=>{if(a){const e=a.node,i=d[e],s=t.node,c=d[s],h={hitRadius:a.hitRadius,dragForce:a.dragForce,gravityPower:a.gravityPower,stiffness:a.stiffness,gravityDir:null!=a.gravityDir?(new r.Vector3).fromArray(a.gravityDir):void 0},u=this._importJoint(i,c,h,n);o&&(u.center=o),l.addJoint(u)}a=t}))})),l.setInitState(),l}))}_v0Import(t){var e,i,s;return E(this,void 0,void 0,(function*(){const n=t.parser.json;if(!(-1!==(null===(e=n.extensionsUsed)||void 0===e?void 0:e.indexOf("VRM"))))return null;const o=null===(i=n.extensions)||void 0===i?void 0:i.VRM,a=null==o?void 0:o.secondaryAnimation;if(!a)return null;const l=null==a?void 0:a.boneGroups;if(!l)return null;const d=new L,c=yield t.parser.getDependencies("node"),h=null===(s=a.colliderGroups)||void 0===s?void 0:s.map((t=>{var e;const i=c[t.node],s=(null!==(e=t.colliders)&&void 0!==e?e:[]).map(((t,e)=>{var s,n,o;const a=new r.Vector3(0,0,0);return t.offset&&a.set(null!==(s=t.offset.x)&&void 0!==s?s:0,null!==(n=t.offset.y)&&void 0!==n?n:0,t.offset.z?-t.offset.z:0),this._importSphereCollider(i,{offset:a,radius:null!==(o=t.radius)&&void 0!==o?o:0})}));return{colliders:s}}));return null==l||l.forEach(((t,e)=>{const i=t.bones;i&&i.forEach((i=>{var s,n,o,a;const l=c[i],u=new r.Vector3;t.gravityDir?u.set(null!==(s=t.gravityDir.x)&&void 0!==s?s:0,null!==(n=t.gravityDir.y)&&void 0!==n?n:0,null!==(o=t.gravityDir.z)&&void 0!==o?o:0):u.set(0,-1,0);const p=null!=t.center?c[t.center]:void 0,_={hitRadius:t.hitRadius,dragForce:t.dragForce,gravityPower:t.gravityPower,stiffness:t.stiffiness,gravityDir:u},f=null===(a=t.colliderGroups)||void 0===a?void 0:a.map((t=>{const i=null==h?void 0:h[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${e} attempted to use a colliderGroup ${t} but not found`);return i}));l.traverse((t=>{var e;const i=null!==(e=t.children[0])&&void 0!==e?e:null,r=this._importJoint(t,i,_,f);p&&(r.center=p),d.addJoint(r)}))}))})),t.scene.updateMatrixWorld(),d.setInitState(),d}))}_importJoint(t,e,i,r){const s=new C(t,e,i,r);if(this.jointHelperRoot){const t=new g(s);this.jointHelperRoot.add(t),t.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(t,e){const{offset:i,radius:r}=e,s=new l({offset:i,radius:r}),n=new y(s);if(t.add(n),this.colliderHelperRoot){const t=new p(n);this.colliderHelperRoot.add(t),t.renderOrder=this.colliderHelperRoot.renderOrder}return n}_importCapsuleCollider(t,e){const{offset:i,radius:r,tail:s}=e,n=new a({offset:i,radius:r,tail:s}),o=new y(n);if(t.add(o),this.colliderHelperRoot){const t=new p(o);this.colliderHelperRoot.add(t),t.renderOrder=this.colliderHelperRoot.renderOrder}return o}}A.EXTENSION_NAME="VRMC_springBone",t.VRMSpringBoneCollider=y,t.VRMSpringBoneColliderHelper=p,t.VRMSpringBoneColliderShape=s,t.VRMSpringBoneColliderShapeCapsule=a,t.VRMSpringBoneColliderShapeSphere=l,t.VRMSpringBoneJoint=C,t.VRMSpringBoneJointHelper=g,t.VRMSpringBoneLoaderPlugin=A,t.VRMSpringBoneManager=L,Object.defineProperty(t,"__esModule",{value:!0}),Object.assign(e,t)}));
@@ -1,12 +0,0 @@
1
- import * as THREE from 'three';
2
- import { VRMSpringBoneColliderShape } from './VRMSpringBoneColliderShape';
3
- /**
4
- * Represents a collider of a VRM.
5
- */
6
- export declare class VRMSpringBoneCollider extends THREE.Object3D {
7
- /**
8
- * The shape of the collider.
9
- */
10
- readonly shape: VRMSpringBoneColliderShape;
11
- constructor(shape: VRMSpringBoneColliderShape);
12
- }
@@ -1,14 +0,0 @@
1
- import { VRMSpringBoneCollider } from './VRMSpringBoneCollider';
2
- /**
3
- * Represents a collider group of a VRM.
4
- */
5
- export interface VRMSpringBoneColliderGroup {
6
- /**
7
- * The colliders of the collider group.
8
- */
9
- colliders: VRMSpringBoneCollider[];
10
- /**
11
- * The name of the collider.
12
- */
13
- name?: string;
14
- }
@@ -1,21 +0,0 @@
1
- import * as THREE from 'three';
2
- /**
3
- * Represents a shape of a collider.
4
- */
5
- export declare abstract class VRMSpringBoneColliderShape {
6
- /*
7
- * The type of the shape.
8
- */
9
- abstract readonly type: string;
10
- /**
11
- * Calculate a distance and a direction from the collider to a target object.
12
- * It's hit if the distance is negative.
13
- * The direction will be contained in the given target vector.
14
- *
15
- * @param colliderMatrix A matrix represents the transform of the collider
16
- * @param objectPosition A vector represents the position of the target object
17
- * @param objectRadius The radius of the object
18
- * @param target The result direction will be contained in this vector
19
- */
20
- abstract calculateCollision(colliderMatrix: THREE.Matrix4, objectPosition: THREE.Vector3, objectRadius: number, target: THREE.Vector3): number;
21
- }
@@ -1,23 +0,0 @@
1
- import * as THREE from 'three';
2
- import { VRMSpringBoneColliderShape } from './VRMSpringBoneColliderShape';
3
- export declare class VRMSpringBoneColliderShapeCapsule extends VRMSpringBoneColliderShape {
4
- readonly type: 'capsule';
5
- /**
6
- * The offset of the head from the origin.
7
- */
8
- offset: THREE.Vector3;
9
- /**
10
- * The offset of the tail from the origin.
11
- */
12
- tail: THREE.Vector3;
13
- /**
14
- * The radius.
15
- */
16
- radius: number;
17
- constructor(params?: {
18
- radius?: number;
19
- offset?: THREE.Vector3;
20
- tail?: THREE.Vector3;
21
- });
22
- calculateCollision(colliderMatrix: THREE.Matrix4, objectPosition: THREE.Vector3, objectRadius: number, target: THREE.Vector3): number;
23
- }
@@ -1,18 +0,0 @@
1
- import * as THREE from 'three';
2
- import { VRMSpringBoneColliderShape } from './VRMSpringBoneColliderShape';
3
- export declare class VRMSpringBoneColliderShapeSphere extends VRMSpringBoneColliderShape {
4
- readonly type: 'sphere';
5
- /**
6
- * The offset from the origin.
7
- */
8
- offset: THREE.Vector3;
9
- /**
10
- * The radius.
11
- */
12
- radius: number;
13
- constructor(params?: {
14
- radius?: number;
15
- offset?: THREE.Vector3;
16
- });
17
- calculateCollision(colliderMatrix: THREE.Matrix4, objectPosition: THREE.Vector3, objectRadius: number, target: THREE.Vector3): number;
18
- }
@@ -1,116 +0,0 @@
1
- import * as THREE from 'three';
2
- import { VRMSpringBoneColliderGroup } from './VRMSpringBoneColliderGroup';
3
- import { VRMSpringBoneJointSettings } from './VRMSpringBoneJointSettings';
4
- /**
5
- * A class represents a single joint of a spring bone.
6
- * It should be managed by a [[VRMSpringBoneManager]].
7
- */
8
- export declare class VRMSpringBoneJoint {
9
- /**
10
- * Settings of the bone.
11
- */
12
- settings: VRMSpringBoneJointSettings;
13
- /**
14
- * Collider groups attached to this bone.
15
- */
16
- colliderGroups: VRMSpringBoneColliderGroup[];
17
- /**
18
- * An Object3D attached to this bone.
19
- */
20
- readonly bone: THREE.Object3D;
21
- /**
22
- * An Object3D that will be used as a tail of this spring bone.
23
- * It can be null when the spring bone is imported from VRM 0.0.
24
- */
25
- readonly child: THREE.Object3D | null;
26
- /**
27
- * Current position of child tail, in center unit. Will be used for verlet integration.
28
- */
29
- private _currentTail;
30
- /**
31
- * Previous position of child tail, in center unit. Will be used for verlet integration.
32
- */
33
- private _prevTail;
34
- /**
35
- * Initial axis of the bone, in local unit.
36
- */
37
- private _boneAxis;
38
- /**
39
- * Length of the bone in world unit.
40
- * Will be used for normalization in update loop, will be updated by {@link _calcWorldSpaceBoneLength}.
41
- *
42
- * It's same as local unit length unless there are scale transformations in the world space.
43
- */
44
- private _worldSpaceBoneLength;
45
- /**
46
- * This springbone will be calculated based on the space relative from this object.
47
- * If this is `null`, springbone will be calculated in world space.
48
- */
49
- private _center;
50
- center: THREE.Object3D | null;
51
- /**
52
- * Initial state of the local matrix of the bone.
53
- */
54
- private _initialLocalMatrix;
55
- /**
56
- * Initial state of the rotation of the bone.
57
- */
58
- private _initialLocalRotation;
59
- /**
60
- * Initial state of the position of its child.
61
- */
62
- private _initialLocalChildPosition;
63
- readonly initialLocalChildPosition: THREE.Vector3;
64
- /*
65
- * Returns the world matrix of its parent object.
66
- * Note that it returns a reference to the matrix. Don't mutate this directly!
67
- */
68
- private readonly _parentMatrixWorld: any;
69
- /**
70
- * Create a new VRMSpringBone.
71
- *
72
- * @param bone An Object3D that will be attached to this bone
73
- * @param child An Object3D that will be used as a tail of this spring bone. It can be null when the spring bone is imported from VRM 0.0
74
- * @param settings Several parameters related to behavior of the spring bone
75
- * @param colliderGroups Collider groups that will be collided with this spring bone
76
- */
77
- constructor(bone: THREE.Object3D, child: THREE.Object3D | null, settings?: Partial<VRMSpringBoneJointSettings>, colliderGroups?: VRMSpringBoneColliderGroup[]);
78
- /**
79
- * Set the initial state of this spring bone.
80
- * You might want to call {@link VRMSpringBoneManager.setInitState} instead.
81
- */
82
- setInitState(): void;
83
- /**
84
- * Reset the state of this bone.
85
- * You might want to call [[VRMSpringBoneManager.reset]] instead.
86
- */
87
- reset(): void;
88
- /**
89
- * Update the state of this bone.
90
- * You might want to call [[VRMSpringBoneManager.update]] instead.
91
- *
92
- * @param delta deltaTime
93
- */
94
- update(delta: number): void;
95
- /**
96
- * Do collision math against every colliders attached to this bone.
97
- *
98
- * @param tail The tail you want to process
99
- */
100
- private _collision;
101
- /**
102
- * Calculate the {@link _worldSpaceBoneLength}.
103
- * Intended to be used in {@link update}.
104
- */
105
- private _calcWorldSpaceBoneLength;
106
- /**
107
- * Create a matrix that converts center space into world space.
108
- * @param target Target matrix
109
- */
110
- private _getMatrixCenterToWorld;
111
- /**
112
- * Create a matrix that converts world space into center space.
113
- * @param target Target matrix
114
- */
115
- private _getMatrixWorldToCenter;
116
- }
@@ -1,11 +0,0 @@
1
- import * as THREE from 'three';
2
- export interface VRMSpringBoneJointSettings {
3
- /**
4
- * Radius of the bone, will be used for collision.
5
- */
6
- hitRadius: number;
7
- stiffness: number;
8
- gravityPower: number;
9
- gravityDir: THREE.Vector3;
10
- dragForce: number;
11
- }
@@ -1,34 +0,0 @@
1
- import * as THREE from 'three';
2
- import { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
3
- import { VRMSpringBoneLoaderPluginOptions } from './VRMSpringBoneLoaderPluginOptions';
4
- export declare class VRMSpringBoneLoaderPlugin implements GLTFLoaderPlugin {
5
- static readonly EXTENSION_NAME = "VRMC_springBone";
6
- /**
7
- * Specify an Object3D to add {@link VRMSpringBoneJointHelper} s.
8
- * If not specified, helper will not be created.
9
- * If `renderOrder` is set to the root, helpers will copy the same `renderOrder` .
10
- */
11
- jointHelperRoot?: THREE.Object3D;
12
- /**
13
- * Specify an Object3D to add {@link VRMSpringBoneJointHelper} s.
14
- * If not specified, helper will not be created.
15
- * If `renderOrder` is set to the root, helpers will copy the same `renderOrder` .
16
- */
17
- colliderHelperRoot?: THREE.Object3D;
18
- readonly parser: GLTFParser;
19
- readonly name: string;
20
- constructor(parser: GLTFParser, options?: VRMSpringBoneLoaderPluginOptions);
21
- afterRoot(gltf: GLTF): Promise<void>;
22
- /**
23
- * Import spring bones from a GLTF and return a {@link VRMSpringBoneManager}.
24
- * It might return `null` instead when it does not need to be created or something go wrong.
25
- *
26
- * @param gltf A parsed result of GLTF taken from GLTFLoader
27
- */
28
- private _import;
29
- private _v1Import;
30
- private _v0Import;
31
- private _importJoint;
32
- private _importSphereCollider;
33
- private _importCapsuleCollider;
34
- }
@@ -1,15 +0,0 @@
1
- import * as THREE from 'three';
2
- export interface VRMSpringBoneLoaderPluginOptions {
3
- /**
4
- * Specify an Object3D to add {@link VRMSpringBoneJointHelper} s.
5
- * If not specified, helper will not be created.
6
- * If `renderOrder` is set to the root, helpers will copy the same `renderOrder` .
7
- */
8
- jointHelperRoot?: THREE.Object3D;
9
- /**
10
- * Specify an Object3D to add {@link VRMSpringBoneColliderHelper} s.
11
- * If not specified, helper will not be created.
12
- * If `renderOrder` is set to the root, helpers will copy the same `renderOrder` .
13
- */
14
- colliderHelperRoot?: THREE.Object3D;
15
- }
@@ -1,47 +0,0 @@
1
- import { VRMSpringBoneJoint } from './VRMSpringBoneJoint';
2
- import { VRMSpringBoneCollider } from './VRMSpringBoneCollider';
3
- import { VRMSpringBoneColliderGroup } from './VRMSpringBoneColliderGroup';
4
- export declare class VRMSpringBoneManager {
5
- private _joints;
6
- readonly joints: Set<VRMSpringBoneJoint>;
7
- /*
8
- * @deprecated Use {@link joints} instead.
9
- */
10
- readonly springBones: Set<VRMSpringBoneJoint>;
11
- readonly colliderGroups: VRMSpringBoneColliderGroup[];
12
- readonly colliders: VRMSpringBoneCollider[];
13
- private _objectSpringBonesMap;
14
- addJoint(joint: VRMSpringBoneJoint): void;
15
- /**
16
- * @deprecated Use {@link addJoint} instead.
17
- */
18
- addSpringBone(joint: VRMSpringBoneJoint): void;
19
- deleteJoint(joint: VRMSpringBoneJoint): void;
20
- /**
21
- * @deprecated Use {@link deleteJoint} instead.
22
- */
23
- deleteSpringBone(joint: VRMSpringBoneJoint): void;
24
- setInitState(): void;
25
- reset(): void;
26
- update(delta: number): void;
27
- /**
28
- * Update a spring bone.
29
- * If there are other spring bone that are dependant, it will try to update them recursively.
30
- * It updates matrixWorld of all ancestors and myself.
31
- * It might throw an error if there are circular dependencies.
32
- *
33
- * Intended to be used in {@link update} and {@link _processSpringBone} itself recursively.
34
- *
35
- * @param springBone A springBone you want to update
36
- * @param springBonesTried Set of springBones that are already tried to be updated
37
- * @param springBonesDone Set of springBones that are already up to date
38
- * @param objectUpdated Set of object3D whose matrixWorld is updated
39
- */
40
- private _processSpringBone;
41
- /**
42
- * Return a set of objects that are dependant of given spring bone.
43
- * @param springBone A spring bone
44
- * @return A set of objects that are dependant of given spring bone
45
- */
46
- private _getDependencies;
47
- }
@@ -1,10 +0,0 @@
1
- import * as THREE from 'three';
2
- import { VRMSpringBoneCollider } from '../VRMSpringBoneCollider';
3
- export declare class VRMSpringBoneColliderHelper extends THREE.Group {
4
- readonly collider: VRMSpringBoneCollider;
5
- private readonly _geometry;
6
- private readonly _line;
7
- constructor(collider: VRMSpringBoneCollider);
8
- dispose(): void;
9
- updateMatrixWorld(force: boolean): void;
10
- }
@@ -1,10 +0,0 @@
1
- import * as THREE from 'three';
2
- import { VRMSpringBoneJoint } from '../VRMSpringBoneJoint';
3
- export declare class VRMSpringBoneJointHelper extends THREE.Group {
4
- readonly springBone: VRMSpringBoneJoint;
5
- private readonly _geometry;
6
- private readonly _line;
7
- constructor(springBone: VRMSpringBoneJoint);
8
- dispose(): void;
9
- updateMatrixWorld(force: boolean): void;
10
- }
@@ -1,2 +0,0 @@
1
- export { VRMSpringBoneColliderHelper } from './VRMSpringBoneColliderHelper';
2
- export { VRMSpringBoneJointHelper } from './VRMSpringBoneJointHelper';
@@ -1,5 +0,0 @@
1
- import * as THREE from 'three';
2
- export interface ColliderShapeBufferGeometry extends THREE.BufferGeometry {
3
- worldScale: number;
4
- update: () => void;
5
- }
@@ -1,16 +0,0 @@
1
- import * as THREE from 'three';
2
- import { VRMSpringBoneColliderShapeCapsule } from '../../VRMSpringBoneColliderShapeCapsule';
3
- import { ColliderShapeBufferGeometry } from './ColliderShapeBufferGeometry';
4
- export declare class ColliderShapeCapsuleBufferGeometry extends THREE.BufferGeometry implements ColliderShapeBufferGeometry {
5
- worldScale: number;
6
- private readonly _attrPos;
7
- private readonly _attrIndex;
8
- private readonly _shape;
9
- private _currentRadius;
10
- private readonly _currentOffset;
11
- private readonly _currentTail;
12
- constructor(shape: VRMSpringBoneColliderShapeCapsule);
13
- update(): void;
14
- private _buildPosition;
15
- private _buildIndex;
16
- }
@@ -1,15 +0,0 @@
1
- import * as THREE from 'three';
2
- import { VRMSpringBoneColliderShapeSphere } from '../../VRMSpringBoneColliderShapeSphere';
3
- import { ColliderShapeBufferGeometry } from './ColliderShapeBufferGeometry';
4
- export declare class ColliderShapeSphereBufferGeometry extends THREE.BufferGeometry implements ColliderShapeBufferGeometry {
5
- worldScale: number;
6
- private readonly _attrPos;
7
- private readonly _attrIndex;
8
- private readonly _shape;
9
- private _currentRadius;
10
- private readonly _currentOffset;
11
- constructor(shape: VRMSpringBoneColliderShapeSphere);
12
- update(): void;
13
- private _buildPosition;
14
- private _buildIndex;
15
- }
@@ -1,14 +0,0 @@
1
- import * as THREE from 'three';
2
- import { VRMSpringBoneJoint } from '../../VRMSpringBoneJoint';
3
- export declare class SpringBoneBufferGeometry extends THREE.BufferGeometry {
4
- worldScale: number;
5
- private readonly _attrPos;
6
- private readonly _attrIndex;
7
- private readonly _springBone;
8
- private _currentRadius;
9
- private readonly _currentTail;
10
- constructor(springBone: VRMSpringBoneJoint);
11
- update(): void;
12
- private _buildPosition;
13
- private _buildIndex;
14
- }
@@ -1,10 +0,0 @@
1
- export * from './helpers';
2
- export * from './VRMSpringBoneCollider';
3
- export * from './VRMSpringBoneColliderGroup';
4
- export * from './VRMSpringBoneColliderShape';
5
- export * from './VRMSpringBoneColliderShapeCapsule';
6
- export * from './VRMSpringBoneColliderShapeSphere';
7
- export * from './VRMSpringBoneJoint';
8
- export * from './VRMSpringBoneLoaderPlugin';
9
- export * from './VRMSpringBoneManager';
10
- export * from './VRMSpringBoneJointSettings';
@@ -1,9 +0,0 @@
1
- /// <reference types="jest" />
2
- export declare function toBeCloseToArray(received: number[], expected: number[], precision?: number): jest.CustomMatcherResult;
3
- declare global {
4
- namespace jest {
5
- interface Matchers<R> {
6
- toBeCloseToArray(expected: number[], precision?: number): R;
7
- }
8
- }
9
- }
@@ -1,10 +0,0 @@
1
- /// <reference types="jest" />
2
- import * as THREE from 'three';
3
- export declare function toBeCloseToVector3(received: THREE.Vector3, expected: THREE.Vector3, precision?: number): jest.CustomMatcherResult;
4
- declare global {
5
- namespace jest {
6
- interface Matchers<R> {
7
- toBeCloseToVector3(expected: THREE.Vector3, precision?: number): R;
8
- }
9
- }
10
- }
@@ -1,28 +0,0 @@
1
- import * as THREE from 'three';
2
- export declare class Matrix4InverseCache {
3
- /**
4
- * The target matrix.
5
- */
6
- readonly matrix: THREE.Matrix4;
7
- /**
8
- * A cache of inverse of current matrix.
9
- */
10
- private readonly _inverseCache;
11
- /**
12
- * A flag that makes it want to recalculate its {@link _inverseCache}.
13
- * Will be set `true` when `elements` are mutated and be used in `getInverse`.
14
- */
15
- private _shouldUpdateInverse;
16
- /**
17
- * The original of `matrix.elements`
18
- */
19
- private readonly _originalElements;
20
- /*
21
- * Inverse of given matrix.
22
- * Note that it will return its internal private instance.
23
- * Make sure copying this before mutate this.
24
- */
25
- readonly inverse: THREE.Matrix4;
26
- constructor(matrix: THREE.Matrix4);
27
- revert(): void;
28
- }
@@ -1,10 +0,0 @@
1
- import * as THREE from 'three';
2
- /**
3
- * A replacement of `Object3D.getWorldQuaternion`.
4
- * Extract the world quaternion of an object from its world space matrix, without calling `Object3D.updateWorldMatrix`.
5
- * Use this when you're sure that the world matrix is up-to-date.
6
- *
7
- * @param object The object
8
- * @param out A target quaternion
9
- */
10
- export declare function getWorldQuaternionLite(object: THREE.Object3D, out: THREE.Quaternion): THREE.Quaternion;
@@ -1,8 +0,0 @@
1
- import * as THREE from 'three';
2
- /**
3
- * A compat function for `Matrix4.invert()` / `Matrix4.getInverse()`.
4
- * `Matrix4.invert()` is introduced in r123 and `Matrix4.getInverse()` emits a warning.
5
- * We are going to use this compat for a while.
6
- * @param target A target matrix
7
- */
8
- export declare function mat4InvertCompat<T extends THREE.Matrix4>(target: T): T;
@@ -1,2 +0,0 @@
1
- import * as THREE from 'three';
2
- export declare function traverseAncestorsFromRoot(object: THREE.Object3D, callback: (object: THREE.Object3D) => void): void;
@@ -1,9 +0,0 @@
1
- import * as THREE from 'three';
2
- /**
3
- * Traverse children of given object and execute given callback.
4
- * The given object itself wont be given to the callback.
5
- * If the return value of the callback is `true`, it will halt the traversal of its children.
6
- * @param object A root object
7
- * @param callback A callback function called for each children
8
- */
9
- export declare function traverseChildrenUntilConditionMet(object: THREE.Object3D, callback: (object: THREE.Object3D) => boolean): void;
@@ -1,9 +0,0 @@
1
- /// <reference types="jest" />
2
- export declare function toBeCloseToArray(received: number[], expected: number[], precision?: number): jest.CustomMatcherResult;
3
- declare global {
4
- namespace jest {
5
- interface Matchers<R> {
6
- toBeCloseToArray(expected: number[], precision?: number): R;
7
- }
8
- }
9
- }
@@ -1,10 +0,0 @@
1
- /// <reference types="jest" />
2
- import * as THREE from 'three';
3
- export declare function toBeCloseToVector3(received: THREE.Vector3, expected: THREE.Vector3, precision?: number): jest.CustomMatcherResult;
4
- declare global {
5
- namespace jest {
6
- interface Matchers<R> {
7
- toBeCloseToVector3(expected: THREE.Vector3, precision?: number): R;
8
- }
9
- }
10
- }