Ejemplo n.º 1
0
    private RenderTexture RenderPreview(Noesis.View view, int width, int height)
    {
        try
        {
            if (CanRender() && view != null && view.Content != null)
            {
                NoesisRenderer.SetRenderSettings();

                view.SetSize(width, height);
                view.Update(0.0f);

                FlushMetalEncoder(_commands);
                NoesisRenderer.RenderOffscreen(view, _commands);

                RenderTexture rt = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.Default, RenderTextureReadWrite.Default, 8);
                _commands.SetRenderTarget(rt);
                _commands.ClearRenderTarget(true, true, UnityEngine.Color.clear, 0.0f);
                NoesisRenderer.RenderOnscreen(view, false, _commands);

                Graphics.ExecuteCommandBuffer(_commands);
                _commands.Clear();
                GL.InvalidateState();

                RenderTexture.ReleaseTemporary(rt);
                return(rt);
            }
        }
        catch (System.Exception e)
        {
            UnityEngine.Debug.LogException(e);
        }

        return(null);
    }
Ejemplo n.º 2
0
 private static void OnResize(int width, int height)
 {
     view.SetSize(width, height);
 }