fix #36; if canvas camera is not set in world space mode, masked contents are not displayed
parent
3331704c0a
commit
2bcec9dffe
|
@ -464,9 +464,10 @@ namespace Coffee.UIExtensions
|
|||
|
||||
// Set view and projection matrices.
|
||||
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
|
||||
{
|
||||
|
|
|
@ -206,9 +206,9 @@ namespace Coffee.UIExtensions
|
|||
|
||||
Material mat = sm._maskMaterial;
|
||||
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;
|
||||
mat.SetMatrix(s_GameVPId, pv);
|
||||
mat.SetMatrix(s_GameTVPId, pv);
|
||||
|
|
Loading…
Reference in New Issue