diff options
Diffstat (limited to 'Assets/ThirdParty/VRM/VRMShaders/UniUnlit')
13 files changed, 0 insertions, 492 deletions
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor.meta deleted file mode 100644 index 6d77c082..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c1ce4da7404d095459d80006a8609a1c -folderAsset: yes -timeCreated: 1535618691 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef deleted file mode 100644 index 564a54cc..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "UniUnlit.Editor", - "references": [ - "UniUnlit" - ], - "optionalUnityReferences": [], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false -}
\ No newline at end of file diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef.meta deleted file mode 100644 index 43cedc39..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 529ce3a240c1a7a4bbbb220bbd59686b -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs deleted file mode 100644 index 326f129a..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs +++ /dev/null @@ -1,159 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEngine; -using UnityEngine.Rendering; - - -namespace UniGLTF.UniUnlit -{ - public class UniUnlitEditor : ShaderGUI - { - private MaterialProperty _mainTex; - private MaterialProperty _color; - private MaterialProperty _cutoff; - private MaterialProperty _blendMode; - private MaterialProperty _cullMode; - private MaterialProperty _vColBlendMode; -// private MaterialProperty _srcBlend; -// private MaterialProperty _dstBlend; -// private MaterialProperty _zWrite; - - public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) - { - _mainTex = FindProperty(Utils.PropNameMainTex, properties); - _color = FindProperty(Utils.PropNameColor, properties); - _cutoff = FindProperty(Utils.PropNameCutoff, properties); - _blendMode = FindProperty(Utils.PropNameBlendMode, properties); - _cullMode = FindProperty(Utils.PropNameCullMode, properties); - _vColBlendMode = FindProperty(Utils.PropNameVColBlendMode, properties); -// _srcBlend = FindProperty(PropNameSrcBlend, properties); -// _dstBlend = FindProperty(PropNameDstBlend, properties); -// _zWrite = FindProperty(PropNameZWrite, properties); - - var materials = materialEditor.targets.Select(x => x as Material).ToArray(); - - EditorGUI.BeginChangeCheck(); - { - DrawRenderingBox(materialEditor, materials); - DrawColorBox(materialEditor, materials); - DrawOptionsBox(materialEditor, materials); - } - EditorGUI.EndChangeCheck(); - } - - public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader) - { - var blendMode = UniUnlitRenderMode.Opaque; - if (material.HasProperty(Utils.PropNameStandardShadersRenderMode)) // from Standard shader - { - blendMode = (UniUnlitRenderMode) Math.Min(2f, material.GetFloat(Utils.PropNameStandardShadersRenderMode)); - } - - // assigns UniUnlit's properties... - base.AssignNewShaderToMaterial(material, oldShader, newShader); - - // take over old value - material.SetFloat(Utils.PropNameBlendMode, (float) blendMode); - - Utils.ValidateProperties(material, isRenderModeChangedByUser: true); - } - - private void DrawRenderingBox(MaterialEditor materialEditor, Material[] materials) - { - EditorGUILayout.LabelField("Rendering", EditorStyles.boldLabel); - EditorGUILayout.BeginVertical(GUI.skin.box); - { - if (PopupEnum<UniUnlitRenderMode>("Rendering Type", _blendMode, materialEditor)) - { - ModeChanged(materials, isRenderModeChangedByUser: true); - } - if (PopupEnum<UniUnlitCullMode>("Cull Mode", _cullMode, materialEditor)) - { - ModeChanged(materials, isRenderModeChangedByUser: true); - } - EditorGUILayout.Space(); - - switch ((UniUnlitRenderMode) _blendMode.floatValue) - { - case UniUnlitRenderMode.Cutout: - materialEditor.ShaderProperty(_cutoff, "Cutoff"); - break; - case UniUnlitRenderMode.Opaque: - case UniUnlitRenderMode.Transparent: - break; - } - } - EditorGUILayout.EndVertical(); - EditorGUILayout.Space(); - } - - private void DrawColorBox(MaterialEditor materialEditor, Material[] materials) - { - EditorGUILayout.LabelField("Color", EditorStyles.boldLabel); - EditorGUILayout.BeginVertical(GUI.skin.box); - { - materialEditor.TexturePropertySingleLine(new GUIContent("Main Tex", "(RGBA)"), _mainTex, _color); - materialEditor.TextureScaleOffsetProperty(_mainTex); - EditorGUILayout.Space(); - - if (PopupEnum<UniUnlitVertexColorBlendOp>("Vertex Color Blend Mode", _vColBlendMode, materialEditor)) - { - ModeChanged(materials, isRenderModeChangedByUser: true); - } - } - EditorGUILayout.EndVertical(); - EditorGUILayout.Space(); - } - - private void DrawOptionsBox(MaterialEditor materialEditor, Material[] materials) - { - EditorGUILayout.LabelField("Options", EditorStyles.boldLabel); - EditorGUILayout.BeginVertical(GUI.skin.box); - { - #if UNITY_5_6_OR_NEWER -// materialEditor.EnableInstancingField(); - materialEditor.DoubleSidedGIField(); - #endif - materialEditor.RenderQueueField(); - } - EditorGUILayout.EndVertical(); - EditorGUILayout.Space(); - } - - private static bool PopupEnum<T>(string name, MaterialProperty property, MaterialEditor editor) where T : struct - { - if (!typeof(T).IsEnum) return false; - - EditorGUI.showMixedValue = property.hasMixedValue; - EditorGUI.BeginChangeCheck(); - var values = (T[]) Enum.GetValues(typeof(T)); - var names = Enum.GetNames(typeof(T)); - - var currInt = (int) property.floatValue; - var currValue = (T) Enum.ToObject(typeof(T), currInt); - var currIndex = Array.IndexOf(values, currValue); - var nextIndex = EditorGUILayout.Popup(name, currIndex, names); - var changed = EditorGUI.EndChangeCheck(); - if (changed) - { - editor.RegisterPropertyChangeUndo("EnumPopUp"); - var nextValue = values[nextIndex]; - var nextInt = (int) (object) nextValue; - property.floatValue = nextInt; - } - EditorGUI.showMixedValue = false; - return changed; - } - - - private static void ModeChanged(Material[] materials, bool isRenderModeChangedByUser = false) - { - foreach (var material in materials) - { - Utils.ValidateProperties(material, isRenderModeChangedByUser); - } - } - } -} diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs.meta deleted file mode 100644 index 7d35d3e6..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4c70714358bb2fb4fa96ef08640763fd -timeCreated: 1514224771 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources.meta deleted file mode 100644 index 61659788..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9e133c6453ae1c54c931227ff64edd52 -folderAsset: yes -timeCreated: 1535618682 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader deleted file mode 100644 index 2e2466a1..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader +++ /dev/null @@ -1,101 +0,0 @@ -Shader "UniGLTF/UniUnlit" -{ - Properties - { - _MainTex ("Texture", 2D) = "white" {} - _Color ("Main Color", COLOR) = (1,1,1,1) - _Cutoff ("Alpha Cutoff", Range(0, 1)) = 0.5 - - [HideInInspector] _BlendMode ("_BlendMode", Float) = 0.0 - [HideInInspector] _CullMode ("_CullMode", Float) = 2.0 - [HideInInspector] _VColBlendMode ("_VColBlendMode", Float) = 0.0 - [HideInInspector] _SrcBlend ("_SrcBlend", Float) = 1.0 - [HideInInspector] _DstBlend ("_DstBlend", Float) = 0.0 - [HideInInspector] _ZWrite ("_ZWrite", Float) = 1.0 - - // VertexColor - } - SubShader - { - Tags { "RenderType"="Opaque" } - LOD 100 - - Pass - { - Cull [_CullMode] - Blend [_SrcBlend] [_DstBlend] - ZWrite [_ZWrite] - ZTest LEqual - BlendOp Add, Max - - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma multi_compile_fog - #pragma multi_compile _ _ALPHATEST_ON _ALPHABLEND_ON - #pragma multi_compile _ _VERTEXCOL_MUL - - #include "UnityCG.cginc" - - struct appdata - { - float4 vertex : POSITION; - float2 uv : TEXCOORD0; - #if defined(_VERTEXCOL_MUL) - fixed4 color : COLOR; - #endif - }; - - struct v2f - { - float4 vertex : SV_POSITION; - float2 uv : TEXCOORD0; - UNITY_FOG_COORDS(1) - #if defined(_VERTEXCOL_MUL) - fixed4 color : COLOR; - #endif - }; - - sampler2D _MainTex; - float4 _MainTex_ST; - half4 _Color; - half _Cutoff; - - v2f vert (appdata v) - { - v2f o; - o.vertex = UnityObjectToClipPos(v.vertex); - o.uv = TRANSFORM_TEX(v.uv, _MainTex); - UNITY_TRANSFER_FOG(o,o.vertex); - - #if defined(_VERTEXCOL_MUL) - o.color = v.color; - #endif - return o; - } - - fixed4 frag (v2f i) : SV_Target - { - fixed4 col = tex2D(_MainTex, i.uv) * _Color; - - #if defined(_VERTEXCOL_MUL) - col *= i.color; - #endif - - #if defined(_ALPHATEST_ON) - clip(col.a - _Cutoff); - #endif - - #if !defined(_ALPHATEST_ON) && !defined(_ALPHABLEND_ON) - col.a = 1.0; - #endif - - UNITY_APPLY_FOG(i.fogCoord, col); - return col; - } - ENDCG - } - } - CustomEditor "UniGLTF.UniUnlit.UniUnlitEditor" - Fallback "Unlit/Texture" -} diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader.meta deleted file mode 100644 index 750c8aba..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8c17b56f4bf084c47872edcb95237e4a -timeCreated: 1535616926 -licenseType: Free -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts.meta deleted file mode 100644 index 183e72bc..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b19f3d26eec098d46a33d8d35ba2eab5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs deleted file mode 100644 index 74c47405..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs +++ /dev/null @@ -1,153 +0,0 @@ -using System; -using UnityEngine; -using UnityEngine.Rendering; - -namespace UniGLTF.UniUnlit -{ - public enum UniUnlitRenderMode - { - Opaque = 0, - Cutout = 1, - 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 ShaderName = "UniGLTF/UniUnlit"; - public const string PropNameMainTex = "_MainTex"; - public const string PropNameColor = "_Color"; - public const string PropNameCutoff = "_Cutoff"; - public const string PropNameBlendMode = "_BlendMode"; - public const string PropNameCullMode = "_CullMode"; - [Obsolete("Use PropNameVColBlendMode")] - public const string PropeNameVColBlendMode = PropNameVColBlendMode; - public const string PropNameVColBlendMode = "_VColBlendMode"; - public const string PropNameSrcBlend = "_SrcBlend"; - public const string PropNameDstBlend = "_DstBlend"; - public const string PropNameZWrite = "_ZWrite"; - - public const string PropNameStandardShadersRenderMode = "_Mode"; - - public const string KeywordAlphaTestOn = "_ALPHATEST_ON"; - public const string KeywordAlphaBlendOn = "_ALPHABLEND_ON"; - public const string KeywordVertexColMul = "_VERTEXCOL_MUL"; - - public const string TagRenderTypeKey = "RenderType"; - public const string TagRenderTypeValueOpaque = "Opaque"; - public const string TagRenderTypeValueTransparentCutout = "TransparentCutout"; - public const string TagRenderTypeValueTransparent = "Transparent"; - - public static void SetRenderMode(Material material, UniUnlitRenderMode mode) - { - material.SetInt(PropNameBlendMode, (int)mode); - } - - public static void SetCullMode(Material material, UniUnlitCullMode mode) - { - material.SetInt(PropNameCullMode, (int)mode); - } - - public static void SetVColBlendMode(Material material, UniUnlitVertexColorBlendOp mode) - { - material.SetInt(PropNameVColBlendMode, (int)mode); - } - - public static UniUnlitRenderMode GetRenderMode(Material material) - { - return (UniUnlitRenderMode)material.GetInt(PropNameBlendMode); - } - - public static UniUnlitCullMode GetCullMode(Material material) - { - return (UniUnlitCullMode)material.GetInt(PropNameCullMode); - } - - public static UniUnlitVertexColorBlendOp GetVColBlendMode(Material material) - { - return (UniUnlitVertexColorBlendOp)material.GetInt(PropNameVColBlendMode); - } - - /// <summary> - /// Validate target material's UniUnlitRenderMode, UniUnlitVertexColorBlendOp. - /// Set appropriate hidden properties & keywords. - /// This will change RenderQueue independent to UniUnlitRenderMode if isRenderModeChangedByUser is true. - /// </summary> - /// <param name="material">Target material</param> - /// <param name="isRenderModeChangedByUser">Is changed by user</param> - public static void ValidateProperties(Material material, bool isRenderModeChangedByUser = false) - { - SetupBlendMode(material, (UniUnlitRenderMode)material.GetFloat(PropNameBlendMode), - isRenderModeChangedByUser); - SetupVertexColorBlendOp(material, (UniUnlitVertexColorBlendOp)material.GetFloat(PropNameVColBlendMode)); - } - - private static void SetupBlendMode(Material material, UniUnlitRenderMode renderMode, - bool isRenderModeChangedByUser = false) - { - switch (renderMode) - { - case UniUnlitRenderMode.Opaque: - material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueOpaque); - material.SetInt(PropNameSrcBlend, (int)BlendMode.One); - material.SetInt(PropNameDstBlend, (int)BlendMode.Zero); - material.SetInt(PropNameZWrite, 1); - SetKeyword(material, KeywordAlphaTestOn, false); - SetKeyword(material, KeywordAlphaBlendOn, false); - if (isRenderModeChangedByUser) material.renderQueue = -1; - break; - case UniUnlitRenderMode.Cutout: - material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueTransparentCutout); - material.SetInt(PropNameSrcBlend, (int)BlendMode.One); - material.SetInt(PropNameDstBlend, (int)BlendMode.Zero); - material.SetInt(PropNameZWrite, 1); - SetKeyword(material, KeywordAlphaTestOn, true); - SetKeyword(material, KeywordAlphaBlendOn, false); - if (isRenderModeChangedByUser) material.renderQueue = (int)RenderQueue.AlphaTest; - break; - case UniUnlitRenderMode.Transparent: - material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueTransparent); - material.SetInt(PropNameSrcBlend, (int)BlendMode.SrcAlpha); - material.SetInt(PropNameDstBlend, (int)BlendMode.OneMinusSrcAlpha); - material.SetInt(PropNameZWrite, 0); - SetKeyword(material, KeywordAlphaTestOn, false); - SetKeyword(material, KeywordAlphaBlendOn, true); - if (isRenderModeChangedByUser) material.renderQueue = (int)RenderQueue.Transparent; - break; - } - } - - private static void SetupVertexColorBlendOp(Material material, UniUnlitVertexColorBlendOp vColBlendOp) - { - switch (vColBlendOp) - { - case UniUnlitVertexColorBlendOp.None: - SetKeyword(material, KeywordVertexColMul, false); - break; - case UniUnlitVertexColorBlendOp.Multiply: - SetKeyword(material, KeywordVertexColMul, true); - break; - } - } - - private static void SetKeyword(Material mat, string keyword, bool required) - { - if (required) - mat.EnableKeyword(keyword); - else - mat.DisableKeyword(keyword); - } - } -}
\ No newline at end of file diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs.meta deleted file mode 100644 index 7824f085..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e96cbbd810384352a6799dd731533178 -timeCreated: 1537534399
\ No newline at end of file diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef deleted file mode 100644 index e58648d5..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "UniUnlit" -} diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef.meta deleted file mode 100644 index 4d059abe..00000000 --- a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 60c8346e00a8ddd4cafc5a02eceeec57 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: |