release v0.7.2
commit
8be78103e8
|
@ -1,5 +1,16 @@
|
||||||
# Changelog
|
# 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)
|
## [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)
|
[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);
|
_softMaskBuffer = RenderTexture.GetTemporary(w, h, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
|
_hasStencilStateChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _softMaskBuffer;
|
return _softMaskBuffer;
|
||||||
|
@ -238,8 +239,8 @@ namespace Coffee.UIExtensions
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = (int)(softMaskBuffer.width * sp.x / Screen.width);
|
int x = (int)((softMaskBuffer.width - 1) * Mathf.Clamp01(sp.x / Screen.width));
|
||||||
int y = (int)(softMaskBuffer.height * sp.y / Screen.height);
|
int y = (int)((softMaskBuffer.height - 1) * Mathf.Clamp01(sp.y / Screen.height));
|
||||||
return 0.5f < GetPixelValue(x, y, interactions);
|
return 0.5f < GetPixelValue(x, y, interactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,6 +290,7 @@ namespace Coffee.UIExtensions
|
||||||
graphic.SetVerticesDirty();
|
graphic.SetVerticesDirty();
|
||||||
|
|
||||||
base.OnEnable();
|
base.OnEnable();
|
||||||
|
_hasStencilStateChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -324,6 +326,7 @@ namespace Coffee.UIExtensions
|
||||||
ReleaseRT(ref _softMaskBuffer);
|
ReleaseRT(ref _softMaskBuffer);
|
||||||
|
|
||||||
base.OnDisable();
|
base.OnDisable();
|
||||||
|
_hasStencilStateChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -360,6 +363,7 @@ namespace Coffee.UIExtensions
|
||||||
graphic.SetMaterialDirty();
|
graphic.SetMaterialDirty();
|
||||||
OnTransformParentChanged();
|
OnTransformParentChanged();
|
||||||
base.OnValidate();
|
base.OnValidate();
|
||||||
|
_hasStencilStateChanged = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -383,6 +387,8 @@ namespace Coffee.UIExtensions
|
||||||
SoftMask _parent;
|
SoftMask _parent;
|
||||||
List<SoftMask> _children = new List<SoftMask>();
|
List<SoftMask> _children = new List<SoftMask>();
|
||||||
bool _hasChanged = false;
|
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 }; } }
|
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)
|
if (!sm._parent)
|
||||||
{
|
{
|
||||||
sm.UpdateMaskTexture();
|
sm.UpdateMaskTexture();
|
||||||
|
if (sm._hasStencilStateChanged)
|
||||||
|
{
|
||||||
|
sm._hasStencilStateChanged = false;
|
||||||
|
MaskUtilities.NotifyStencilStateChanged (sm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -467,7 +478,7 @@ namespace Coffee.UIExtensions
|
||||||
var cam = c.worldCamera ?? Camera.main;
|
var cam = c.worldCamera ?? Camera.main;
|
||||||
if (c && c.renderMode != RenderMode.ScreenSpaceOverlay && cam)
|
if (c && c.renderMode != RenderMode.ScreenSpaceOverlay && cam)
|
||||||
{
|
{
|
||||||
_cb.SetViewProjectionMatrices(cam.worldToCameraMatrix, cam.projectionMatrix);
|
_cb.SetViewProjectionMatrices(cam.worldToCameraMatrix, GL.GetGPUProjectionMatrix(cam.projectionMatrix, false));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -542,6 +553,7 @@ namespace Coffee.UIExtensions
|
||||||
{
|
{
|
||||||
if (tmpRT)
|
if (tmpRT)
|
||||||
{
|
{
|
||||||
|
tmpRT.Release();
|
||||||
RenderTexture.ReleaseTemporary(tmpRT);
|
RenderTexture.ReleaseTemporary(tmpRT);
|
||||||
tmpRT = null;
|
tmpRT = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,15 +186,6 @@ namespace Coffee.UIExtensions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static void UpdateSceneViewMatrixForShader()
|
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);
|
s_ActiveSoftMaskables.RemoveAll(x=>!x);
|
||||||
foreach (var sm in s_ActiveSoftMaskables)
|
foreach (var sm in s_ActiveSoftMaskables)
|
||||||
|
@ -215,10 +206,11 @@ namespace Coffee.UIExtensions
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var scale = c.transform.localScale.x;
|
||||||
|
var size = (c.transform as RectTransform).sizeDelta;
|
||||||
var pos = c.transform.localPosition;
|
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, Matrix4x4.TRS(new Vector3(0, 0, 0.5f), Quaternion.identity, new Vector3(2 / size.x, 2 / size.y, 0.0005f * scale)));
|
||||||
mat.SetMatrix(s_GameVPId, pv);
|
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));
|
||||||
mat.SetMatrix(s_GameTVPId, pv * Matrix4x4.Translate(-pos));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ fixed Approximately(float4x4 a, float4x4 b)
|
||||||
return step(
|
return step(
|
||||||
max(d._m00,max(d._m01,max(d._m02,max(d._m03,
|
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._m10,max(d._m11,max(d._m12,max(d._m13,
|
||||||
max(d._m20,max(d._m21,max(d._m22,max(d._m23,
|
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._m30,max(d._m31,max(d._m32,d._m33)))))))))))))),
|
||||||
0.01);
|
0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,10 +36,11 @@ float SoftMaskInternal(float4 clipPos)
|
||||||
fixed isSceneView = 1 - Approximately(UNITY_MATRIX_VP, _GameVP);
|
fixed isSceneView = 1 - Approximately(UNITY_MATRIX_VP, _GameVP);
|
||||||
float4 cpos = mul(_GameTVP, mul(UNITY_MATRIX_M, wpos));
|
float4 cpos = mul(_GameTVP, mul(UNITY_MATRIX_M, wpos));
|
||||||
view = lerp(view, cpos.xy / cpos.w * 0.5 + 0.5, isSceneView);
|
view = lerp(view, cpos.xy / cpos.w * 0.5 + 0.5, isSceneView);
|
||||||
#endif
|
#if UNITY_UV_STARTS_AT_TOP
|
||||||
|
view.y = lerp(view.y, 1 - view.y, step(0, _ProjectionParams.x));
|
||||||
#if UNITY_UV_STARTS_AT_TOP && !defined(SHADER_API_D3D11) && !defined(SHADER_API_D3D11_9X) && !defined(SHADER_API_D3D9)
|
#endif
|
||||||
view.y = 1.0 - view.y;
|
#elif UNITY_UV_STARTS_AT_TOP
|
||||||
|
view.y = lerp(view.y, 1 - view.y, step(0, _ProjectionParams.x));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fixed4 mask = tex2D(_SoftMaskTex, view);
|
fixed4 mask = tex2D(_SoftMaskTex, view);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "com.coffee.softmask-for-ugui",
|
"name": "com.coffee.softmask-for-ugui",
|
||||||
"displayName": "Soft Mask 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.",
|
"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",
|
"unity": "2017.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -1,5 +1,16 @@
|
||||||
# Changelog
|
# 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)
|
## [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)
|
[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",
|
"name": "com.coffee.softmask-for-ugui",
|
||||||
"displayName": "Soft Mask 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.",
|
"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",
|
"unity": "2017.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
Loading…
Reference in New Issue