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; this.skeleton = skeleton; this.bone = bone; SetToSetupPose(); }
/// <param name="worldVertices">Must have at least the same length as this attachment's vertices.</param> public void ComputeWorldVertices (float x, float y, Bone bone, float[] worldVertices) { x += bone.worldX; y += bone.worldY; float m00 = bone.m00; float m01 = bone.m01; float m10 = bone.m10; float m11 = bone.m11; float[] vertices = Vertices; for (int i = 0, n = vertices.Length; i < n; i += 2) { float px = vertices[i]; float py = vertices[i + 1]; worldVertices[i] = px * m00 + py * m01 + x; worldVertices[i + 1] = px * m10 + py * m11 + y; } }
/// <param name="parent">May be null.</param> public Bone (BoneData data, Bone parent) { if (data == null) throw new ArgumentNullException("data cannot be null."); this.data = data; this.parent = parent; SetToSetupPose(); }
public void ComputeWorldVertices (float x, float y, Bone bone, float[] vertices) { x += bone.worldX; y += bone.worldY; float m00 = bone.m00; float m01 = bone.m01; float m10 = bone.m10; float m11 = bone.m11; 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; }