/// <summary> /// Initializes a new instance of the <see cref="Bone" /> class. /// </summary> /// <param name="data">The data.</param> /// <param name="parent">May be null.</param> /// <exception cref="System.ArgumentNullException">data cannot be null.</exception> public Bone(BoneData data, Bone parent) { if (data == null) { throw new ArgumentNullException("data cannot be null."); } this.Data = data; this.Parent = parent; this.SetToBindPose(); }
/// <summary> /// Initializes a new instance of the <see cref="Slot" /> class. /// </summary> /// <param name="data">The data.</param> /// <param name="skeleton">The skeleton.</param> /// <param name="bone">The bone.</param> /// <exception cref="System.ArgumentNullException">data cannot be null.</exception> public Slot(SlotData data, Skeleton skeleton, Bone bone) { if (data == null) { throw new ArgumentNullException("data cannot be null."); } if (skeleton == null) { throw new ArgumentNullException("skeleton cannot be null."); } if (bone == null) { throw new ArgumentNullException("bone cannot be null."); } this.Data = data; Skeleton = skeleton; Bone = bone; this.SetToBindPose(); }
/// <summary> /// Updates the vertices. /// </summary> /// <param name="bone">The bone.</param> public void UpdateVertices(Bone bone) { float x = bone.WorldX; float y = bone.WorldY; float m00 = bone.M00; float m01 = bone.M01; float m10 = bone.M10; float m11 = bone.M11; float[] vertices = this.Vertices; float[] offset = this.Offset; vertices[X1] = (offset[X1] * m00) + (offset[Y1] * m01) + x; vertices[Y1] = (offset[X1] * m10) + (offset[Y1] * m11) + y; vertices[X2] = (offset[X2] * m00) + (offset[Y2] * m01) + x; vertices[Y2] = (offset[X2] * m10) + (offset[Y2] * m11) + y; vertices[X3] = (offset[X3] * m00) + (offset[Y3] * m01) + x; vertices[Y3] = (offset[X3] * m10) + (offset[Y3] * m11) + y; vertices[X4] = (offset[X4] * m00) + (offset[Y4] * m01) + x; vertices[Y4] = (offset[X4] * m10) + (offset[Y4] * m11) + y; }