fix: Projection Matrix check always true when using world space canvas

Close #67
pull/87/head
mob-sakai 2020-01-28 19:11:35 +09:00
parent a7a3c41a51
commit f5bd6003a8
1 changed files with 3 additions and 9 deletions

View File

@ -409,10 +409,8 @@ namespace Coffee.UIExtensions
List<SoftMask> _children = new List<SoftMask>(); List<SoftMask> _children = new List<SoftMask>();
bool _hasChanged = false; bool _hasChanged = false;
bool _hasStencilStateChanged = false; bool _hasStencilStateChanged = false;
#if !UNITY_2018_1_OR_NEWER
static readonly Dictionary<int, Matrix4x4> s_previousViewProjectionMatrices = new Dictionary<int, Matrix4x4> (); static readonly Dictionary<int, Matrix4x4> s_previousViewProjectionMatrices = new Dictionary<int, Matrix4x4> ();
static readonly Dictionary<int, Matrix4x4> s_nowViewProjectionMatrices = new Dictionary<int, Matrix4x4> (); static readonly Dictionary<int, Matrix4x4> s_nowViewProjectionMatrices = new Dictionary<int, Matrix4x4> ();
#endif
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 }; } }
@ -438,18 +436,14 @@ namespace Coffee.UIExtensions
if(!cam) if(!cam)
continue; continue;
Matrix4x4 nowsVP = cam.projectionMatrix * cam.worldToCameraMatrix; Matrix4x4 nowVP = cam.projectionMatrix * cam.worldToCameraMatrix;
#if UNITY_2018_1_OR_NEWER
Matrix4x4 previousVP = cam.previousViewProjectionMatrix;
#else
Matrix4x4 previousVP = default(Matrix4x4); Matrix4x4 previousVP = default(Matrix4x4);
int id = cam.GetInstanceID (); int id = cam.GetInstanceID ();
s_previousViewProjectionMatrices.TryGetValue (id, out previousVP); s_previousViewProjectionMatrices.TryGetValue (id, out previousVP);
s_nowViewProjectionMatrices[id] = nowsVP; s_nowViewProjectionMatrices[id] = nowVP;
#endif
if (previousVP != nowsVP) if (previousVP != nowVP)
{ {
sm.hasChanged = true; sm.hasChanged = true;
} }