internal void GenerateMesh(List <NavMeshRenderTriangle> triangles)
 {
     if (m_Root != null)
     {
         m_Root.GenerateMesh(Vector2.zero, Vector2.right, Vector2.up, vertex0, vertex1, vertex2, uv0, uv1, uv2, triangles);
     }
 }
        internal void GenerateMesh(Vector2 weight0, Vector2 weight1, Vector2 weight2, Vector3 v0, Vector3 v1, Vector3 v2, Vector2 u0, Vector2 u1, Vector2 u2, List <NavMeshRenderTriangle> triangles)
        {
            if (m_PaintedType == PaintedType.Painted)
            {
                //if (isBePainted)
                {
                    Vector3 vertex0 = (1 - weight0.x - weight0.y) * v0 + weight0.x * v1 + weight0.y * v2;
                    Vector3 vertex1 = (1 - weight1.x - weight1.y) * v0 + weight1.x * v1 + weight1.y * v2;
                    Vector3 vertex2 = (1 - weight2.x - weight2.y) * v0 + weight2.x * v1 + weight2.y * v2;

                    Vector2 uv0 = (1 - weight0.x - weight0.y) * u0 + weight0.x * u1 + weight0.y * u2;
                    Vector2 uv1 = (1 - weight1.x - weight1.y) * u0 + weight1.x * u1 + weight1.y * u2;
                    Vector2 uv2 = (1 - weight2.x - weight2.y) * u0 + weight2.x * u1 + weight2.y * u2;

                    NavMeshRenderTriangle triangle = null;
                    if (triangles.Count <= 0)
                    {
                        triangle = new NavMeshRenderTriangle();
                        triangles.Add(triangle);
                    }
                    else
                    {
                        triangle = triangles[triangles.Count - 1];
                    }
                    if (triangle.vertexCount >= 64990)
                    {
                        triangle = new NavMeshRenderTriangle();
                        triangles.Add(triangle);
                    }

                    triangle.AddVertex(vertex0, uv0);
                    triangle.AddVertex(vertex1, uv1);
                    triangle.AddVertex(vertex2, uv2);
                }
            }
            else if (m_PaintedType == PaintedType.Mix)
            {
                Vector2 halfw01 = weight0 + (weight1 - weight0) * 0.5f;
                Vector2 halfw02 = weight0 + (weight2 - weight0) * 0.5f;
                Vector2 halfw12 = weight1 + (weight2 - weight1) * 0.5f;
                if (m_CenterNode != null)
                {
                    m_CenterNode.GenerateMesh(halfw01, halfw12, halfw02, v0, v1, v2, u0, u1, u2, triangles);
                }
                if (m_TopNode != null)
                {
                    m_TopNode.GenerateMesh(halfw01, weight1, halfw12, v0, v1, v2, u0, u1, u2, triangles);
                }
                if (m_LeftNode != null)
                {
                    m_LeftNode.GenerateMesh(weight0, halfw01, halfw02, v0, v1, v2, u0, u1, u2, triangles);
                }
                if (m_RightNode != null)
                {
                    m_RightNode.GenerateMesh(halfw02, halfw12, weight2, v0, v1, v2, u0, u1, u2, triangles);
                }
            }
        }