public override void Initialize() { if (isInit) { return; } isInit = true; Resources.LoadRenderTarget2D("default", SceneManager.activeScene, GraphicsHelper.screen.Width, GraphicsHelper.screen.Height, true, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents, new RenderTargetSettings() { depth = DepthStencilState.Default,//new DepthStencilState() { DepthBufferEnable = true, DepthBufferWriteEnable = true }, rasteriser = new RasterizerState() { DepthClipEnable = true, CullMode = CullMode.CullCounterClockwiseFace }, }); Resources.LoadRenderTarget2D("UI", SceneManager.activeScene, GraphicsHelper.screen.Width, GraphicsHelper.screen.Height, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.DiscardContents, new RenderTargetSettings()); Resources.LoadRenderTarget2D("screen", SceneManager.activeScene, GraphicsHelper.screen.Width, GraphicsHelper.screen.Height, true, SurfaceFormat.Color, DepthFormat.Depth16, 0, RenderTargetUsage.DiscardContents, new RenderTargetSettings()); RenderTargetRenderer.MakeRenderTargetRenderer("default", new RenderTargetSettings(), 0); RenderTargetRenderer.MakeRenderTargetRenderer("UI", new RenderTargetSettings(), 10); }
public static void UnRegisterDrawCallback(RenderTargetDrawCallback callback, RenderTargetRenderer renderTargetRenderer) { instance.callbacks.Remove(renderTargetRenderer.Priority); }
public static void RegisterDrawCallback(RenderTargetDrawCallback callback, RenderTargetRenderer renderTargetRenderer) { instance.Initialize(); instance.callbacks.Add(renderTargetRenderer.Priority, callback); }