From c8b31cc302972f074ba7255904560b5b366b6ac4 Mon Sep 17 00:00:00 2001 From: Will Date: Sun, 23 Sep 2018 22:43:20 -0600 Subject: [PATCH 1/2] Vertex: Bump OLDUNITY version threshold to pre-5.6.0. --- LibBSP/Source/Extensions/VertexExtensions.cs | 2 +- LibBSP/Source/Structs/BSP/BSP.cs | 2 +- LibBSP/Source/Structs/Common/Vertex.cs | 7 ++++--- LibBSP/Source/Structs/MAP/MAPPatch.cs | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/LibBSP/Source/Extensions/VertexExtensions.cs b/LibBSP/Source/Extensions/VertexExtensions.cs index c0cdbd1..30e916e 100644 --- a/LibBSP/Source/Extensions/VertexExtensions.cs +++ b/LibBSP/Source/Extensions/VertexExtensions.cs @@ -1,6 +1,6 @@ #if UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER #define UNITY -#if !(UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER) +#if !UNITY_5_6_OR_NEWER #define OLDUNITY #endif #endif diff --git a/LibBSP/Source/Structs/BSP/BSP.cs b/LibBSP/Source/Structs/BSP/BSP.cs index 6181198..b6eba8c 100644 --- a/LibBSP/Source/Structs/BSP/BSP.cs +++ b/LibBSP/Source/Structs/BSP/BSP.cs @@ -1,6 +1,6 @@ #if UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER #define UNITY -#if !(UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER) +#if !UNITY_5_6_OR_NEWER #define OLDUNITY #endif #endif diff --git a/LibBSP/Source/Structs/Common/Vertex.cs b/LibBSP/Source/Structs/Common/Vertex.cs index e215c49..73da9e2 100644 --- a/LibBSP/Source/Structs/Common/Vertex.cs +++ b/LibBSP/Source/Structs/Common/Vertex.cs @@ -1,7 +1,8 @@ #if UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER #define UNITY -#if !(UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER) -// Unity 4.5 had UIVertex but the implementation was incomplete. +#if !UNITY_5_6_OR_NEWER +// UIVertex was introduced in Unity 4.5 but it only had color, position and one UV. +// From 4.6.0 until 5.5.6 it was missing two sets of UVs. #define OLDUNITY #endif #endif @@ -34,7 +35,7 @@ namespace LibBSP { public Vector2d uv3; /// - /// Simple UIVertex with sensible settings. + /// Simple Vertex with sensible settings. /// public static Vertex simpleVert { get { diff --git a/LibBSP/Source/Structs/MAP/MAPPatch.cs b/LibBSP/Source/Structs/MAP/MAPPatch.cs index 4b46234..a57e61e 100644 --- a/LibBSP/Source/Structs/MAP/MAPPatch.cs +++ b/LibBSP/Source/Structs/MAP/MAPPatch.cs @@ -1,6 +1,6 @@ #if UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER #define UNITY -#if !(UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER) +#if !UNITY_5_6_OR_NEWER #define OLDUNITY #endif #endif From 1617ffe6f0ef5121751043ec4d5d87d96eb337de Mon Sep 17 00:00:00 2001 From: Will Date: Sun, 23 Sep 2018 23:08:52 -0600 Subject: [PATCH 2/2] Vertex: Use Color32 instead of Color. --- LibBSP/Source/Structs/Common/Vertex.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LibBSP/Source/Structs/Common/Vertex.cs b/LibBSP/Source/Structs/Common/Vertex.cs index 73da9e2..1a608bf 100644 --- a/LibBSP/Source/Structs/Common/Vertex.cs +++ b/LibBSP/Source/Structs/Common/Vertex.cs @@ -13,7 +13,7 @@ using System; namespace LibBSP { #if UNITY - using Color = UnityEngine.Color; + using Color = UnityEngine.Color32; using Vector2d = UnityEngine.Vector2; using Vector3d = UnityEngine.Vector3; using Vector4d = UnityEngine.Vector4; @@ -25,14 +25,14 @@ namespace LibBSP { /// Vertex struct, including fields for normal, tangent and four sets of UVs. /// [Serializable] public struct Vertex { - public Color color; - public Vector3d normal; public Vector3d position; - public Vector4d tangent; + public Vector3d normal; + public Color color; public Vector2d uv0; public Vector2d uv1; public Vector2d uv2; public Vector2d uv3; + public Vector4d tangent; /// /// Simple Vertex with sensible settings.