Exemplo n.º 1
0
    void SetupCurve()
    {
        m_Curve = new AnimationCurve();

        FilmicCurve dt = this;

        float min = dt.m_BlackPoint;
        float max = dt.m_WhitePoint;

        int   nbFrame = 40;
        float step    = (max - min) / nbFrame;

        float curr = min;
        float k    = dt.ComputeK(dt.m_ToeStrength, dt.m_CrossOverPoint, dt.m_BlackPoint, dt.m_ShoulderStrength, dt.m_WhitePoint);

        dt.StoreK();
        dt.ComputeShaderCoefficients(dt.m_ToeStrength, dt.m_CrossOverPoint, dt.m_BlackPoint, dt.m_ShoulderStrength, dt.m_WhitePoint, k);

        for (int i = 0; i < nbFrame + 1; ++i)
        {
            float value = dt.Graph(curr, dt.m_ToeStrength, dt.m_CrossOverPoint, dt.m_BlackPoint, dt.m_ShoulderStrength, dt.m_WhitePoint, k);
            m_Curve.AddKey(new Keyframe(curr, value));

            curr += step;
        }

        for (int i = 0; i < m_Curve.keys.Length - 1; ++i)
        {
            float tangent = CalculateLinearTangent(m_Curve, i, i + 1);
            m_Curve.keys[i].inTangent  = tangent;
            m_Curve.keys[i].outTangent = tangent;

            m_Curve.SmoothTangents(i, 0.0f);
        }
    }
Exemplo n.º 2
0
 public void StoreK()
 {
     m_MainCurve.StoreK();
 }