@@ -24,21 +24,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2424*/
2525#endregion
2626
27- #if UNITY_2018_2 || UNITY_2018_3 || UNITY_2018_4 || UNITY_2019 || UNITY_2020
27+ #if UNITY_2018_2_OR_NEWER
2828#define UNITY_8UV_SUPPORT
2929#endif
3030
31- #if UNITY_2017_3 || UNITY_2017_4 || UNITY_2018 || UNITY_2019 || UNITY_2020
32- #define UNITY_MESH_INDEXFORMAT_SUPPORT
33- #endif
34-
3531using System ;
3632using System . Collections . Generic ;
3733using UnityEngine ;
38-
39- #if UNITY_MESH_INDEXFORMAT_SUPPORT
4034using UnityEngine . Rendering ;
41- #endif
4235
4336namespace UnityMeshSimplifier
4437{
@@ -117,11 +110,9 @@ public static Mesh CreateMesh(Vector3[] vertices, int[][] indices, Vector3[] nor
117110 var newMesh = new Mesh ( ) ;
118111 int subMeshCount = indices . Length ;
119112
120- #if UNITY_MESH_INDEXFORMAT_SUPPORT
121113 IndexFormat indexFormat ;
122114 var indexMinMax = MeshUtils . GetSubMeshIndexMinMax ( indices , out indexFormat ) ;
123115 newMesh . indexFormat = indexFormat ;
124- #endif
125116
126117 if ( bindposes != null && bindposes . Length > 0 )
127118 {
@@ -188,9 +179,8 @@ public static Mesh CreateMesh(Vector3[] vertices, int[][] indices, Vector3[] nor
188179 for ( int subMeshIndex = 0 ; subMeshIndex < subMeshCount ; subMeshIndex ++ )
189180 {
190181 var subMeshTriangles = indices [ subMeshIndex ] ;
191- #if UNITY_MESH_INDEXFORMAT_SUPPORT
192182 var minMax = indexMinMax [ subMeshIndex ] ;
193- if ( indexFormat == UnityEngine . Rendering . IndexFormat . UInt16 && minMax . y > ushort . MaxValue )
183+ if ( indexFormat == IndexFormat . UInt16 && minMax . y > ushort . MaxValue )
194184 {
195185 int baseVertex = minMax . x ;
196186 for ( int index = 0 ; index < subMeshTriangles . Length ; index ++ )
@@ -203,9 +193,6 @@ public static Mesh CreateMesh(Vector3[] vertices, int[][] indices, Vector3[] nor
203193 {
204194 newMesh . SetTriangles ( subMeshTriangles , subMeshIndex , false , 0 ) ;
205195 }
206- #else
207- newMesh . SetTriangles ( subMeshTriangles , subMeshIndex , false ) ;
208- #endif
209196 }
210197
211198 newMesh . RecalculateBounds ( ) ;
@@ -427,7 +414,6 @@ public static Vector3[] ConvertUVsTo3D(IList<Vector4> uvs)
427414 return uv3D ;
428415 }
429416
430- #if UNITY_MESH_INDEXFORMAT_SUPPORT
431417 /// <summary>
432418 /// Returns the minimum and maximum indices for each submesh along with the needed index format.
433419 /// </summary>
@@ -455,7 +441,6 @@ public static Vector2Int[] GetSubMeshIndexMinMax(int[][] indices, out IndexForma
455441 }
456442 return result ;
457443 }
458- #endif
459444 #endregion
460445
461446 #region Private Methods
0 commit comments