fix #36; if canvas camera is not set in world space mode, masked contents are not displayed

pull/87/head
mob-sakai 2019-03-11 20:30:43 +09:00
parent 3331704c0a
commit 2bcec9dffe
2 changed files with 5 additions and 4 deletions

View File

@ -464,9 +464,10 @@ namespace Coffee.UIExtensions
// Set view and projection matrices. // Set view and projection matrices.
var c = graphic.canvas.rootCanvas; var c = graphic.canvas.rootCanvas;
if (c && c.renderMode != RenderMode.ScreenSpaceOverlay && c.worldCamera) var cam = c.worldCamera ?? Camera.main;
if (c && c.renderMode != RenderMode.ScreenSpaceOverlay && cam)
{ {
_cb.SetViewProjectionMatrices(c.worldCamera.worldToCameraMatrix, c.worldCamera.projectionMatrix); _cb.SetViewProjectionMatrices(cam.worldToCameraMatrix, cam.projectionMatrix);
} }
else else
{ {

View File

@ -206,9 +206,9 @@ namespace Coffee.UIExtensions
Material mat = sm._maskMaterial; Material mat = sm._maskMaterial;
var c = sm.graphic.canvas.rootCanvas; var c = sm.graphic.canvas.rootCanvas;
if (c.renderMode != RenderMode.ScreenSpaceOverlay && c.worldCamera) var wcam = c.worldCamera ?? Camera.main;
if (c.renderMode != RenderMode.ScreenSpaceOverlay && wcam)
{ {
var wcam = c.worldCamera;
var pv = GL.GetGPUProjectionMatrix (wcam.projectionMatrix, false) * wcam.worldToCameraMatrix; var pv = GL.GetGPUProjectionMatrix (wcam.projectionMatrix, false) * wcam.worldToCameraMatrix;
mat.SetMatrix(s_GameVPId, pv); mat.SetMatrix(s_GameVPId, pv);
mat.SetMatrix(s_GameTVPId, pv); mat.SetMatrix(s_GameTVPId, pv);