1.0.0-preview.13
# [1.0.0-preview.13](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v1.0.0-preview.12...v1.0.0-preview.13) (2020-10-01)
### Bug Fixes
* screen resolution in full screen mode is incorrect ([39e3084](39e3084ec8
))
pull/122/head
parent
db266a8cf0
commit
73177082e5
|
@ -1,3 +1,10 @@
|
||||||
|
# [1.0.0-preview.13](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v1.0.0-preview.12...v1.0.0-preview.13) (2020-10-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* screen resolution in full screen mode is incorrect ([39e3084](https://github.com/mob-sakai/SoftMaskForUGUI/commit/39e3084ec840293f2ad461f50d51eeafe66cbebf))
|
||||||
|
|
||||||
# [1.0.0-preview.12](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v1.0.0-preview.11...v1.0.0-preview.12) (2020-09-28)
|
# [1.0.0-preview.12](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v1.0.0-preview.11...v1.0.0-preview.12) (2020-09-28)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Profiling;
|
using UnityEngine.Profiling;
|
||||||
using UnityEngine.Rendering;
|
using UnityEngine.Rendering;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
|
@ -14,9 +15,9 @@ namespace Coffee.UISoftMask
|
||||||
public class SoftMask : Mask, IMeshModifier
|
public class SoftMask : Mask, IMeshModifier
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Desampling rate.
|
/// Down sampling rate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum DesamplingRate
|
public enum DownSamplingRate
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
x1 = 1,
|
x1 = 1,
|
||||||
|
@ -70,8 +71,8 @@ namespace Coffee.UISoftMask
|
||||||
private bool _hasStencilStateChanged = false;
|
private bool _hasStencilStateChanged = false;
|
||||||
|
|
||||||
|
|
||||||
[SerializeField, Tooltip("The desampling rate for soft mask buffer.")]
|
[FormerlySerializedAs("m_DesamplingRate")] [SerializeField, Tooltip("The down sampling rate for soft mask buffer.")]
|
||||||
private DesamplingRate m_DesamplingRate = DesamplingRate.x1;
|
private DownSamplingRate m_DownSamplingRate = DownSamplingRate.x1;
|
||||||
|
|
||||||
[SerializeField, Range(0, 1), Tooltip("The value used by the soft mask to select the area of influence defined over the soft mask's graphic.")]
|
[SerializeField, Range(0, 1), Tooltip("The value used by the soft mask to select the area of influence defined over the soft mask's graphic.")]
|
||||||
private float m_Softness = 1;
|
private float m_Softness = 1;
|
||||||
|
@ -93,15 +94,15 @@ namespace Coffee.UISoftMask
|
||||||
private bool m_IgnoreSelfStencil;
|
private bool m_IgnoreSelfStencil;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The desampling rate for soft mask buffer.
|
/// The down sampling rate for soft mask buffer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DesamplingRate desamplingRate
|
public DownSamplingRate downSamplingRate
|
||||||
{
|
{
|
||||||
get { return m_DesamplingRate; }
|
get { return m_DownSamplingRate; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (m_DesamplingRate == value) return;
|
if (m_DownSamplingRate == value) return;
|
||||||
m_DesamplingRate = value;
|
m_DownSamplingRate = value;
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +183,7 @@ namespace Coffee.UISoftMask
|
||||||
|
|
||||||
// Check the size of soft mask buffer.
|
// Check the size of soft mask buffer.
|
||||||
int w, h;
|
int w, h;
|
||||||
GetDesamplingSize(m_DesamplingRate, out w, out h);
|
GetDownSamplingSize(m_DownSamplingRate, out w, out h);
|
||||||
if (_softMaskBuffer && (_softMaskBuffer.width != w || _softMaskBuffer.height != h))
|
if (_softMaskBuffer && (_softMaskBuffer.width != w || _softMaskBuffer.height != h))
|
||||||
{
|
{
|
||||||
ReleaseRt(ref _softMaskBuffer);
|
ReleaseRt(ref _softMaskBuffer);
|
||||||
|
@ -470,7 +471,7 @@ namespace Coffee.UISoftMask
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update all soft mask textures.
|
/// Update all soft mask textures.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static void UpdateMaskTextures()
|
private static void UpdateMaskTextures()
|
||||||
{
|
{
|
||||||
Profiler.BeginSample("UpdateMaskTextures");
|
Profiler.BeginSample("UpdateMaskTextures");
|
||||||
foreach (var sm in s_ActiveSoftMasks)
|
foreach (var sm in s_ActiveSoftMasks)
|
||||||
|
@ -552,7 +553,7 @@ namespace Coffee.UISoftMask
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
var w = s_PreviousWidth;
|
var w = s_PreviousWidth;
|
||||||
var h = s_PreviousHeight;
|
var h = s_PreviousHeight;
|
||||||
GetDesamplingSize(DesamplingRate.None, out s_PreviousWidth, out s_PreviousHeight);
|
GetDownSamplingSize(DownSamplingRate.None, out s_PreviousWidth, out s_PreviousHeight);
|
||||||
if (w != s_PreviousWidth || h != s_PreviousHeight)
|
if (w != s_PreviousWidth || h != s_PreviousHeight)
|
||||||
{
|
{
|
||||||
Canvas.ForceUpdateCanvases();
|
Canvas.ForceUpdateCanvases();
|
||||||
|
@ -670,20 +671,31 @@ namespace Coffee.UISoftMask
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the size of the desampling.
|
/// Gets the size of the down sampling.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void GetDesamplingSize(DesamplingRate rate, out int w, out int h)
|
private static void GetDownSamplingSize(DownSamplingRate rate, out int w, out int h)
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
var res = UnityEditor.UnityStats.screenRes.Split('x');
|
if (!Application.isPlaying)
|
||||||
w = Mathf.Max(64, int.Parse(res[0]));
|
{
|
||||||
h = Mathf.Max(64, int.Parse(res[1]));
|
var res = UnityEditor.UnityStats.screenRes.Split('x');
|
||||||
#else
|
w = Mathf.Max(64, int.Parse(res[0]));
|
||||||
w = Screen.width;
|
h = Mathf.Max(64, int.Parse(res[1]));
|
||||||
h = Screen.height;
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
if (Screen.fullScreenMode == FullScreenMode.Windowed)
|
||||||
|
{
|
||||||
|
w = Screen.width;
|
||||||
|
h = Screen.height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
w = Screen.currentResolution.width;
|
||||||
|
h = Screen.currentResolution.height;
|
||||||
|
}
|
||||||
|
|
||||||
if (rate == DesamplingRate.None)
|
if (rate == DownSamplingRate.None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var aspect = (float) w / h;
|
var aspect = (float) w / h;
|
||||||
|
@ -702,7 +714,7 @@ namespace Coffee.UISoftMask
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Release the specified obj.
|
/// Release the specified obj.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj">Object.</param>
|
/// <param name="tmpRT">Object.</param>
|
||||||
private static void ReleaseRt(ref RenderTexture tmpRT)
|
private static void ReleaseRt(ref RenderTexture tmpRT)
|
||||||
{
|
{
|
||||||
if (!tmpRT) return;
|
if (!tmpRT) return;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "com.coffee.softmask-for-ugui",
|
"name": "com.coffee.softmask-for-ugui",
|
||||||
"displayName": "UI Soft Mask",
|
"displayName": "UI Soft Mask",
|
||||||
"description": "UI Soft Mask is a smooth masking component for Unity UI (uGUI) elements.\nBy using SoftMask instead of the default Mask component, you can beautifully represent the rounded edges of UI elements.",
|
"description": "UI Soft Mask is a smooth masking component for Unity UI (uGUI) elements.\nBy using SoftMask instead of the default Mask component, you can beautifully represent the rounded edges of UI elements.",
|
||||||
"version": "1.0.0-preview.12",
|
"version": "1.0.0-preview.13",
|
||||||
"unity": "2017.1",
|
"unity": "2017.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
Loading…
Reference in New Issue