Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #49 from Santarh/feature/removeUniUnlitExtensionFe…
Browse files Browse the repository at this point in the history
…atures

Remove some UniUnlit's features.
  • Loading branch information
ousttrue authored Oct 9, 2018
2 parents b302838 + d98fbe7 commit d403722
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Core/Scripts/IO/MaterialExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions Core/Scripts/IO/MaterialImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion UniUnlit/Editor/UniUnlitEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void DrawRenderingBox(MaterialEditor materialEditor, Material[] material
{
ModeChanged(materials, isRenderModeChangedByUser: true);
}
if (PopupEnum<CullMode>("Cull Mode", _cullMode, materialEditor))
if (PopupEnum<UniUnlitCullMode>("Cull Mode", _cullMode, materialEditor))
{
ModeChanged(materials, isRenderModeChangedByUser: true);
}
Expand Down
25 changes: 11 additions & 14 deletions UniUnlit/Scripts/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ public enum UniUnlitRenderMode
Opaque = 0,
Cutout = 1,
Transparent = 2,
TransparentWithZWrite = 3,
}

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";
Expand Down Expand Up @@ -45,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);
}
Expand All @@ -55,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);
}

/// <summary>
Expand Down Expand Up @@ -106,15 +112,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;
}
}

Expand Down

0 comments on commit d403722

Please sign in to comment.