release v0.7.2
commit
8be78103e8
|
@ -1,5 +1,16 @@
|
|||
# Changelog
|
||||
|
||||
## [v0.7.2](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.7.2) (2019-03-16)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.7.1...v0.7.2)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- The masked images all disappear if game view is maximized [\#44](https://github.com/mob-sakai/SoftMaskForUGUI/issues/44)
|
||||
- Pixels out of range may be read by raycaster [\#43](https://github.com/mob-sakai/SoftMaskForUGUI/issues/43)
|
||||
- The masked images all disappear when the game view is resized [\#42](https://github.com/mob-sakai/SoftMaskForUGUI/issues/42)
|
||||
- Doesn't work with Screen-Space Overlay [\#41](https://github.com/mob-sakai/SoftMaskForUGUI/issues/41)
|
||||
|
||||
## [v0.7.1](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.7.1) (2019-03-11)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.7.0...v0.7.1)
|
||||
|
|
|
@ -155,6 +155,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
_softMaskBuffer = RenderTexture.GetTemporary(w, h, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
|
||||
hasChanged = true;
|
||||
_hasStencilStateChanged = true;
|
||||
}
|
||||
|
||||
return _softMaskBuffer;
|
||||
|
@ -238,8 +239,8 @@ namespace Coffee.UIExtensions
|
|||
return true;
|
||||
}
|
||||
|
||||
int x = (int)(softMaskBuffer.width * sp.x / Screen.width);
|
||||
int y = (int)(softMaskBuffer.height * sp.y / Screen.height);
|
||||
int x = (int)((softMaskBuffer.width - 1) * Mathf.Clamp01(sp.x / Screen.width));
|
||||
int y = (int)((softMaskBuffer.height - 1) * Mathf.Clamp01(sp.y / Screen.height));
|
||||
return 0.5f < GetPixelValue(x, y, interactions);
|
||||
}
|
||||
|
||||
|
@ -289,6 +290,7 @@ namespace Coffee.UIExtensions
|
|||
graphic.SetVerticesDirty();
|
||||
|
||||
base.OnEnable();
|
||||
_hasStencilStateChanged = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -324,6 +326,7 @@ namespace Coffee.UIExtensions
|
|||
ReleaseRT(ref _softMaskBuffer);
|
||||
|
||||
base.OnDisable();
|
||||
_hasStencilStateChanged = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -360,6 +363,7 @@ namespace Coffee.UIExtensions
|
|||
graphic.SetMaterialDirty();
|
||||
OnTransformParentChanged();
|
||||
base.OnValidate();
|
||||
_hasStencilStateChanged = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -383,6 +387,8 @@ namespace Coffee.UIExtensions
|
|||
SoftMask _parent;
|
||||
List<SoftMask> _children = new List<SoftMask>();
|
||||
bool _hasChanged = false;
|
||||
bool _hasStencilStateChanged = false;
|
||||
|
||||
|
||||
Material material { get { return _material ? _material : _material = new Material(s_SoftMaskShader ? s_SoftMaskShader : s_SoftMaskShader = Resources.Load<Shader>("SoftMask")){ hideFlags = HideFlags.HideAndDontSave }; } }
|
||||
|
||||
|
@ -421,6 +427,11 @@ namespace Coffee.UIExtensions
|
|||
if (!sm._parent)
|
||||
{
|
||||
sm.UpdateMaskTexture();
|
||||
if (sm._hasStencilStateChanged)
|
||||
{
|
||||
sm._hasStencilStateChanged = false;
|
||||
MaskUtilities.NotifyStencilStateChanged (sm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -467,7 +478,7 @@ namespace Coffee.UIExtensions
|
|||
var cam = c.worldCamera ?? Camera.main;
|
||||
if (c && c.renderMode != RenderMode.ScreenSpaceOverlay && cam)
|
||||
{
|
||||
_cb.SetViewProjectionMatrices(cam.worldToCameraMatrix, cam.projectionMatrix);
|
||||
_cb.SetViewProjectionMatrices(cam.worldToCameraMatrix, GL.GetGPUProjectionMatrix(cam.projectionMatrix, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -542,6 +553,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
if (tmpRT)
|
||||
{
|
||||
tmpRT.Release();
|
||||
RenderTexture.ReleaseTemporary(tmpRT);
|
||||
tmpRT = null;
|
||||
}
|
||||
|
|
|
@ -186,15 +186,6 @@ namespace Coffee.UIExtensions
|
|||
/// </summary>
|
||||
static void UpdateSceneViewMatrixForShader()
|
||||
{
|
||||
UnityEditor.SceneView sceneView = UnityEditor.SceneView.lastActiveSceneView;
|
||||
if (!sceneView || !sceneView.camera)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Camera cam = sceneView.camera;
|
||||
Matrix4x4 w2c = cam.worldToCameraMatrix;
|
||||
Matrix4x4 prj = cam.projectionMatrix;
|
||||
|
||||
s_ActiveSoftMaskables.RemoveAll(x=>!x);
|
||||
foreach (var sm in s_ActiveSoftMaskables)
|
||||
|
@ -215,10 +206,11 @@ namespace Coffee.UIExtensions
|
|||
}
|
||||
else
|
||||
{
|
||||
var scale = c.transform.localScale.x;
|
||||
var size = (c.transform as RectTransform).sizeDelta;
|
||||
var pos = c.transform.localPosition;
|
||||
var pv = Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, new Vector3(1 / pos.x, 1 / pos.y, -2 / 2000f));
|
||||
mat.SetMatrix(s_GameVPId, pv);
|
||||
mat.SetMatrix(s_GameTVPId, pv * Matrix4x4.Translate(-pos));
|
||||
mat.SetMatrix(s_GameVPId, Matrix4x4.TRS(new Vector3(0, 0, 0.5f), Quaternion.identity, new Vector3(2 / size.x, 2 / size.y, 0.0005f * scale)));
|
||||
mat.SetMatrix(s_GameTVPId, Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, new Vector3(1 / pos.x, 1 / pos.y, -2/2000f)) * Matrix4x4.Translate(-pos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ fixed Approximately(float4x4 a, float4x4 b)
|
|||
return step(
|
||||
max(d._m00,max(d._m01,max(d._m02,max(d._m03,
|
||||
max(d._m10,max(d._m11,max(d._m12,max(d._m13,
|
||||
max(d._m20,max(d._m21,max(d._m22,max(d._m23,
|
||||
max(d._m30,max(d._m31,max(d._m32,d._m33))))))))))))))),
|
||||
max(d._m20,max(d._m21,max(d._m22,//max(d._m23,
|
||||
max(d._m30,max(d._m31,max(d._m32,d._m33)))))))))))))),
|
||||
0.01);
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,11 @@ float SoftMaskInternal(float4 clipPos)
|
|||
fixed isSceneView = 1 - Approximately(UNITY_MATRIX_VP, _GameVP);
|
||||
float4 cpos = mul(_GameTVP, mul(UNITY_MATRIX_M, wpos));
|
||||
view = lerp(view, cpos.xy / cpos.w * 0.5 + 0.5, isSceneView);
|
||||
#endif
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP && !defined(SHADER_API_D3D11) && !defined(SHADER_API_D3D11_9X) && !defined(SHADER_API_D3D9)
|
||||
view.y = 1.0 - view.y;
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
view.y = lerp(view.y, 1 - view.y, step(0, _ProjectionParams.x));
|
||||
#endif
|
||||
#elif UNITY_UV_STARTS_AT_TOP
|
||||
view.y = lerp(view.y, 1 - view.y, step(0, _ProjectionParams.x));
|
||||
#endif
|
||||
|
||||
fixed4 mask = tex2D(_SoftMaskTex, view);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "com.coffee.softmask-for-ugui",
|
||||
"displayName": "Soft Mask For uGUI",
|
||||
"description": "SoftMask is a smooth masking component for uGUI elements in Unity.\nBy using SoftMask instead of default Mask, rounded edges of UI elements can be expressed beautifully.",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"unity": "2017.1",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
|
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -1,5 +1,16 @@
|
|||
# Changelog
|
||||
|
||||
## [v0.7.2](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.7.2) (2019-03-16)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.7.1...v0.7.2)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- The masked images all disappear if game view is maximized [\#44](https://github.com/mob-sakai/SoftMaskForUGUI/issues/44)
|
||||
- Pixels out of range may be read by raycaster [\#43](https://github.com/mob-sakai/SoftMaskForUGUI/issues/43)
|
||||
- The masked images all disappear when the game view is resized [\#42](https://github.com/mob-sakai/SoftMaskForUGUI/issues/42)
|
||||
- Doesn't work with Screen-Space Overlay [\#41](https://github.com/mob-sakai/SoftMaskForUGUI/issues/41)
|
||||
|
||||
## [v0.7.1](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.7.1) (2019-03-11)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.7.0...v0.7.1)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "com.coffee.softmask-for-ugui",
|
||||
"displayName": "Soft Mask For uGUI",
|
||||
"description": "SoftMask is a smooth masking component for uGUI elements in Unity.\nBy using SoftMask instead of default Mask, rounded edges of UI elements can be expressed beautifully.",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"unity": "2017.1",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
|
Loading…
Reference in New Issue