// Update is called once per frame
    void Update()
    {
        m_UnityCam = Camera.main;
        m_SoftCam  = SoftCamera.MainCamera;

        CheckSoftCameraLog();

        if (!IsShowSoftCamerLog)
        {
            m_UnityCam = Camera.main;

            if (m_UnityCam != null && m_SoftCam != null)
            {
                /*
                 * Triangle tri1 = new Triangle(
                 *  new Vector3(-0.6f, 0f, -8.6f),
                 *  new Vector3(0.8f, 1.0f, -10.1f),
                 *  new Vector3(0.8f, 0f, -10.1f)
                 *  );
                 * Triangle tri2 = tri1;
                 * tri1.Trans(m_UnityCam.WorldToScreenPoint);
                 * // tri2.MulMatrix(m_SoftCam.ViewProjMatrix);
                 * tri2.Trans(m_SoftCam.WorldToScreenPointEvt);
                 *
                 * Debug.LogErrorFormat("【Unity】{0}【Soft】{1}", tri1.ToString(), tri2.ToString());
                 */


                Triangle tri = new Triangle(
                    new Vector3(-100f, 0, 0),
                    new Vector3(100f, 0, 0),
                    new Vector3(100f, 100f, 100f)
                    );

                var bottomTop = tri.p3 - tri.p1;
                var middleTop = tri.p3 - tri.p2;

                EditorY = Mathf.Clamp(EditorY, tri.p1.y, tri.p3.y);
                bool isResetX = (Mathf.Abs(m_LastEditorY - EditorY) > float.Epsilon) || !m_IsEditorInited;
                m_LastEditorY = EditorY;

                float startX = RenderTarget.GetVector2XFromY(bottomTop, tri.p1, EditorY);
                float endX   = RenderTarget.GetVector2XFromY(middleTop, tri.p2, EditorY);
                if (isResetX)
                {
                    EditorX = startX;
                }
                EditorX          = Mathf.Clamp(EditorX, startX, endX);
                m_IsEditorInited = true;

                Vector3 P = new Vector3(EditorX, EditorY, 0f);
                float   a, b, c;
                SoftMath.GetBarycentricCoordinate(tri, P, out a, out b, out c);
                Vector3 PP = tri.p1 * a + tri.p2 * b + tri.p3 * c;

                Debug.LogErrorFormat("a: {0}, b: {1}, c: {2} || {3}", a.ToString(), b.ToString(), c.ToString(), PP.ToString2());
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        Vector3 A = new Vector3(-1, 0, 0);
        Vector3 B = new Vector3(0, 1, 0);
        Vector3 C = new Vector3(0, 0, 1);
        float   u = Random.Range(0f, 1f);
        float   v = Random.Range(0f, 1f - u);
        float   r = 1f - u - v;
        Vector3 P = u * A + v * B + r * C;

        float u1, v1, r1;

        SoftMath.GetBarycentricCoordinate(A, B, C, P, out u1, out v1, out r1);
        Debug.LogFormat("【origin】u: {0} v: {1} r: {2}【SoftMth】u: {3} v: {4} r: {5}", u, v, r, u1, v1, r1);

        Vector3 AB = B - A;
        Vector3 AC = C - A;
        Vector3 PA = A - P;
        Vector3 v3 = new Vector3(AB.z, AC.z, PA.z);

        Debug.LogFormat("v3: {0}", v3.x * u1, v3.y * v1, v3.z * r1);
    }