Esempio n. 1
0
        private void GetRelativePath(int index, out ParticleRelativePath particlePath, out int localIndex, out int listIndex)
        {
            particlePath = null;
            localIndex   = 0;
            listIndex    = 0;

            if (m_paths.Count < 1)
            {
                return;
            }

            if (index < 0 || index >= GetPathPointCount())
            {
                return;
            }

            int pointSum = 0;

            for (int r = 0; r < m_paths.Count; r++)
            {
                var pathList = m_paths[r];
                listIndex = r;
                float ratio = (float)(index + 1) / (pointSum + pathList.GetPointCount());
                if (ratio <= 1.0f)
                {
                    break;
                }

                pointSum += pathList.GetPointCount();
            }

            particlePath = m_paths[listIndex];
            localIndex   = index - pointSum;
        }
Esempio n. 2
0
        private void GetCurrentIndices(out int localIndex, out int listIndex)
        {
            double globalRatio        = GetGlobalRatio();
            var    pointCount         = GetPathPointCount() - 1;
            int    pathIndex          = 1 + (int)(globalRatio * pointCount);
            ParticleRelativePath path = null;

            localIndex = 0;
            listIndex  = 0;
            GetRelativePath(pathIndex, out path, out localIndex, out listIndex);
        }
Esempio n. 3
0
        private Vector3D GetPathPoint(int index)
        {
            ParticleRelativePath path = null;
            int localIndex            = 0;
            int listIndex             = 0;

            GetRelativePath(index, out path, out localIndex, out listIndex);
            if (path == null)
            {
                return(m_paths[m_paths.Count() - 1].GetPoint(m_paths[m_paths.Count() - 1].GetPointCount()));
            }

            Vector3D point = path.GetPoint(localIndex);

            return(point);
        }
Esempio n. 4
0
        private int GetCurrentListIndex()
        {
            double globalRatio        = GetGlobalRatio();
            var    pointCount         = GetPathPointCount() - 1;
            int    pathIndex          = 1 + (int)(globalRatio * pointCount);
            ParticleRelativePath path = null;
            int localIndex            = 0;
            int listIndex             = 0;

            GetRelativePath(pathIndex, out path, out localIndex, out listIndex);
            if (path == null)
            {
                return(0);
            }

            return(listIndex);
        }