import { vec3 , quat } from 'gl-matrix' ; import Transform from '../maths/Transform' ; class Bone { name : string ; idx : number ; pidx : number ; len : number ; local = new Transform ( ) ; world = new Transform ( ) ; constructor ( name , idx , len = 0 ) { this . name = name ; this . idx = idx ; this . pidx = - 1 ; this . len = len ; } setLocal ( rot ? , pos ? , scl ? ) { if ( rot ) quat . copy ( this . local . rot , rot ) ; if ( pos ) vec3 . copy ( this . local . pos , pos ) ; if ( scl ) vec3 . copy ( this . local . scl , scl ) ; return this ; } clone ( ) { const b = new Bone ( this . name , this . idx , this . len ) ; b . pidx = this . pidx ; b . local . copy ( this . local ) ; b . world . copy ( this . world ) ; return b ; } } export default Bone ;