示例#1
0
        public void Shape(Vector3 dv, ref Dictionary <Guid, MeshUndoInfo> undoInfo)
        {
            if (IsMirrored)
            {
                dv.X *= -1.0f;
            }
            foreach (var p in PartsPoints)
            {
                MeshUndoInfo info;
                if (!undoInfo.TryGetValue(p.Key.Guid, out info))
                {
                    info = new MeshUndoInfo();
                    undoInfo.Add(p.Key.Guid, info);
                }
                var point = p.Key.Points[p.Value];
                if (!info.Points.ContainsKey(p.Value))
                {
                    info.Points.Add(p.Value, point.Position);
                }

                point.Position += dv * Coef;
                foreach (var id in point.Indices)
                {
                    var v = p.Key.Vertices[id];
                    v.Position         = point.Position;
                    p.Key.Vertices[id] = v;
                }
            }
        }
示例#2
0
        public MeshUndoInfo GetUndoInfo()
        {
            var info = new MeshUndoInfo();

            for (int i = 0; i < Points.Count; i++)
            {
                info.Points.Add(i, Points[i].Position);
            }
            return(info);
        }
示例#3
0
        public MeshUndoInfo Clone()
        {
            var result = new MeshUndoInfo();

            foreach (var v in Points)
            {
                result.Points.Add(v.Key, v.Value);
            }
            return(result);
        }
示例#4
0
 public void Undo(MeshUndoInfo info)
 {
     foreach (var p in info.Points)
     {
         var point = Points[p.Key];
         point.Position = p.Value;
         foreach (var idx in point.Indices)
         {
             var vertex = Vertices[idx];
             vertex.Position = point.Position;
             Vertices[idx]   = vertex;
         }
     }
     UpdateNormals();
 }