Пример #1
0
    public void AddMeshAndCachePoints(FaceMeshPool pool, Transform owner)
    {
        if (m_Mesh != null && m_Mesh.NumPoints != m_Points.Count)
        {
            pool.ReturnMesh(m_Mesh);
            m_Mesh = null;
        }

        if (m_Mesh == null)
        {
            m_Mesh = pool.GetMesh(m_Points.Count);
        }

        m_Mesh.transform.SetParent(owner, false);
        m_Mesh.transform.localPosition = Vector3.zero;
        m_Mesh.transform.localRotation = Quaternion.identity;

        m_CachedPoints.Clear();

        for (int i = 0; i < m_Points.Count; i++)
        {
            m_CachedPoints.Add(m_Points[i].Point);
        }

        m_Mesh.SetVerts(m_CachedPoints);
        m_Mesh.SetNormal(m_Normal);
    }
Пример #2
0
    public void AddMesh(FaceMeshPool pool)
    {
        if (m_Mesh != null && m_Mesh.NumPoints != m_NumPoints)
        {
            pool.ReturnMesh(m_Mesh);
            m_Mesh = null;
        }

        if (m_Mesh == null)
        {
            m_Mesh = pool.GetMesh(m_NumPoints);
        }

        m_Mesh.transform.SetParent(m_Owner.transform, false);
        m_Mesh.transform.localPosition = Vector3.zero;
        m_Mesh.transform.localRotation = Quaternion.identity;

        m_Points.Clear();
        m_PointIndicies.Clear();

        m_LoopEnumerator.Init(m_Head);
        for (var e = m_LoopEnumerator.First(); e != null; e = m_LoopEnumerator.Next())
        {
            m_Points.Add(e.End.Point);
            m_PointIndicies.Add(e.End.Index);
        }

        m_Mesh.SetVerts(m_Points);
        m_Mesh.SetNormal(Normal);
    }