Esempio n. 1
0
        public static void InitializeEncoder(IntPtr callback, IntPtr track)
        {
            _command.IssuePluginEventAndData(callback, (int)VideoStreamRenderEventId.Initialize, track);

            Graphics.ExecuteCommandBuffer(_command);
            _command.Clear();
        }
Esempio n. 2
0
    /// <summary>
    /// Sends render commands to native code
    /// </summary>
    public static void RenderOnscreen(Noesis.View view, bool flipY, UnityEngine.Rendering.CommandBuffer commands)
    {
        // This is a workaround for a bug in Unity. When rendering nothing Unity sends us an empty MTLRenderCommandEncoder
        if (UnityEngine.SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.Metal)
        {
            if (_dummyMesh == null)
            {
                _dummyMesh             = new UnityEngine.Mesh();
                _dummyMesh.vertices    = new UnityEngine.Vector3[3];
                _dummyMesh.vertices[0] = new UnityEngine.Vector3(0, 0, 0);
                _dummyMesh.vertices[1] = new UnityEngine.Vector3(0, 0, 0);
                _dummyMesh.vertices[2] = new UnityEngine.Vector3(0, 0, 0);
                _dummyMesh.triangles   = new int[3] {
                    0, 2, 1
                };
            }

            if (_dummyMaterial == null)
            {
                _dummyMaterial = new UnityEngine.Material(UnityEngine.Shader.Find("UI/Default"));
            }

            commands.DrawMesh(_dummyMesh, new UnityEngine.Matrix4x4(), _dummyMaterial);
        }

        commands.IssuePluginEventAndData(_renderOnscreenCallback, flipY ? 1 : 0, view.CPtr.Handle);
    }
Esempio n. 3
0
 /// <summary>
 /// Unregister given renderer
 /// </summary>
 public static void UnregisterView(Noesis.View view, UnityEngine.Rendering.CommandBuffer commands)
 {
     commands.IssuePluginEventAndData(_renderUnregisterCallback, 0, view.CPtr.Handle);
 }
Esempio n. 4
0
 /// <summary>
 /// Sends render commands to native code
 /// </summary>
 public static void RenderOnscreen(Noesis.View view, bool flipY, UnityEngine.Rendering.CommandBuffer commands)
 {
     commands.IssuePluginEventAndData(_renderOnscreenCallback, flipY ? 1 : 0, view.CPtr.Handle);
 }
Esempio n. 5
0
 private static void InsertMarker(UnityEngine.Rendering.CommandBuffer buf, PluginExtMarker marker, UInt32 data)
 {
   buf.IssuePluginEventAndData(PluginExtGetIssueMarkerCallback(), (int)marker, (IntPtr)data);
 }