diff --git a/Assembly-CSharp-vs.csproj b/Assembly-CSharp-vs.csproj index d317fded6..77670f57d 100644 --- a/Assembly-CSharp-vs.csproj +++ b/Assembly-CSharp-vs.csproj @@ -19,7 +19,7 @@ full false Temp\bin\Debug\ - DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_GENERICS;ENABLE_SUBSTANCE;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;UNITY_4_3_1;UNITY_4_3;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE + DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_GENERICS;ENABLE_SUBSTANCE;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;UNITY_4_3_1;UNITY_4_3;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE prompt 4 0169 @@ -440,19 +440,37 @@ + + + + + + + + + + + + + + + + + + diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index d317fded6..77670f57d 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -19,7 +19,7 @@ full false Temp\bin\Debug\ - DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_GENERICS;ENABLE_SUBSTANCE;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;UNITY_4_3_1;UNITY_4_3;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE + DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_GENERICS;ENABLE_SUBSTANCE;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;UNITY_4_3_1;UNITY_4_3;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE prompt 4 0169 @@ -440,19 +440,37 @@ + + + + + + + + + + + + + + + + + + diff --git a/Assets/Scene/Scenes/Init.unity b/Assets/Scene/Scenes/Init.unity index 6ef5c3a05..865d4b6f8 100644 Binary files a/Assets/Scene/Scenes/Init.unity and b/Assets/Scene/Scenes/Init.unity differ diff --git a/Assets/Scene/ShaderTestingGrounds.unity b/Assets/Scene/ShaderTestingGrounds.unity new file mode 100644 index 000000000..f7f687eac Binary files /dev/null and b/Assets/Scene/ShaderTestingGrounds.unity differ diff --git a/Assets/Scripts/Assembly-CSharp/BaseWindow.cs b/Assets/Scripts/Assembly-CSharp/BaseWindow.cs index 3c79fb715..127f8af12 100644 --- a/Assets/Scripts/Assembly-CSharp/BaseWindow.cs +++ b/Assets/Scripts/Assembly-CSharp/BaseWindow.cs @@ -92,7 +92,8 @@ public abstract class BaseWindow : MonoBehaviourWrap public sealed override void Start() { //base.transform.parent.localPosition = new Vector3(2000f, 0f, 0f); - base.transform.gameObject.transform.position = new Vector3(2000f, 0f, 0f); + //base.transform.gameObject.transform.position = new Vector3(2000f, 0f, 0f); + base.transform.gameObject.transform.position = new Vector3(0f, 0f, 0f); this.BeforeInit(); foreach (BaseWindow.UIComponent uicomponent in this.newComponentArray()) { diff --git a/Assets/Scripts/Assembly-CSharp/CreateSprite.cs b/Assets/Scripts/Assembly-CSharp/CreateSprite.cs index fb7d9f00c..7bc4fbefa 100644 --- a/Assets/Scripts/Assembly-CSharp/CreateSprite.cs +++ b/Assets/Scripts/Assembly-CSharp/CreateSprite.cs @@ -32,9 +32,7 @@ public class CreateSprite : MonoBehaviour { UnityEngine.Object.Destroy(meshRenderer.material); } - // TODO Font - //meshRenderer.material = new Material(Resources.Load("Shader/Sprite/TextSprite") as Shader); - meshRenderer.material = new Material(Shader.Find("Unlit/Transparent") as Shader); + meshRenderer.material = new Material(Resources.Load("Shader/Sprite/TextSprite") as Shader); meshRenderer.castShadows = false; meshRenderer.receiveShadows = false; diff --git a/Assets/Scripts/Assembly-CSharp/GalleryMovieWindow.cs b/Assets/Scripts/Assembly-CSharp/GalleryMovieWindow.cs index efcb54234..ff3e4ab73 100644 --- a/Assets/Scripts/Assembly-CSharp/GalleryMovieWindow.cs +++ b/Assets/Scripts/Assembly-CSharp/GalleryMovieWindow.cs @@ -38,7 +38,8 @@ public class GalleryMovieWindow : BaseWindow // Token: 0x06000723 RID: 1827 RVA: 0x0001E854 File Offset: 0x0001CA54 private IEnumerator PlayMovie() { - yield return base.StartCoroutine(MovieManager.PlayMovie("mp4/high/op_movie.mp4", FullScreenMovieControlMode.CancelOnInput)); + //TODO fix movie playing. either make platform specific versions OR make platform agnostic + //yield return base.StartCoroutine(MovieManager.PlayMovie("mp4/high/op_movie.mp4", FullScreenMovieControlMode.CancelOnInput)); this.state = GalleryMovieWindow.STATE.END; yield break; } diff --git a/Assets/Scripts/Assembly-CSharp/LogoMovieWindow.cs b/Assets/Scripts/Assembly-CSharp/LogoMovieWindow.cs index 791bcaa68..15306d71c 100644 --- a/Assets/Scripts/Assembly-CSharp/LogoMovieWindow.cs +++ b/Assets/Scripts/Assembly-CSharp/LogoMovieWindow.cs @@ -32,7 +32,8 @@ public class LogoMovieWindow : BaseWindow // Token: 0x06000781 RID: 1921 RVA: 0x0002049C File Offset: 0x0001E69C private IEnumerator PlayMovie() { - yield return base.StartCoroutine(MovieManager.PlayMovie("mp4/normal/quinrose_logo_8.mp4", FullScreenMovieControlMode.CancelOnInput)); + //TODO fix movie playing. either make platform specific versions OR make platform agnostic + //yield return base.StartCoroutine(MovieManager.PlayMovie("mp4/normal/quinrose_logo_8.mp4", FullScreenMovieControlMode.CancelOnInput)); this.state = LogoMovieWindow.STATE.END; yield break; } diff --git a/Assets/Scripts/Assembly-CSharp/Man2D.cs b/Assets/Scripts/Assembly-CSharp/Man2D.cs index 5e364d9a1..ee358ef92 100644 --- a/Assets/Scripts/Assembly-CSharp/Man2D.cs +++ b/Assets/Scripts/Assembly-CSharp/Man2D.cs @@ -51,7 +51,9 @@ public class Man2D : Singleton private void OnEnable() { this.m_Sprite.Enable(); - base.camera.enabled = true; + //TODO determine why camera breaks + //base.camera.enabled = true; + base.camera.enabled = false; } // Token: 0x06000978 RID: 2424 RVA: 0x00029EF4 File Offset: 0x000280F4 @@ -303,12 +305,12 @@ public class Man2D : Singleton Qoo.Debug.Print("Create Frame Buffer"); int w = 960; int h = 544; - if (iPhone.generation == iPhoneGeneration.iPhone4) + /*if (iPhone.generation == iPhoneGeneration.iPhone4) { w = 512; h = 512; - } - Qoo.Debug.Print("Info:iPhone.generation:" + iPhone.generation); + }*/ + //Qoo.Debug.Print("Info:iPhone.generation:" + iPhone.generation); for (int i = 0; i < this.m_FrameBufferAr.Length; i++) { this.m_FrameBufferAr[i] = new FrameBuffer(w, h, "2D Sprite FrameBuffer" + i); diff --git a/Assets/Scripts/Assembly-CSharp/MovieManager.cs b/Assets/Scripts/Assembly-CSharp/MovieManager.cs index 9327654d2..f599352a7 100644 --- a/Assets/Scripts/Assembly-CSharp/MovieManager.cs +++ b/Assets/Scripts/Assembly-CSharp/MovieManager.cs @@ -5,6 +5,8 @@ using UnityEngine; // Token: 0x0200017E RID: 382 public class MovieManager { + //TODO fix movie playing. either make platform specific versions OR make platform agnostic + /* // Token: 0x06000ACD RID: 2765 RVA: 0x0002F630 File Offset: 0x0002D830 public static IEnumerator PlayMovie(string path, FullScreenMovieControlMode mode) { @@ -12,4 +14,5 @@ public class MovieManager yield return 0; yield break; } + */ } diff --git a/Assets/Scripts/Assembly-CSharp/Qoo/Graphics/Movie.cs b/Assets/Scripts/Assembly-CSharp/Qoo/Graphics/Movie.cs index 37ab68df8..b7d4583bd 100644 --- a/Assets/Scripts/Assembly-CSharp/Qoo/Graphics/Movie.cs +++ b/Assets/Scripts/Assembly-CSharp/Qoo/Graphics/Movie.cs @@ -15,7 +15,8 @@ namespace Qoo.Graphics NMB_FILEINFO fileInfo = Nmb.GetFileInfo(fileId.Name); string text = fileInfo.DirName + fileInfo.FileName; Debug.Print(string.Format("INFO:Start Movie({0} Skip={1})", text, IsSkip.ToString())); - UnityTask.SetSubTask(MovieManager.PlayMovie(text, FullScreenMovieControlMode.CancelOnInput)); + //TODO fix movie playing. either make platform specific versions OR make platform agnostic + //UnityTask.SetSubTask(MovieManager.PlayMovie(text, FullScreenMovieControlMode.CancelOnInput)); } } } diff --git a/Assets/Scripts/Assembly-CSharp/Qoo/Ks/KsScene.cs b/Assets/Scripts/Assembly-CSharp/Qoo/Ks/KsScene.cs index b08f23526..057a53b25 100644 --- a/Assets/Scripts/Assembly-CSharp/Qoo/Ks/KsScene.cs +++ b/Assets/Scripts/Assembly-CSharp/Qoo/Ks/KsScene.cs @@ -490,6 +490,7 @@ namespace Qoo.Ks } // Token: 0x06000384 RID: 900 RVA: 0x0000BECC File Offset: 0x0000A0CC + // TODO investigate for message printing private EVENTSCENE SceneApplySub(EVENTSCENE Scene, bool bMsg, bool IsVoice = true) { if (Scene.Message.Sw == SWITCH.ON && Scene.Message.Tag != null) diff --git a/Assets/Scripts/Assembly-CSharp/ScreenEffect.cs b/Assets/Scripts/Assembly-CSharp/ScreenEffect.cs index d92d8750c..8bc6253e1 100644 --- a/Assets/Scripts/Assembly-CSharp/ScreenEffect.cs +++ b/Assets/Scripts/Assembly-CSharp/ScreenEffect.cs @@ -68,7 +68,8 @@ public class ScreenEffect } else { - ScreenEffect.goScreenEffect.transform.localPosition = new Vector3(2000f, 0f, (float)(-(float)z)); + //ScreenEffect.goScreenEffect.transform.localPosition = new Vector3(2000f, 0f, (float)(-(float)z)); + ScreenEffect.goScreenEffect.transform.localPosition = new Vector3(0f, 0f, (float)(-(float)z)); } ScreenEffect.goScreenEffect.renderer.material.SetColor("_Color", color); } diff --git a/Assets/Scripts/Assembly-CSharp/ScreenKeyboardManager.cs b/Assets/Scripts/Assembly-CSharp/ScreenKeyboardManager.cs index 8811994b9..e514c0e66 100644 --- a/Assets/Scripts/Assembly-CSharp/ScreenKeyboardManager.cs +++ b/Assets/Scripts/Assembly-CSharp/ScreenKeyboardManager.cs @@ -51,14 +51,16 @@ public class ScreenKeyboardManager : MonoBehaviour { get { - return ScreenKeyboardManager.Instance.m_keyboard.wasCanceled; + return false; + //return ScreenKeyboardManager.Instance.m_keyboard.wasCanceled; } } // Token: 0x06000A97 RID: 2711 RVA: 0x0002EAC8 File Offset: 0x0002CCC8 public static IEnumerator Open(string defaultString = "") { - ScreenKeyboardManager.Instance.m_inputText = defaultString; + //TODO fix TouchScreenKeyboard issue + /*ScreenKeyboardManager.Instance.m_inputText = defaultString; ScreenKeyboardManager.Instance.m_keyboard = TouchScreenKeyboard.Open(defaultString, TouchScreenKeyboardType.NamePhonePad); while (!ScreenKeyboardManager.Instance.m_keyboard.active) { @@ -71,7 +73,7 @@ public class ScreenKeyboardManager : MonoBehaviour if (ScreenKeyboardManager.Instance.m_keyboard.done) { ScreenKeyboardManager.Instance.m_inputText = ScreenKeyboardManager.Instance.m_keyboard.text; - } + }*/ yield break; } @@ -89,7 +91,7 @@ public class ScreenKeyboardManager : MonoBehaviour private static ScreenKeyboardManager m_instance; // Token: 0x04000886 RID: 2182 - private TouchScreenKeyboard m_keyboard; + //private TouchScreenKeyboard m_keyboard; // Token: 0x04000887 RID: 2183 private string m_inputText; diff --git a/Assets/Scripts/Assembly-CSharp/ScreenMovieSample.cs b/Assets/Scripts/Assembly-CSharp/ScreenMovieSample.cs index e216db700..8f2286c0f 100644 --- a/Assets/Scripts/Assembly-CSharp/ScreenMovieSample.cs +++ b/Assets/Scripts/Assembly-CSharp/ScreenMovieSample.cs @@ -8,7 +8,8 @@ public class ScreenMovieSample : MonoBehaviour // Token: 0x06000011 RID: 17 RVA: 0x00002238 File Offset: 0x00000438 private IEnumerator Start() { - yield return base.StartCoroutine(MovieManager.PlayMovie("mp4/high/op_movie.mp4", FullScreenMovieControlMode.CancelOnInput)); + //TODO fix movie playing. either make platform specific versions OR make platform agnostic + //yield return base.StartCoroutine(MovieManager.PlayMovie("mp4/high/op_movie.mp4", FullScreenMovieControlMode.CancelOnInput)); Debug.Log(" #DEBUGLOG::MOVIE OWATA "); yield break; } diff --git a/Assets/Scripts/Assembly-CSharp/SubPartCamera.cs b/Assets/Scripts/Assembly-CSharp/SubPartCamera.cs index 0e86df53b..fe661f553 100644 --- a/Assets/Scripts/Assembly-CSharp/SubPartCamera.cs +++ b/Assets/Scripts/Assembly-CSharp/SubPartCamera.cs @@ -38,7 +38,9 @@ public class SubPartCamera : MonoBehaviour SubPartCamera.Instance.m_Camera.nearClipPlane = 0.3f; SubPartCamera.Instance.m_Camera.rect = SubPartCamera.Instance.calcAspect(SubPartCamera.Instance.m_AspectWidth, SubPartCamera.Instance.m_AspectHeight); SubPartCamera.Instance.m_Camera.enabled = true; - SubPartCamera.Instance.gameObject.transform.localPosition = new Vector3(2000f, 0f, -1000f); + //TODO Camera change + //SubPartCamera.Instance.gameObject.transform.localPosition = new Vector3(2000f, 0f, -1000f); + SubPartCamera.Instance.gameObject.transform.localPosition = new Vector3(0f, 0f, -1000f); } // Token: 0x0600063A RID: 1594 RVA: 0x00019EE8 File Offset: 0x000180E8 diff --git a/Assets/Scripts/Assembly-CSharp/UnityFile.cs b/Assets/Scripts/Assembly-CSharp/UnityFile.cs index 4ccb81346..4b535d9d8 100644 --- a/Assets/Scripts/Assembly-CSharp/UnityFile.cs +++ b/Assets/Scripts/Assembly-CSharp/UnityFile.cs @@ -83,6 +83,7 @@ public class UnityFile this.m_szPath = path; this.m_IsAssetBandle = IsAssetBandle; UnityTask.SetReadTask(this.LoadWait()); + return true; } @@ -185,11 +186,23 @@ public class UnityFile } else if (this.m_IsAssetBandle) { + + //TODO fix issue with resources ang streaming assets folders and the build + //New code start. This loads PNGs directly rather than from assetbundles + UnityEngine.Debug.Log (Application.dataPath + "/Resources" + m_szPath + m_szName + ".png"); + byte[] data = System.IO.File.ReadAllBytes(Application.dataPath + "/Resources" + m_szPath + m_szName + ".png"); + this.m_ReadData = data; + //New code end + + //Old code for asset bundles + /* AssetBundle ab = loader.assetBundle; TextAsset ta = ab.mainAsset as TextAsset; + this.m_ReadData = data; this.m_ReadData = ta.bytes; Resources.UnloadAsset(ta); ab.Unload(false); + */ } else { diff --git a/Assets/Scripts/Assembly-CSharp/UnityGraph.cs b/Assets/Scripts/Assembly-CSharp/UnityGraph.cs index a52b2fa24..3a30b86dd 100644 --- a/Assets/Scripts/Assembly-CSharp/UnityGraph.cs +++ b/Assets/Scripts/Assembly-CSharp/UnityGraph.cs @@ -82,7 +82,9 @@ public class UnityGraph : Singleton this.m_ManSprite.enabled = true; CreateSprite.CreateSpriteCamera(base.gameObject, Screen.height, false); base.gameObject.camera.aspect = (float)Screen.width / (float)Screen.height; - base.gameObject.camera.enabled = true; + //TODO fix camera issues, find out why this is needed + //base.gameObject.camera.enabled = true; + base.gameObject.camera.enabled = false; this.m_FrameBg.obj.SetActive(true); if (this.m_FrameBg.tex == null) { @@ -275,6 +277,8 @@ public class UnityGraph : Singleton // Token: 0x060009BF RID: 2495 RVA: 0x0002B3BC File Offset: 0x000295BC public IEnumerator Effect(string name, float time = 1f) { + //TODO effect movies crash game and standard effects need shaders. Fix and re-add them + /* string text = name; switch (text) { @@ -311,11 +315,14 @@ public class UnityGraph : Singleton name = fileInfo.DirName + fileInfo.FileName; } return this.EffectMovie(name); + */ + yield break; } // Token: 0x060009C0 RID: 2496 RVA: 0x0002B524 File Offset: 0x00029724 private IEnumerator EffectMain(string name, float time) { + yield return 0; yield return 0; this.m_ManSprite.UpdateFrameBuffer(); diff --git a/Assets/Scripts/Assembly-CSharp/UnitySprite.cs b/Assets/Scripts/Assembly-CSharp/UnitySprite.cs index 11b85ed81..92fe41c4c 100644 --- a/Assets/Scripts/Assembly-CSharp/UnitySprite.cs +++ b/Assets/Scripts/Assembly-CSharp/UnitySprite.cs @@ -223,7 +223,14 @@ public class UnitySprite public void SetMaterial(string shader_name) { this.DeleteMaterial(); - this.obj.renderer.material = new Material(Resources.Load(shader_name) as Shader); + //TODO get all shaders working or implement workarounds + //added workaround + if (shader_name == "Shader/Sprite/Sprite") { + this.obj.renderer.material = new Material (Shader.Find ("Unlit/Transparent") as Shader); + } else { + this.obj.renderer.material = new Material(Resources.Load(shader_name) as Shader); + } + //this.obj.renderer.material = new Material(Resources.Load(shader_name) as Shader); } // Token: 0x060009DE RID: 2526 RVA: 0x0002B940 File Offset: 0x00029B40 diff --git a/Assets/TestShaders/GUI - Text Shader (AlphaClip).shader b/Assets/TestShaders/GUI - Text Shader (AlphaClip).shader new file mode 100644 index 000000000..c46d222b3 --- /dev/null +++ b/Assets/TestShaders/GUI - Text Shader (AlphaClip).shader @@ -0,0 +1,111 @@ +Shader "GUI/Text Shader (AlphaClip)" +{ + Properties + { + _MainTex ("Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Offset -1, -1 + Fog { Mode Off } + //ColorMask RGB + Blend SrcAlpha OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + float2 worldPos : TEXCOORD1; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex); + return o; + } + + half4 frag (v2f IN) : COLOR + { + // Sample the texture + half4 col = IN.color; + col.a *= tex2D(_MainTex, IN.texcoord).a; + + float2 factor = abs(IN.worldPos); + float val = 1.0 - max(factor.x, factor.y); + + // Option 1: 'if' statement + if (val < 0.0) col.a = 0.0; + + // Option 2: no 'if' statement -- may be faster on some devices + //col.a *= ceil(clamp(val, 0.0, 1.0)); + + return col; + } + ENDCG + } + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + ColorMask RGB + AlphaTest Greater .01 + Blend SrcAlpha OneMinusSrcAlpha + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} diff --git a/Assets/TestShaders/GUI - Text Shader (SoftClip).shader b/Assets/TestShaders/GUI - Text Shader (SoftClip).shader new file mode 100644 index 000000000..51e2932a4 --- /dev/null +++ b/Assets/TestShaders/GUI - Text Shader (SoftClip).shader @@ -0,0 +1,109 @@ +Shader "GUI/Text Shader (SoftClip)" +{ + Properties + { + _MainTex ("Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Offset -1, -1 + Fog { Mode Off } + //ColorMask RGB + AlphaTest Greater .01 + Blend SrcAlpha OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + float2 _ClipSharpness = float2(20.0, 20.0); + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + float2 worldPos : TEXCOORD1; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex); + return o; + } + + half4 frag (v2f IN) : COLOR + { + // Softness factor + float2 factor = (float2(1.0, 1.0) - abs(IN.worldPos)) * _ClipSharpness; + + // Sample the texture + half4 col = IN.color; + col.a *= tex2D(_MainTex, IN.texcoord).a; + col.a *= clamp( min(factor.x, factor.y), 0.0, 1.0); + + return col; + } + ENDCG + } + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + ColorMask RGB + AlphaTest Greater .01 + Blend SrcAlpha OneMinusSrcAlpha + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} diff --git a/Assets/TestShaders/Unlit - Additive Colored.shader b/Assets/TestShaders/Unlit - Additive Colored.shader new file mode 100644 index 000000000..ad4223196 --- /dev/null +++ b/Assets/TestShaders/Unlit - Additive Colored.shader @@ -0,0 +1,36 @@ +Shader "Unlit/Additive Colored" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + LOD 100 + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + ColorMask RGB + AlphaTest Greater .01 + Blend One One + + Pass + { + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} \ No newline at end of file diff --git a/Assets/TestShaders/Unlit - Depth Cutout.shader b/Assets/TestShaders/Unlit - Depth Cutout.shader new file mode 100644 index 000000000..fbfbd6992 --- /dev/null +++ b/Assets/TestShaders/Unlit - Depth Cutout.shader @@ -0,0 +1,35 @@ +Shader "Unlit/Depth Cutout" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Background" + "IgnoreProjector" = "True" + } + + Pass + { + Cull Off + Lighting Off + Blend Off + ColorMask 0 + ZWrite On + ZTest Less + AlphaTest Greater .99 + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} \ No newline at end of file diff --git a/Assets/TestShaders/Unlit - Depth.shader b/Assets/TestShaders/Unlit - Depth.shader new file mode 100644 index 000000000..091ee9541 --- /dev/null +++ b/Assets/TestShaders/Unlit - Depth.shader @@ -0,0 +1,20 @@ +Shader "Unlit/Depth" +{ + SubShader + { + Lod 100 + + Tags + { + "Queue" = "Geometry+1" + "RenderType"="Opaque" + } + + Pass + { + ZWrite On + ZTest LEqual + ColorMask 0 + } + } +} \ No newline at end of file diff --git a/Assets/TestShaders/Unlit - Dynamic Font (AlphaClip).shader b/Assets/TestShaders/Unlit - Dynamic Font (AlphaClip).shader new file mode 100644 index 000000000..0fbc7f7ab --- /dev/null +++ b/Assets/TestShaders/Unlit - Dynamic Font (AlphaClip).shader @@ -0,0 +1,112 @@ +Shader "Unlit/Dynamic Font (AlphaClip)" +{ + Properties + { + _MainTex ("Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Offset -1, -1 + Fog { Mode Off } + //ColorMask RGB + Blend SrcAlpha OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + float2 worldPos : TEXCOORD1; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex); + return o; + } + + half4 frag (v2f IN) : COLOR + { + // Sample the texture + //half4 col = tex2D(_MainTex, IN.texcoord) * IN.color; + half4 col = IN.color; + col.a *= tex2D(_MainTex, IN.texcoord).a; + + float2 factor = abs(IN.worldPos); + float val = 1.0 - max(factor.x, factor.y); + + // Option 1: 'if' statement + if (val < 0.0) col.a = 0.0; + + // Option 2: no 'if' statement -- may be faster on some devices + //col.a *= ceil(clamp(val, 0.0, 1.0)); + + return col; + } + ENDCG + } + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + ColorMask RGB + AlphaTest Greater .01 + Blend SrcAlpha OneMinusSrcAlpha + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} diff --git a/Assets/TestShaders/Unlit - Dynamic Font (SoftClip).shader b/Assets/TestShaders/Unlit - Dynamic Font (SoftClip).shader new file mode 100644 index 000000000..f0c2f804d --- /dev/null +++ b/Assets/TestShaders/Unlit - Dynamic Font (SoftClip).shader @@ -0,0 +1,109 @@ +Shader "Unlit/Dynamic Font (SoftClip)" +{ + Properties + { + _MainTex ("Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Offset -1, -1 + Fog { Mode Off } + //ColorMask RGB + AlphaTest Greater .01 + Blend SrcAlpha OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + float2 _ClipSharpness = float2(20.0, 20.0); + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + float2 worldPos : TEXCOORD1; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex); + return o; + } + + half4 frag (v2f IN) : COLOR + { + // Softness factor + float2 factor = (float2(1.0, 1.0) - abs(IN.worldPos)) * _ClipSharpness; + + // Sample the texture + half4 col = IN.color; + col.a *= tex2D(_MainTex, IN.texcoord).a; + col.a *= clamp( min(factor.x, factor.y), 0.0, 1.0); + + return col; + } + ENDCG + } + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + ColorMask RGB + AlphaTest Greater .01 + Blend SrcAlpha OneMinusSrcAlpha + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} diff --git a/Assets/TestShaders/Unlit - Dynamic Font.shader b/Assets/TestShaders/Unlit - Dynamic Font.shader new file mode 100644 index 000000000..20ea42097 --- /dev/null +++ b/Assets/TestShaders/Unlit - Dynamic Font.shader @@ -0,0 +1,99 @@ +Shader "Unlit/Dynamic Font" +{ + Properties + { + _MainTex ("Alpha (A)", 2D) = "white" {} + } + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + Offset -1, -1 + AlphaTest Greater .01 + Blend SrcAlpha OneMinusSrcAlpha + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma fragmentoption ARB_precision_hint_fastest + + #include "UnityCG.cginc" + + struct appdata_t + { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + sampler2D _MainTex; + uniform float4 _MainTex_ST; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex); + return o; + } + + fixed4 frag (v2f i) : COLOR + { + fixed4 col = i.color; + col.a *= tex2D(_MainTex, i.texcoord).a; + return col; + } + ENDCG + } + } + + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + Lighting Off + Cull Off + ZTest Always + ZWrite Off + Fog { Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + + BindChannels + { + Bind "Color", color + Bind "Vertex", vertex + Bind "TexCoord", texcoord + } + + Pass + { + SetTexture [_MainTex] + { + constantColor [_Color] combine constant * primary, constant * texture + } + } + } +} diff --git a/Assets/TestShaders/Unlit - Masked Colored.shader b/Assets/TestShaders/Unlit - Masked Colored.shader new file mode 100644 index 000000000..a8e9ebf53 --- /dev/null +++ b/Assets/TestShaders/Unlit - Masked Colored.shader @@ -0,0 +1,106 @@ +Shader "Unlit/Masked Colored" +{ + Properties + { + _MainTex ("Base (RGB) Mask (A)", 2D) = "white" {} + _Color ("Tint Color", Color) = (1,1,1,1) + } + + SubShader + { + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + LOD 200 + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + ColorMask RGB + Blend Off + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma fragmentoption ARB_precision_hint_fastest + + #include "UnityCG.cginc" + + sampler2D _MainTex; + fixed4 _Color; + + struct appdata_t + { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + float4 _MainTex_ST; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); + return o; + } + + fixed4 frag (v2f i) : COLOR + { + half4 col = tex2D(_MainTex, i.texcoord) * i.color; + return half4( lerp(col.rgb, col.rgb * _Color.rgb, col.a), col.a ); + } + ENDCG + } + } + + SubShader + { + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + LOD 100 + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + ColorMask RGB + AlphaTest Greater .01 + Blend Off + + Pass + { + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + + SetTexture [_MainTex] + { + ConstantColor [_Color] + Combine Previous * Constant + } + } + } +} \ No newline at end of file diff --git a/Assets/TestShaders/Unlit - Premultiplied Colored (AlphaClip).shader b/Assets/TestShaders/Unlit - Premultiplied Colored (AlphaClip).shader new file mode 100644 index 000000000..5958e5998 --- /dev/null +++ b/Assets/TestShaders/Unlit - Premultiplied Colored (AlphaClip).shader @@ -0,0 +1,111 @@ +Shader "Unlit/Premultiplied Colored (AlphaClip)" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + AlphaTest Off + Fog { Mode Off } + Offset -1, -1 + ColorMask RGB + Blend One OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + float2 worldPos : TEXCOORD1; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex); + return o; + } + + half4 frag (v2f IN) : COLOR + { + // Sample the texture + half4 col = tex2D(_MainTex, IN.texcoord) * IN.color; + + float2 factor = abs(IN.worldPos); + float val = 1.0 - max(factor.x, factor.y); + + // Option 1: 'if' statement + if (val < 0.0) col = half4(0.0, 0.0, 0.0, 0.0); + + // Option 2: no 'if' statement -- may be faster on some devices + //col *= ceil(clamp(val, 0.0, 1.0)); + return col; + } + ENDCG + } + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + AlphaTest Off + Fog { Mode Off } + Offset -1, -1 + ColorMask RGB + Blend One OneMinusSrcAlpha + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} diff --git a/Assets/TestShaders/Unlit - Premultiplied Colored (SoftClip).shader b/Assets/TestShaders/Unlit - Premultiplied Colored (SoftClip).shader new file mode 100644 index 000000000..2f5e5fae5 --- /dev/null +++ b/Assets/TestShaders/Unlit - Premultiplied Colored (SoftClip).shader @@ -0,0 +1,109 @@ +Shader "Unlit/Premultiplied Colored (SoftClip)" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + AlphaTest Off + Fog { Mode Off } + Offset -1, -1 + ColorMask RGB + Blend One OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + float2 _ClipSharpness = float2(20.0, 20.0); + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + float2 worldPos : TEXCOORD1; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex); + return o; + } + + half4 frag (v2f IN) : COLOR + { + // Softness factor + float2 factor = (float2(1.0, 1.0) - abs(IN.worldPos)) * _ClipSharpness; + + // Sample the texture + half4 col = tex2D(_MainTex, IN.texcoord) * IN.color; + float fade = clamp( min(factor.x, factor.y), 0.0, 1.0); + col.a *= fade; + col.rgb = lerp(half3(0.0, 0.0, 0.0), col.rgb, fade); + return col; + } + ENDCG + } + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + AlphaTest Off + Fog { Mode Off } + Offset -1, -1 + ColorMask RGB + Blend One OneMinusSrcAlpha + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} diff --git a/Assets/TestShaders/Unlit - Premultiplied Colored.shader b/Assets/TestShaders/Unlit - Premultiplied Colored.shader new file mode 100644 index 000000000..9f5380bcb --- /dev/null +++ b/Assets/TestShaders/Unlit - Premultiplied Colored.shader @@ -0,0 +1,100 @@ +Shader "Unlit/Premultiplied Colored" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + AlphaTest Off + Fog { Mode Off } + Offset -1, -1 + ColorMask RGB + Blend One OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + return o; + } + + half4 frag (v2f IN) : COLOR + { + half4 col = tex2D(_MainTex, IN.texcoord) * IN.color; + //col.rgb = lerp(half3(0.0, 0.0, 0.0), col.rgb, col.a); + return col; + } + ENDCG + } + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + AlphaTest Off + Fog { Mode Off } + Offset -1, -1 + ColorMask RGB + Blend One OneMinusSrcAlpha + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} diff --git a/Assets/TestShaders/Unlit - Transparent Colored (AlphaClip).shader b/Assets/TestShaders/Unlit - Transparent Colored (AlphaClip).shader new file mode 100644 index 000000000..a3344a058 --- /dev/null +++ b/Assets/TestShaders/Unlit - Transparent Colored (AlphaClip).shader @@ -0,0 +1,110 @@ +Shader "Unlit/Transparent Colored (AlphaClip)" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Offset -1, -1 + Fog { Mode Off } + ColorMask RGB + Blend SrcAlpha OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + float2 worldPos : TEXCOORD1; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex); + return o; + } + + half4 frag (v2f IN) : COLOR + { + // Sample the texture + half4 col = tex2D(_MainTex, IN.texcoord) * IN.color; + + float2 factor = abs(IN.worldPos); + float val = 1.0 - max(factor.x, factor.y); + + // Option 1: 'if' statement + if (val < 0.0) col.a = 0.0; + + // Option 2: no 'if' statement -- may be faster on some devices + //col.a *= ceil(clamp(val, 0.0, 1.0)); + + return col; + } + ENDCG + } + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + ColorMask RGB + AlphaTest Greater .01 + Blend SrcAlpha OneMinusSrcAlpha + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} \ No newline at end of file diff --git a/Assets/TestShaders/Unlit - Transparent Colored (Packed) (AlphaClip) .shader b/Assets/TestShaders/Unlit - Transparent Colored (Packed) (AlphaClip) .shader new file mode 100644 index 000000000..7ab602daf --- /dev/null +++ b/Assets/TestShaders/Unlit - Transparent Colored (Packed) (AlphaClip) .shader @@ -0,0 +1,80 @@ +Shader "Unlit/Transparent Colored (Packed) (AlphaClip)" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Offset -1, -1 + Fog { Mode Off } + ColorMask RGB + Blend SrcAlpha OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + sampler2D _MainTex; + half4 _MainTex_ST; + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + float2 worldPos : TEXCOORD1; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex); + return o; + } + + half4 frag (v2f IN) : COLOR + { + half4 mask = tex2D(_MainTex, IN.texcoord); + half4 mixed = saturate(ceil(IN.color - 0.5)); + half4 col = saturate((mixed * 0.51 - IN.color) / -0.49); + float2 factor = abs(IN.worldPos); + float val = 1.0 - max(factor.x, factor.y); + + if (val < 0.0) col.a = 0.0; + mask *= mixed; + col.a *= mask.r + mask.g + mask.b + mask.a; + return col; + } + ENDCG + } + } + Fallback Off +} \ No newline at end of file diff --git a/Assets/TestShaders/Unlit - Transparent Colored (Packed) (SoftClip).shader b/Assets/TestShaders/Unlit - Transparent Colored (Packed) (SoftClip).shader new file mode 100644 index 000000000..c4a900498 --- /dev/null +++ b/Assets/TestShaders/Unlit - Transparent Colored (Packed) (SoftClip).shader @@ -0,0 +1,80 @@ +Shader "Unlit/Transparent Colored (Packed) (SoftClip)" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Offset -1, -1 + Fog { Mode Off } + ColorMask RGB + Blend SrcAlpha OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + sampler2D _MainTex; + half4 _MainTex_ST; + float2 _ClipSharpness = float2(20.0, 20.0); + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + float2 worldPos : TEXCOORD1; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex); + return o; + } + + half4 frag (v2f IN) : COLOR + { + half4 mask = tex2D(_MainTex, IN.texcoord); + half4 mixed = saturate(ceil(IN.color - 0.5)); + half4 col = saturate((mixed * 0.51 - IN.color) / -0.49); + float2 factor = (float2(1.0, 1.0) - abs(IN.worldPos)) * _ClipSharpness; + + mask *= mixed; + col.a *= clamp( min(factor.x, factor.y), 0.0, 1.0); + col.a *= mask.r + mask.g + mask.b + mask.a; + return col; + } + ENDCG + } + } + Fallback Off +} \ No newline at end of file diff --git a/Assets/TestShaders/Unlit - Transparent Colored (Packed).shader b/Assets/TestShaders/Unlit - Transparent Colored (Packed).shader new file mode 100644 index 000000000..5d091b7bf --- /dev/null +++ b/Assets/TestShaders/Unlit - Transparent Colored (Packed).shader @@ -0,0 +1,75 @@ +Shader "Unlit/Transparent Colored (Packed)" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Offset -1, -1 + Fog { Mode Off } + ColorMask RGB + Blend SrcAlpha OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + sampler2D _MainTex; + half4 _MainTex_ST; + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + return o; + } + + half4 frag (v2f IN) : COLOR + { + half4 mask = tex2D(_MainTex, IN.texcoord); + half4 mixed = saturate(ceil(IN.color - 0.5)); + half4 col = saturate((mixed * 0.51 - IN.color) / -0.49); + + mask *= mixed; + col.a *= mask.r + mask.g + mask.b + mask.a; + return col; + } + ENDCG + } + } + Fallback Off +} \ No newline at end of file diff --git a/Assets/TestShaders/Unlit - Transparent Colored (SoftClip).shader b/Assets/TestShaders/Unlit - Transparent Colored (SoftClip).shader new file mode 100644 index 000000000..2e5dd1ad4 --- /dev/null +++ b/Assets/TestShaders/Unlit - Transparent Colored (SoftClip).shader @@ -0,0 +1,107 @@ +Shader "Unlit/Transparent Colored (SoftClip)" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 200 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Offset -1, -1 + Fog { Mode Off } + ColorMask RGB + AlphaTest Greater .01 + Blend SrcAlpha OneMinusSrcAlpha + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + sampler2D _MainTex; + float4 _MainTex_ST; + float2 _ClipSharpness = float2(20.0, 20.0); + + struct appdata_t + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : POSITION; + half4 color : COLOR; + float2 texcoord : TEXCOORD0; + float2 worldPos : TEXCOORD1; + }; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.color = v.color; + o.texcoord = v.texcoord; + o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex); + return o; + } + + half4 frag (v2f IN) : COLOR + { + // Softness factor + float2 factor = (float2(1.0, 1.0) - abs(IN.worldPos)) * _ClipSharpness; + + // Sample the texture + half4 col = tex2D(_MainTex, IN.texcoord) * IN.color; + col.a *= clamp( min(factor.x, factor.y), 0.0, 1.0); + return col; + } + ENDCG + } + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Pass + { + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + ColorMask RGB + AlphaTest Greater .01 + Blend SrcAlpha OneMinusSrcAlpha + ColorMaterial AmbientAndDiffuse + + SetTexture [_MainTex] + { + Combine Texture * Primary + } + } + } +} \ No newline at end of file diff --git a/Assets/TestShaders/Unlit - Transparent Colored.shader b/Assets/TestShaders/Unlit - Transparent Colored.shader new file mode 100644 index 000000000..997bd37d9 --- /dev/null +++ b/Assets/TestShaders/Unlit - Transparent Colored.shader @@ -0,0 +1,68 @@ +Shader "Unlit/Transparent Colored" +{ + Properties + { + _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} + } + + SubShader + { + LOD 100 + + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + Offset -1, -1 + Blend SrcAlpha OneMinusSrcAlpha + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata_t + { + float4 vertex : POSITION; + float2 texcoord : TEXCOORD0; + fixed4 color : COLOR; + }; + + struct v2f + { + float4 vertex : SV_POSITION; + half2 texcoord : TEXCOORD0; + fixed4 color : COLOR; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + + v2f vert (appdata_t v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); + o.color = v.color; + return o; + } + + fixed4 frag (v2f i) : COLOR + { + fixed4 col = tex2D(_MainTex, i.texcoord) * i.color; + return col; + } + ENDCG + } + } +} diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 0009a3068..9855e5c33 100644 Binary files a/ProjectSettings/EditorBuildSettings.asset and b/ProjectSettings/EditorBuildSettings.asset differ diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 0977c5907..7fd6c5fdd 100644 Binary files a/ProjectSettings/ProjectSettings.asset and b/ProjectSettings/ProjectSettings.asset differ diff --git a/unityshinsoubanalice-csharp.sln b/unityshinsoubanalice-csharp.sln index c71b685cd..32cc8aee4 100644 --- a/unityshinsoubanalice-csharp.sln +++ b/unityshinsoubanalice-csharp.sln @@ -17,7 +17,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution + GlobalSection(MonoDevelopProperties) = preSolution StartupItem = Assembly-CSharp.csproj Policies = $0 $0.TextStylePolicy = $1 diff --git a/unityshinsoubanalice.sln b/unityshinsoubanalice.sln index 2bded50d9..48aa014eb 100644 --- a/unityshinsoubanalice.sln +++ b/unityshinsoubanalice.sln @@ -17,7 +17,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution + GlobalSection(MonoDevelopProperties) = preSolution StartupItem = Assembly-CSharp.csproj Policies = $0 $0.TextStylePolicy = $1 diff --git a/unityshinsoubanalice.userprefs b/unityshinsoubanalice.userprefs index a303b42e9..10cc16688 100644 --- a/unityshinsoubanalice.userprefs +++ b/unityshinsoubanalice.userprefs @@ -1,19 +1,24 @@  - - + + - - + + + - - - - - + + + - + + + + + + + \ No newline at end of file