private void CalcGeometry(Matrix32 matrix, out Vector2 a, out Vector2 b) { NineGrid.BuildLayout(parts, (Vector2)Owner.Texture.ImageSize, Owner.LeftOffset, Owner.RightOffset, Owner.TopOffset, Owner.BottomOffset, Owner.Size); a = matrix.TransformVector(parts[IndexA].Rect.A); b = matrix.TransformVector(parts[IndexB].Rect.B); }
private static void RestoreChildrenPositions(Widget widget, Matrix32 transform) { foreach (var child in widget.Nodes.OfType <Widget>()) { var newPosition = transform.TransformVector(child.Position); SetProperty.Perform(child, nameof(Widget.Position), newPosition); if (child.Animators.TryFind(nameof(Widget.Position), out var animator)) { foreach (var key in animator.ReadonlyKeys.ToList()) { var newKey = key.Clone(); newKey.Value = transform.TransformVector((Vector2)key.Value); SetKeyframe.Perform(animator, newKey); } } } }
private static Rectangle ExpandMeshLocalAABB( Rectangle aabb, Vector2 size, DistortionMeshPoint point, BoneArray bones, Matrix32 weightsMatrix, Matrix32 weightsMatrixInversed ) { var position = size * point.Position + point.Offset; if (point.SkinningWeights != null) { position = weightsMatrixInversed.TransformVector(bones.ApplySkinningToVector( weightsMatrix.TransformVector(position), point.SkinningWeights )); } return(aabb.IncludingPoint(position)); }