예제 #1
0
        public void Do()
        {
            (var min, var max) = TargetVertices.Select(vtx => vtx.UV.ToVector2()).MinMax();
            var center = ((min + max) / 2).ToVector3();

            bool XorBoth = ReverseAxis != Axis.Y;
            bool YorBoth = ReverseAxis != Axis.X;

            Matrix reverser = Matrix.Invert(Matrix.Translation(center)) * Matrix.Scaling(XorBoth ? -1 : 1, YorBoth ? -1 : 1, 1) * Matrix.Translation(center);

            TargetVertices.AsParallel().ForAll(vtx => vtx.UV = Vector2.TransformCoordinate(vtx.UV, reverser));
        }
 public void Undo()
 {
     TargetVertices.AsParallel().ForAll(vtx => vtx.UV = PreviousUV[vtx]);
 }
 public void Do()
 {
     PreviousUV = TargetVertices.AsParallel().ToDictionary(v => v, v => v.UV.Clone());
     TargetVertices.AsParallel().ForAll(vtx => vtx.UV = Vector2.TransformCoordinate(vtx.UV, Offset));
 }