From 03e1c4628624c0af03210d8a87d77dbc8aaf37ad Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Tue, 9 Oct 2018 15:52:43 +0900 Subject: [PATCH 1/2] Remove UniUnlit's TransparentWithZWrite mode. --- UniUnlit/Scripts/Utils.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/UniUnlit/Scripts/Utils.cs b/UniUnlit/Scripts/Utils.cs index 59921f3..7cda21f 100644 --- a/UniUnlit/Scripts/Utils.cs +++ b/UniUnlit/Scripts/Utils.cs @@ -8,7 +8,6 @@ public enum UniUnlitRenderMode Opaque = 0, Cutout = 1, Transparent = 2, - TransparentWithZWrite = 3, } public enum UniUnlitVertexColorBlendOp @@ -106,15 +105,6 @@ private static void SetupBlendMode(Material material, UniUnlitRenderMode renderM SetKeyword(material, KeywordAlphaBlendOn, true); if (isRenderModeChangedByUser) material.renderQueue = (int)RenderQueue.Transparent; break; - case UniUnlitRenderMode.TransparentWithZWrite: - material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueTransparent); - material.SetInt(PropNameSrcBlend, (int)BlendMode.SrcAlpha); - material.SetInt(PropNameDstBlend, (int)BlendMode.OneMinusSrcAlpha); - material.SetInt(PropNameZWrite, 1); - SetKeyword(material, KeywordAlphaTestOn, false); - SetKeyword(material, KeywordAlphaBlendOn, true); - if (isRenderModeChangedByUser) material.renderQueue = (int)RenderQueue.AlphaTest + 150; - break; } } From d98fbe7c64efc0f4154d93a9b5bfc653b5e2524b Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Tue, 9 Oct 2018 15:57:22 +0900 Subject: [PATCH 2/2] Remove UniUnlit's cull front mode. --- Core/Scripts/IO/MaterialExporter.cs | 2 +- Core/Scripts/IO/MaterialImporter.cs | 4 ++-- UniUnlit/Editor/UniUnlitEditor.cs | 2 +- UniUnlit/Scripts/Utils.cs | 15 +++++++++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Core/Scripts/IO/MaterialExporter.cs b/Core/Scripts/IO/MaterialExporter.cs index 1c2314e..9fddd69 100644 --- a/Core/Scripts/IO/MaterialExporter.cs +++ b/Core/Scripts/IO/MaterialExporter.cs @@ -238,7 +238,7 @@ private glTFMaterial Export_UniUnlit(Material m) } var cullMode = UniUnlit.Utils.GetCullMode(m); - if (cullMode == CullMode.Off) + if (cullMode == UniUnlitCullMode.Off) { material.doubleSided = true; } diff --git a/Core/Scripts/IO/MaterialImporter.cs b/Core/Scripts/IO/MaterialImporter.cs index c7c991f..96f061f 100644 --- a/Core/Scripts/IO/MaterialImporter.cs +++ b/Core/Scripts/IO/MaterialImporter.cs @@ -124,11 +124,11 @@ public virtual Material CreateMaterial(int i, glTFMaterial x) // culling if (x.doubleSided) { - UniUnlit.Utils.SetCullMode(material, CullMode.Off); + UniUnlit.Utils.SetCullMode(material, UniUnlit.UniUnlitCullMode.Off); } else { - UniUnlit.Utils.SetCullMode(material, CullMode.Back); + UniUnlit.Utils.SetCullMode(material, UniUnlit.UniUnlitCullMode.Back); } UniUnlit.Utils.ValidateProperties(material, true); diff --git a/UniUnlit/Editor/UniUnlitEditor.cs b/UniUnlit/Editor/UniUnlitEditor.cs index 78ea36f..afd11b7 100644 --- a/UniUnlit/Editor/UniUnlitEditor.cs +++ b/UniUnlit/Editor/UniUnlitEditor.cs @@ -69,7 +69,7 @@ private void DrawRenderingBox(MaterialEditor materialEditor, Material[] material { ModeChanged(materials, isRenderModeChangedByUser: true); } - if (PopupEnum("Cull Mode", _cullMode, materialEditor)) + if (PopupEnum("Cull Mode", _cullMode, materialEditor)) { ModeChanged(materials, isRenderModeChangedByUser: true); } diff --git a/UniUnlit/Scripts/Utils.cs b/UniUnlit/Scripts/Utils.cs index 7cda21f..d32d4f4 100644 --- a/UniUnlit/Scripts/Utils.cs +++ b/UniUnlit/Scripts/Utils.cs @@ -10,12 +10,19 @@ public enum UniUnlitRenderMode Transparent = 2, } + public enum UniUnlitCullMode + { + Off = 0, +// Front = 1, + Back = 2, + } + public enum UniUnlitVertexColorBlendOp { None = 0, Multiply = 1, } - + public static class Utils { public const string PropNameMainTex = "_MainTex"; @@ -44,7 +51,7 @@ public static void SetRenderMode(Material material, UniUnlitRenderMode mode) material.SetInt(PropNameBlendMode, (int)mode); } - public static void SetCullMode(Material material, CullMode mode) + public static void SetCullMode(Material material, UniUnlitCullMode mode) { material.SetInt(PropNameCullMode, (int) mode); } @@ -54,9 +61,9 @@ public static UniUnlitRenderMode GetRenderMode(Material material) return (UniUnlitRenderMode)material.GetInt(PropNameBlendMode); } - public static CullMode GetCullMode(Material material) + public static UniUnlitCullMode GetCullMode(Material material) { - return (CullMode)material.GetInt(PropNameCullMode); + return (UniUnlitCullMode)material.GetInt(PropNameCullMode); } ///