GetSegmentResolution() 개인적인 정적인 메소드

private static GetSegmentResolution ( float minTime, float maxTime, float keyTime, float nextKeyTime ) : int
minTime float
maxTime float
keyTime float
nextKeyTime float
리턴 int
예제 #1
0
 private void AddPoints(ref List <Vector3> points, float minTime, float maxTime, float visibleMinTime, float visibleMaxTime)
 {
     if (this.m_Curve[0].time >= minTime)
     {
         points.Add(new Vector3(this.rangeStart, this.m_Curve[0].value));
         points.Add(new Vector3(this.m_Curve[0].time, this.m_Curve[0].value));
     }
     for (int i = 0; i < this.m_Curve.length - 1; i++)
     {
         Keyframe keyframe  = this.m_Curve[i];
         Keyframe keyframe2 = this.m_Curve[i + 1];
         if (keyframe2.time >= minTime && keyframe.time <= maxTime)
         {
             points.Add(new Vector3(keyframe.time, keyframe.value));
             int   segmentResolution = NormalCurveRenderer.GetSegmentResolution(visibleMinTime, visibleMaxTime, keyframe.time, keyframe2.time);
             float num = Mathf.Lerp(keyframe.time, keyframe2.time, 0.001f / (float)segmentResolution);
             points.Add(new Vector3(num, this.m_Curve.Evaluate(num)));
             for (float num2 = 1f; num2 < (float)segmentResolution; num2 += 1f)
             {
                 num = Mathf.Lerp(keyframe.time, keyframe2.time, num2 / (float)segmentResolution);
                 points.Add(new Vector3(num, this.m_Curve.Evaluate(num)));
             }
             num = Mathf.Lerp(keyframe.time, keyframe2.time, 1f - 0.001f / (float)segmentResolution);
             points.Add(new Vector3(num, this.m_Curve.Evaluate(num)));
             num = keyframe2.time;
             points.Add(new Vector3(num, keyframe2.value));
         }
     }
     if (this.m_Curve[this.m_Curve.length - 1].time <= maxTime)
     {
         points.Add(new Vector3(this.m_Curve[this.m_Curve.length - 1].time, this.m_Curve[this.m_Curve.length - 1].value));
         points.Add(new Vector3(this.rangeEnd, this.m_Curve[this.m_Curve.length - 1].value));
     }
 }
예제 #2
0
        private void AddPoints(ref List <Vector3> points, float minTime, float maxTime, float visibleMinTime, float visibleMaxTime)
        {
            if ((double)this.m_Curve[0].time >= (double)minTime)
            {
                points.Add(new Vector3(this.rangeStart, this.m_Curve[0].value));

                points.Add(new Vector3(this.m_Curve[0].time, this.m_Curve[0].value));
            }
            for (int index = 0; index < this.m_Curve.length - 1; ++index)
            {
                Keyframe keyframe1 = this.m_Curve[index];
                Keyframe keyframe2 = this.m_Curve[index + 1];
                if ((double)keyframe2.time >= (double)minTime && (double)keyframe1.time <= (double)maxTime)
                {
                    points.Add(new Vector3(keyframe1.time, keyframe1.value));

                    int   segmentResolution = NormalCurveRenderer.GetSegmentResolution(visibleMinTime, visibleMaxTime, keyframe1.time, keyframe2.time);
                    float num1 = Mathf.Lerp(keyframe1.time, keyframe2.time, 1f / 1000f / (float)segmentResolution);
                    points.Add(new Vector3(num1, this.m_Curve.Evaluate(num1)));
                    for (float num2 = 1f; (double)num2 < (double)segmentResolution; ++num2)
                    {
                        float num3 = Mathf.Lerp(keyframe1.time, keyframe2.time, num2 / (float)segmentResolution);
                        points.Add(new Vector3(num3, this.m_Curve.Evaluate(num3)));
                    }
                    float num4 = Mathf.Lerp(keyframe1.time, keyframe2.time, (float)(1.0 - 1.0 / 1000.0 / (double)segmentResolution));
                    points.Add(new Vector3(num4, this.m_Curve.Evaluate(num4)));
                    float time = keyframe2.time;
                    points.Add(new Vector3(time, keyframe2.value));
                }
            }
            if ((double)this.m_Curve[this.m_Curve.length - 1].time > (double)maxTime)
            {
                return;
            }
            points.Add(new Vector3(this.m_Curve[this.m_Curve.length - 1].time, this.m_Curve[this.m_Curve.length - 1].value));
            points.Add(new Vector3(this.rangeEnd, this.m_Curve[this.m_Curve.length - 1].value));
        }