Lasse Jon Fuglsang Pedersen
5 年前
当前提交
a6e80096
共有 4 个文件被更改,包括 73 次插入 和 20 次删除
-
65Runtime/MeshTools/MeshEx.cs
-
12Runtime/SkinAttachment.cs
-
6Runtime/SkinAttachmentTarget.cs
-
10Runtime/SkinDeformationRenderer.cs
|
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
public static class MeshEx |
|||
public static class MeshEx |
|||
#if UNITY_2020_1_OR_NEWER
|
|||
const MeshUpdateFlags UPDATE_FLAGS_SILENT = |
|||
MeshUpdateFlags.DontNotifyMeshUsers | |
|||
MeshUpdateFlags.DontRecalculateBounds | |
|||
MeshUpdateFlags.DontResetBoneBounds; |
|||
#endif
|
|||
|
|||
#endif
|
|||
} |
|||
|
|||
public static void SilentlySetVertices(this Mesh mesh, Vector3[] positions) |
|||
{ |
|||
#if UNITY_2020_1_OR_NEWER
|
|||
mesh.SetVertices(positions, 0, positions.Length, UPDATE_FLAGS_SILENT); |
|||
#else
|
|||
mesh.EnableSilentWrites(true); |
|||
mesh.SetVertices(positions, 0, positions.Length); |
|||
mesh.EnableSilentWrites(false); |
|||
#endif
|
|||
} |
|||
|
|||
public static void SilentlySetNormals(this Mesh mesh, Vector3[] normals) |
|||
{ |
|||
#if UNITY_2020_1_OR_NEWER
|
|||
mesh.SetNormals(normals, 0, normals.Length, UPDATE_FLAGS_SILENT); |
|||
#else
|
|||
mesh.EnableSilentWrites(true); |
|||
mesh.SetNormals(normals, 0, normals.Length); |
|||
mesh.EnableSilentWrites(false); |
|||
#endif
|
|||
} |
|||
|
|||
public static void SilentlyRecalculateTangents(this Mesh mesh) |
|||
{ |
|||
#if UNITY_2020_1_OR_NEWER
|
|||
mesh.RecalculateTangents(UPDATE_FLAGS_SILENT); |
|||
#else
|
|||
mesh.EnableSilentWrites(true); |
|||
mesh.RecalculateTangents(); |
|||
mesh.EnableSilentWrites(false); |
|||
#endif
|
|||
} |
|||
|
|||
public static void SilentlyRecalculateNormals(this Mesh mesh) |
|||
{ |
|||
#if UNITY_2020_1_OR_NEWER
|
|||
mesh.RecalculateNormals(UPDATE_FLAGS_SILENT); |
|||
#else
|
|||
mesh.EnableSilentWrites(true); |
|||
mesh.RecalculateNormals(); |
|||
mesh.EnableSilentWrites(false); |
|||
#endif
|
|||
} |
|||
|
|||
public static void SilentlyRecalculateBounds(this Mesh mesh) |
|||
{ |
|||
#if UNITY_2020_1_OR_NEWER
|
|||
mesh.RecalculateBounds(UPDATE_FLAGS_SILENT); |
|||
#else
|
|||
mesh.EnableSilentWrites(true); |
|||
mesh.RecalculateBounds(); |
|||
mesh.EnableSilentWrites(false); |
|||
#endif
|
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue