release v0.7.0

pull/55/head
mob-sakai 2019-03-11 16:38:56 +09:00
commit f6f43bf0c5
12 changed files with 5067 additions and 3604 deletions

View File

@ -1,5 +1,23 @@
# Changelog
## [v0.7.0](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.7.0) (2019-03-11)
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.6.0...v0.7.0)
Add 'part of parent' option to make multiple holes on one background
![](https://user-images.githubusercontent.com/12690315/54102470-f5c26e80-440b-11e9-89d1-899aa4dca00d.png)
**Implemented enhancements:**
- 'Parts of parent' option [\#29](https://github.com/mob-sakai/SoftMaskForUGUI/issues/29)
**Fixed bugs:**
- scene view flickering [\#38](https://github.com/mob-sakai/SoftMaskForUGUI/issues/38)
- Flipped soft mask texture on Windows [\#37](https://github.com/mob-sakai/SoftMaskForUGUI/issues/37)
## [v0.6.0](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.6.0) (2019-02-07)
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.5.0...v0.6.0)

View File

@ -57,13 +57,15 @@ By using SoftMask instead of default Mask, rounded edges of UI elements can be e
![](https://user-images.githubusercontent.com/12690315/50284151-7459e080-049b-11e9-9cd3-24fb476766dc.png)
* Support TextMeshPro.
![](https://user-images.githubusercontent.com/12690315/50284145-71f78680-049b-11e9-8be1-ac0ccbdf0144.png)
* Make multiple holes on one background by 'Parts of parent' option
![](https://user-images.githubusercontent.com/12690315/54102470-f5c26e80-440b-11e9-89d1-899aa4dca00d.png)
#### Components
|Component|Description|Screenshot|
|-|-|-|
|SoftMask|Use instead of Mask for smooth masking.<br><br>**Show Mask Graphic:** Show the graphic that is associated with the Mask render area.<br>**Desampling Rate:** The desampling rate for soft mask buffer. The larger the value, the better the performance but the lower the quality.<br>**Softness:** The value used by the soft mask to select the area of influence defined over the soft mask's graphic.<br>**Ignore Parent:** Should the soft mask ignore parent soft masks?|<img src="https://user-images.githubusercontent.com/12690315/50319746-377a0200-050c-11e9-96ae-a3a0ec81765f.png" width="600px">|
|SoftMask|Use instead of Mask for smooth masking.<br><br>**Show Mask Graphic:** Show the graphic that is associated with the Mask render area.<br>**Desampling Rate:** The desampling rate for soft mask buffer. The larger the value, the better the performance but the lower the quality.<br>**Softness:** The value used by the soft mask to select the area of influence defined over the soft mask's graphic.<br>**Ignore Parent:** Should the soft mask ignore parent soft masks?<br>**Part Of Parent:** Is the soft mask a part of parent soft mask?|<img src="https://user-images.githubusercontent.com/12690315/50319746-377a0200-050c-11e9-96ae-a3a0ec81765f.png" width="600px">|
|SoftMaskable|Add this component to Graphic under SoftMask for smooth masking.<br><br>**Inverse:** The graphic will be visible only in areas where no mask is present.|<img src="https://user-images.githubusercontent.com/12690315/50319747-39dc5c00-050c-11e9-85fa-dd6ea9065daf.png" width="600px">|
@ -84,11 +86,13 @@ Find the manifest.json file in the Packages folder of your project and edit it t
```js
{
"dependencies": {
"com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git#0.5.0",
"com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git#0.7.0",
...
},
}
```
To update the package, change `#{version}` to the target version.
Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension).
#### Using .unitypackage file (for Unity 2017.1+)

View File

@ -55,6 +55,8 @@ namespace Coffee.UIExtensions
[SerializeField][Range(0.01f, 1)] float m_Softness = 1;
[Tooltip("Should the soft mask ignore parent soft masks?")]
[SerializeField] bool m_IgnoreParent = false;
[Tooltip("Is the soft mask a part of parent soft mask?")]
[SerializeField] bool m_PartOfParent = false;
//################################
@ -111,6 +113,23 @@ namespace Coffee.UIExtensions
}
}
/// <summary>
/// Is the soft mask a part of parent soft mask?
/// </summary>
public bool partOfParent
{
get { return m_PartOfParent; }
set
{
if (m_PartOfParent != value)
{
m_PartOfParent = value;
hasChanged = true;
OnTransformParentChanged();
}
}
}
/// <summary>
/// The soft mask buffer.
/// </summary>
@ -426,7 +445,14 @@ namespace Coffee.UIExtensions
int count = s_TmpSoftMasks[depth].Count;
for (int i = 0; i < count; i++)
{
s_TmpSoftMasks[depth + 1].AddRange(s_TmpSoftMasks[depth][i]._children);
List<SoftMask> children = s_TmpSoftMasks[depth][i]._children;
int childCount = children.Count;
for (int j = 0; j < childCount; j++)
{
var child = children[j];
var childDepth = child.m_PartOfParent ? depth : depth + 1;
s_TmpSoftMasks[childDepth].Add(child);
}
}
depth++;
}

View File

@ -126,7 +126,6 @@ namespace Coffee.UIExtensions
/// <summary>
/// The graphic will be visible only in areas where no mask is present.
/// </summary>
[System.Obsolete("Use SetMaskInteractions method instead.")]
public bool inverse
{
get { return m_MaskInteraction == kVisibleOutside; }
@ -175,9 +174,8 @@ namespace Coffee.UIExtensions
static int s_SoftMaskTexId;
static int s_StencilCompId;
static int s_MaskInteractionId;
static int s_SceneVId;
static int s_ScenePId;
static int s_GameVPId;
static int s_GameTVPId;
static List<SoftMaskable> s_ActiveSoftMaskables;
static int[] s_Interactions = new int[4];
static Material s_DefaultMaterial;
@ -207,21 +205,20 @@ namespace Coffee.UIExtensions
}
Material mat = sm._maskMaterial;
mat.SetMatrix(s_SceneVId, w2c);
mat.SetMatrix(s_ScenePId, prj);
var c = sm.graphic.canvas.rootCanvas;
if (c.renderMode != RenderMode.ScreenSpaceOverlay && c.worldCamera)
{
var wcam = c.worldCamera;
var pv = wcam.projectionMatrix * wcam.worldToCameraMatrix;
var pv = GL.GetGPUProjectionMatrix (wcam.projectionMatrix, false) * wcam.worldToCameraMatrix;
mat.SetMatrix(s_GameVPId, pv);
mat.SetMatrix(s_GameTVPId, pv);
}
else
{
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 / 1000f)) * Matrix4x4.Translate(-pos);
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));
}
}
}
@ -250,9 +247,8 @@ namespace Coffee.UIExtensions
#if UNITY_EDITOR
UnityEditor.EditorApplication.update += UpdateSceneViewMatrixForShader;
s_SceneVId = Shader.PropertyToID("_SceneV");
s_ScenePId = Shader.PropertyToID("_SceneP");
s_GameVPId = Shader.PropertyToID("_GameVP");
s_GameTVPId = Shader.PropertyToID("_GameTVP");
#endif
s_SoftMaskTexId = Shader.PropertyToID("_SoftMaskTex");

View File

@ -6,7 +6,7 @@ SubShader {
Cull Off
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Blend SrcAlpha One
ColorMask [_ColorMask]
Pass {

View File

@ -3,9 +3,8 @@
sampler2D _SoftMaskTex;
float _Stencil;
float4x4 _SceneV;
float4x4 _SceneP;
float4x4 _GameVP;
float4x4 _GameTVP;
half4 _MaskInteraction;
fixed Approximately(float4x4 a, float4x4 b)
@ -16,7 +15,7 @@ fixed Approximately(float4x4 a, float4x4 b)
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))))))))))))))),
1);
0.01);
}
float GetMaskAlpha(float alpha, int stencilId, float interaction)
@ -34,12 +33,12 @@ float SoftMaskInternal(float4 clipPos)
{
half2 view = clipPos.xy/_ScreenParams.xy;
#if SOFTMASK_EDITOR
fixed isSceneView = max(Approximately(UNITY_MATRIX_V, _SceneV), Approximately(UNITY_MATRIX_P, _SceneP));
float4 cpos = mul(_GameVP, mul(UNITY_MATRIX_M, wpos));
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
#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;
#endif

View File

@ -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.6.0",
"version": "0.7.0",
"unity": "2017.1",
"license": "MIT",
"repository": {

View File

@ -7,14 +7,17 @@ namespace Coffee.UIExtensions.Demos
{
public class SoftMask_Demo : MonoBehaviour
{
[SerializeField] RawImage softMaskBufferViewer;
[SerializeField] SoftMask softMask;
[SerializeField] RawImage[] softMaskBufferViewer;
[SerializeField] SoftMask[] softMask;
// Use this for initialization
void OnEnable()
{
softMaskBufferViewer.texture = softMask.softMaskBuffer;
for (int i = 0; i < softMask.Length; i++)
{
softMaskBufferViewer[i].texture = softMask[i].softMaskBuffer;
}
}
// Update is called once per frame

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,23 @@
# Changelog
## [v0.7.0](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.7.0) (2019-03-11)
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.6.0...v0.7.0)
Add 'part of parent' option to make multiple holes on one background
![](https://user-images.githubusercontent.com/12690315/54102470-f5c26e80-440b-11e9-89d1-899aa4dca00d.png)
**Implemented enhancements:**
- 'Parts of parent' option [\#29](https://github.com/mob-sakai/SoftMaskForUGUI/issues/29)
**Fixed bugs:**
- scene view flickering [\#38](https://github.com/mob-sakai/SoftMaskForUGUI/issues/38)
- Flipped soft mask texture on Windows [\#37](https://github.com/mob-sakai/SoftMaskForUGUI/issues/37)
## [v0.6.0](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.6.0) (2019-02-07)
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.5.0...v0.6.0)

View File

@ -57,13 +57,15 @@ By using SoftMask instead of default Mask, rounded edges of UI elements can be e
![](https://user-images.githubusercontent.com/12690315/50284151-7459e080-049b-11e9-9cd3-24fb476766dc.png)
* Support TextMeshPro.
![](https://user-images.githubusercontent.com/12690315/50284145-71f78680-049b-11e9-8be1-ac0ccbdf0144.png)
* Make multiple holes on one background by 'Parts of parent' option
![](https://user-images.githubusercontent.com/12690315/54102470-f5c26e80-440b-11e9-89d1-899aa4dca00d.png)
#### Components
|Component|Description|Screenshot|
|-|-|-|
|SoftMask|Use instead of Mask for smooth masking.<br><br>**Show Mask Graphic:** Show the graphic that is associated with the Mask render area.<br>**Desampling Rate:** The desampling rate for soft mask buffer. The larger the value, the better the performance but the lower the quality.<br>**Softness:** The value used by the soft mask to select the area of influence defined over the soft mask's graphic.<br>**Ignore Parent:** Should the soft mask ignore parent soft masks?|<img src="https://user-images.githubusercontent.com/12690315/50319746-377a0200-050c-11e9-96ae-a3a0ec81765f.png" width="600px">|
|SoftMask|Use instead of Mask for smooth masking.<br><br>**Show Mask Graphic:** Show the graphic that is associated with the Mask render area.<br>**Desampling Rate:** The desampling rate for soft mask buffer. The larger the value, the better the performance but the lower the quality.<br>**Softness:** The value used by the soft mask to select the area of influence defined over the soft mask's graphic.<br>**Ignore Parent:** Should the soft mask ignore parent soft masks?<br>**Part Of Parent:** Is the soft mask a part of parent soft mask?|<img src="https://user-images.githubusercontent.com/12690315/50319746-377a0200-050c-11e9-96ae-a3a0ec81765f.png" width="600px">|
|SoftMaskable|Add this component to Graphic under SoftMask for smooth masking.<br><br>**Inverse:** The graphic will be visible only in areas where no mask is present.|<img src="https://user-images.githubusercontent.com/12690315/50319747-39dc5c00-050c-11e9-85fa-dd6ea9065daf.png" width="600px">|
@ -84,11 +86,13 @@ Find the manifest.json file in the Packages folder of your project and edit it t
```js
{
"dependencies": {
"com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git#0.5.0",
"com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git#0.7.0",
...
},
}
```
To update the package, change `#{version}` to the target version.
Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension).
#### Using .unitypackage file (for Unity 2017.1+)

View File

@ -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.6.0",
"version": "0.7.0",
"unity": "2017.1",
"license": "MIT",
"repository": {