mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-20 01:42:37 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 772297abd0 | |||
| b4cb57e097 | |||
| 923f74d047 | |||
| be90296be7 | |||
| e6027fbec2 | |||
| 72e2149f70 | |||
| 8490d11762 |
@@ -37,7 +37,9 @@ Shader "UI/Hidden/UI-EffectCapture"
|
||||
fixed4 colorFactor : COLOR1;
|
||||
#endif
|
||||
|
||||
#if defined (UI_TONE) || defined (UI_BLUR)
|
||||
half4 effectFactor : TEXCOORD2;
|
||||
#endif
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
@@ -49,9 +51,16 @@ Shader "UI/Hidden/UI-EffectCapture"
|
||||
{
|
||||
v2f OUT;
|
||||
OUT.vertex = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
OUT.texcoord = half2(v.texcoord.x, 1 - v.texcoord.y);
|
||||
#else
|
||||
OUT.texcoord = v.texcoord;
|
||||
#endif
|
||||
|
||||
#if defined (UI_TONE) || defined (UI_BLUR)
|
||||
OUT.effectFactor = _EffectFactor;
|
||||
#endif
|
||||
|
||||
#if UI_TONE_HUE
|
||||
OUT.effectFactor.y = sin(OUT.effectFactor.x*3.14159265359*2);
|
||||
@@ -64,10 +73,6 @@ Shader "UI/Hidden/UI-EffectCapture"
|
||||
OUT.colorFactor = _ColorFactor;
|
||||
#endif
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
OUT.texcoord.y = lerp(OUT.texcoord.y, 1 - OUT.texcoord.y, OUT.effectFactor.w);
|
||||
#endif
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,22 @@ namespace Coffee.UIExtensions
|
||||
// When not displaying, clear vertex.
|
||||
if (texture == null || effectColor.a < 1 / 255f || canvasRenderer.GetAlpha() < 1 / 255f)
|
||||
vh.Clear();
|
||||
#if UNITY_STANDALONE_WIN
|
||||
else if(_capturedIterations % 2 == 0)
|
||||
{
|
||||
Debug.Log(iterations);
|
||||
base.OnPopulateMesh(vh);
|
||||
int count = vh.currentVertCount;
|
||||
UIVertex vt = UIVertex.simpleVert;
|
||||
Vector2 one = Vector2.one;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
vh.PopulateUIVertex(ref vt, i);
|
||||
vt.uv0 = new Vector2(vt.uv0.x, 1-vt.uv0.y);
|
||||
vh.SetUIVertex(vt, i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
base.OnPopulateMesh(vh);
|
||||
}
|
||||
@@ -241,7 +257,7 @@ namespace Coffee.UIExtensions
|
||||
_buffer.Blit(BuiltinRenderTextureType.CurrentActive, s_CopyId);
|
||||
|
||||
// Set properties.
|
||||
_buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 1));
|
||||
_buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 0));
|
||||
_buffer.SetGlobalVector("_ColorFactor", new Vector4(effectColor.r, effectColor.g, effectColor.b, effectColor.a));
|
||||
|
||||
// Blit without effect.
|
||||
@@ -249,6 +265,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
_buffer.Blit(s_CopyId, rtId);
|
||||
_buffer.ReleaseTemporaryRT(s_CopyId);
|
||||
_capturedIterations = 1;
|
||||
}
|
||||
// Blit with effect.
|
||||
else
|
||||
@@ -261,7 +278,6 @@ namespace Coffee.UIExtensions
|
||||
// Iterate the operation.
|
||||
if(1 < m_Iterations)
|
||||
{
|
||||
_buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 0));
|
||||
_buffer.GetTemporaryRT(s_EffectId2, w, h, 0, m_FilterMode);
|
||||
for (int i = 1; i < m_Iterations; i++)
|
||||
{
|
||||
@@ -276,6 +292,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
_buffer.ReleaseTemporaryRT(s_EffectId2);
|
||||
}
|
||||
_capturedIterations = m_Iterations;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,6 +329,7 @@ namespace Coffee.UIExtensions
|
||||
RenderTexture _rt;
|
||||
RenderTexture _rtToRelease;
|
||||
CommandBuffer _buffer;
|
||||
int _capturedIterations = 1;
|
||||
|
||||
static int s_CopyId;
|
||||
static int s_EffectId1;
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## [v2.3.2](https://github.com/mob-sakai/UIEffect/tree/v2.3.2) (2018-05-21)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.3.1...v2.3.2)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Fixed: UIEffectCapturedImage: When iteration count is even. the result image is flipped vertically \(other method\) [\#65](https://github.com/mob-sakai/UIEffect/issues/65)
|
||||
|
||||
## [v2.3.1](https://github.com/mob-sakai/UIEffect/tree/v2.3.1) (2018-05-10)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.3.0...v2.3.1)
|
||||
|
||||
@@ -4,7 +4,7 @@ UIEffect
|
||||
UIEffect is an effect component for uGUI in Unity.
|
||||
Let's decorate your UI with effects!
|
||||
|
||||
[](https://github.com/mob-sakai/UIEffect/release)
|
||||
[](https://github.com/mob-sakai/UIEffect/releases)
|
||||
[](https://github.com/mob-sakai/UIEffect/releases)
|
||||

|
||||
[](https://github.com/mob-sakai/UIEffect/blob/master/LICENSE.txt)
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "UIEffect",
|
||||
"version": "2.3.1",
|
||||
"version": "2.3.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mob-sakai/UIEffect.git"
|
||||
},
|
||||
"src": "Assets/UIEffect",
|
||||
"unity": "/Applications/Unity2017.1.0p5/Unity2017.1.0p5.app/Contents/MacOS/Unity",
|
||||
"unity": "/Applications/Unity/Hub/Editor/5.5.0p4/Unity.app/Contents/MacOS/Unity",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user