UNPKG

@awayjs/graphics

Version:
54 lines (53 loc) 1.77 kB
import { Matrix3D, Quaternion, Vector3D } from '@awayjs/core'; /** * Contains transformation data for a skeleton joint, used for skeleton animation. * * @see away.animation.Skeleton * @see away.animation.SkeletonJoint * * todo: support (uniform) scale */ var JointPose = /** @class */ (function () { function JointPose() { /** * The rotation of the pose stored as a quaternion */ this.orientation = new Quaternion(); /** * The translation of the pose */ this.translation = new Vector3D(); } /** * Converts the transformation to a Matrix3D representation. * * @param target An optional target matrix to store the transformation. If not provided, it will create a new instance. * @return The transformation matrix of the pose. */ JointPose.prototype.toMatrix3D = function (target) { if (target === void 0) { target = null; } if (target == null) target = new Matrix3D(); this.orientation.toMatrix3D(target); target.appendTranslation(this.translation.x, this.translation.y, this.translation.z); return target; }; /** * Copies the transformation data from a source pose object into the existing pose object. * * @param pose The source pose to copy from. */ JointPose.prototype.copyFrom = function (pose) { var or = pose.orientation; var tr = pose.translation; this.orientation.x = or.x; this.orientation.y = or.y; this.orientation.z = or.z; this.orientation.w = or.w; this.translation.x = tr.x; this.translation.y = tr.y; this.translation.z = tr.z; }; return JointPose; }()); export { JointPose };