예제 #1
0
        public static StrokeModificationHint ModifiedPoints(List <int> pointsModified)
        {
            var modHint = new StrokeModificationHint(StrokeModificationType.ModifiedPoints);

            modHint.pointsModified = pointsModified;
            return(modHint);
        }
예제 #2
0
        public override void UpdateRenderer(Stroke stroke, StrokeModificationHint modHint)
        {
            switch (modHint.modType)
            {
            case StrokeModificationType.Overhaul:
                SegmentRenderer.Initialize();
                for (int i = 0; i < stroke.Count; i++)
                {
                    ProcessAddedPoint(stroke, i);
                }
                break;

            case StrokeModificationType.AddedPoint:
                ProcessAddedPoint(stroke, stroke.Count - 1);
                break;

            case StrokeModificationType.AddedPoints:
                for (int i = stroke.Count - modHint.numPointsAdded; i < stroke.Count; i++)
                {
                    ProcessAddedPoint(stroke, i);
                }
                break;

            case StrokeModificationType.ModifiedPoints:
                ProcessModifiedPoints(modHint.pointsModified);
                break;

            default:
                throw new System.NotImplementedException();
            }
        }
예제 #3
0
        public static StrokeModificationHint AddedPoints(int numPointsAdded)
        {
            var modHint = new StrokeModificationHint(StrokeModificationType.AddedPoints);

            modHint.numPointsAdded = numPointsAdded;
            return(modHint);
        }
예제 #4
0
 void Update()
 {
     if (stroke != _lastAttachedStroke)
     {
         _lastAttachedStroke      = stroke;
         stroke.OnStrokeModified += OnStrokeModified;                 // Allow changes to the underlying Stroke to propagate to listeners of this Filter.
         OnStrokeModified(stroke, StrokeModificationHint.Overhaul()); // Since our attached Stroke changed, fire an Overhaul modification message to listeners.
     }
 }
예제 #5
0
        public void Add(StrokePoint strokePoint)
        {
            strokePoints.Add(strokePoint);
            OnStrokeModified(this, StrokeModificationHint.AddedPoint());

            if (autoOrient && Count > 1)
            {
                StrokePoint p0            = strokePoints[Count - 2];
                StrokePoint p1            = strokePoints[Count - 1];
                Quaternion  rotCorrection = StrokeUtil.CalculateRotation(p0, p1);
                p0.rotation = rotCorrection * p0.rotation;
                p1.rotation = p0.rotation;

                _cachedModifiedPointIndices.Clear();
                _cachedModifiedPointIndices.Add(Count - 2);
                _cachedModifiedPointIndices.Add(Count - 1);
                OnStrokeModified(this, StrokeModificationHint.ModifiedPoints(_cachedModifiedPointIndices));
            }
        }
예제 #6
0
 /// <summary>
 /// Render (or re-render) the given Stroke, or (better yet) use the StrokeModificationHint to
 /// re-render the given Stroke in a more optimized way where possible.
 /// </summary>
 public abstract void UpdateRenderer(Stroke stroke, StrokeModificationHint modHint);
 public override void UpdateRenderer(Stroke stroke, StrokeModificationHint modHint)
 {
     this.stroke = stroke;
 }
예제 #8
0
        public static StrokeModificationHint AddedPoint()
        {
            var modHint = new StrokeModificationHint(StrokeModificationType.AddedPoint);

            return(modHint);
        }
예제 #9
0
        public static StrokeModificationHint Overhaul()
        {
            var modHint = new StrokeModificationHint(StrokeModificationType.Overhaul);

            return(modHint);
        }