Пример #1
0
        /// Will flag a control point to keep, and a control point in the specified direction that is
        /// greater than the 'spawn interval' away.
        private void SavePointSequence(Stroke stroke, bool[] toDrop, int point,
                                       int dir, BaseBrushScript brushScript)
        {
            int count = (dir == 1) ? brushScript.Descriptor.m_HeadMinPoints
                : brushScript.Descriptor.m_TailMinPoints;
            int step = (dir == 1)
                ? brushScript.Descriptor.m_HeadPointStep
                : brushScript.Descriptor.m_TailPointStep;
            int lastPoint = point;

            toDrop[point] = false;
            float spawnInterval = brushScript.GetSpawnInterval(stroke.m_ControlPoints[point].m_Pressure);
            float sqrMinDist    = spawnInterval * spawnInterval;

            for (int i = point + dir; i < stroke.m_ControlPoints.Length && i >= 0; i += dir)
            {
                Vector3 diff = stroke.m_ControlPoints[i].m_Pos - stroke.m_ControlPoints[lastPoint].m_Pos;
                if (count % step == 0)
                {
                    toDrop[i] = false;
                }
                if (diff.sqrMagnitude >= sqrMinDist)
                {
                    if (--count <= 0)
                    {
                        return;
                    }
                    lastPoint = i;
                }
            }
            toDrop[point + dir] = false;
        }
Пример #2
0
 public float GetCurrentLineSpawnInterval(float pressure01)
 {
     if (m_CurrentLine != null)
     {
         return(m_CurrentLine.GetSpawnInterval(pressure01));
     }
     return(1.0f);
 }