Example #1
0
        /// <summary>
        /// Updates any mesh vertex data that is marked as dirty
        /// </summary>
        public void RefreshMesh()
        {
            if ((m_DataThatNeedsUpdate & MeshRefreshFlag.Positions) != 0)
            {
                m_Mesh.vertices = m_Verts;
                m_Mesh.SetUVs(1, m_NeighborPoints);
            }
            if ((m_DataThatNeedsUpdate & MeshRefreshFlag.Colors) != 0)
            {
                m_Mesh.colors32 = m_Colors;
            }
            if ((m_DataThatNeedsUpdate & MeshRefreshFlag.Sizes) != 0)
            {
                m_Mesh.SetUVs(0, m_ShapeData);
            }
            m_DataThatNeedsUpdate = MeshRefreshFlag.None;

            m_Mesh.RecalculateBounds();
            if (m_WorldSpaceData == true)
            {
                var newBounds = m_Mesh.bounds;
                newBounds.center = m_OwnerTransform.InverseTransformPoint(newBounds.center);
                m_Mesh.bounds    = newBounds;
            }
        }
Example #2
0
 /// <summary>
 /// Used by external classes to alert the mesh chain that they have modified its data
 /// </summary>
 /// <param name="dataThatNeedsUpdate">Which type of data (position, color, size) has been changed</param>
 public void SetMeshDataDirty(MeshRefreshFlag dataThatNeedsUpdate)
 {
     m_DataThatNeedsUpdate |= dataThatNeedsUpdate;
 }