/// <summary> /// Recalculates mesh attributes: normals, collisions, UVs, tangents, and colors. /// </summary> /// <param name="mask"> /// Optionally pass a mask to define what components are updated (UV and collisions are expensive to rebuild, and can usually be deferred til completion of task). /// </param> public void Refresh(RefreshMask mask = RefreshMask.All) { // Mesh if ((mask & RefreshMask.UV) > 0) { RefreshUV(facesInternal); } if ((mask & RefreshMask.Colors) > 0) { RefreshColors(); } if ((mask & RefreshMask.Normals) > 0) { RefreshNormals(); } if ((mask & RefreshMask.Tangents) > 0) { RefreshTangents(); } if ((mask & RefreshMask.Collisions) > 0) { EnsureMeshColliderIsAssigned(); } if ((mask & RefreshMask.Bounds) > 0 && mesh != null) { mesh.RecalculateBounds(); } IncrementVersionIndex(); }
/// <summary> /// Recalculates mesh attributes: normals, collisions, UVs, tangents, and colors. /// </summary> /// <param name="mask"> /// Optionally pass a mask to define what components are updated (UV and collisions are expensive to rebuild, and can usually be deferred til completion of task). /// </param> public void Refresh(RefreshMask mask = RefreshMask.All) { // Mesh if ((mask & RefreshMask.UV) > 0) { RefreshUV(facesInternal); } if ((mask & RefreshMask.Colors) > 0) { RefreshColors(); } if ((mask & RefreshMask.Normals) > 0) { RefreshNormals(); } if ((mask & RefreshMask.Tangents) > 0) { RefreshTangents(); } if ((mask & RefreshMask.Collisions) > 0) { RefreshCollisions(); } }
/// <summary> /// Call ProBuilderMesh.Refresh(). /// </summary> /// <param name="obj">GameObject with instance of ProBuilderMesh.</param> /// <param name="mask"></param> internal static void Refresh(GameObject obj, RefreshMask mask = RefreshMask.All) { if (ProBuilderMeshRefreshMethodInfo == null) { Debug.LogWarning( "ProBuilderBridge.Refresh() failed to find an appropriate `Refresh` method on `ProBuilderMesh` type"); return; } obj.GetComponent(GetProBuilderMeshType()); object comp = obj.GetComponent(GetProBuilderMeshType()); ProBuilderMeshRefreshMethodInfo.Invoke(comp, new object[] { (int)mask }); }