Exemplo n.º 1
0
        // NOTE: This is old code based on OnRenderImage...may be revived at some point
        private void OnRenderImage(RenderTexture source, RenderTexture dest)
        {
            if (_capturing && !_paused)
            {
#if true
                while (_handle >= 0 && !NativePlugin.IsNewFrameDue(_handle))
                {
                    System.Threading.Thread.Sleep(1);
                }
                if (_handle >= 0)
                {
                    if (_audioCapture && _audioDeviceIndex < 0 && !_noAudio && _isRealTime)
                    {
                        int           audioDataLength = 0;
                        System.IntPtr audioDataPtr    = _audioCapture.ReadData(out audioDataLength);
                        if (audioDataLength > 0)
                        {
                            NativePlugin.EncodeAudio(_handle, audioDataPtr, (uint)audioDataLength);
                        }
                    }

                    // In Direct3D the RT can be flipped vertically

                    /*if (source.texelSize.y < 0)
                     * {
                     *
                     * }*/

                    Graphics.Blit(source, dest);

                    _lastSource = source;
                    _lastDest   = dest;

                    if (dest != _originalTarget)
                    {
                        Graphics.Blit(dest, _originalTarget);
                    }

#if AVPRO_MOVIECAPTURE_GLISSUEEVENT_52
                    GL.IssuePluginEvent(NativePlugin.GetRenderEventFunc(), NativePlugin.PluginID | (int)NativePlugin.PluginEvent.CaptureFrameBuffer | _handle);
#else
                    GL.IssuePluginEvent(NativePlugin.PluginID | (int)NativePlugin.PluginEvent.CaptureFrameBuffer | _handle);
#endif
                    GL.InvalidateState();

                    UpdateFPS();

                    return;
                }
#endif
            }

            // Pass-through
            Graphics.Blit(source, dest);

            _lastSource = source;
            _lastDest   = dest;
        }
Exemplo n.º 2
0
        private void OnRenderImage(RenderTexture source, RenderTexture dest)
        {
#if false
            if (_capturing && !_paused)
            {
                while (_handle >= 0 && !NativePlugin.IsNewFrameDue(_handle))
                {
                    System.Threading.Thread.Sleep(1);
                }
                if (_handle >= 0)
                {
                    if (_audioCapture && _audioDeviceIndex < 0 && !_noAudio)
                    {
                        uint bufferLength = (uint)_audioCapture.BufferLength;
                        if (bufferLength > 0)
                        {
                            NativePlugin.EncodeAudio(_handle, _audioCapture.BufferPtr, bufferLength);
                            _audioCapture.FlushBuffer();
                        }
                    }

                    // In Direct3D the RT can be flipped vertically

                    /*if (source.texelSize.y < 0)
                     * {
                     *
                     * }*/

                    Graphics.Blit(_cubeTarget, _target, _cubemapToEquirectangularMaterial);

                    RenderThreadEvent(NativePlugin.PluginEvent.CaptureFrameBuffer);
                    GL.InvalidateState();

                    UpdateFPS();
                }
            }
#endif
            // Pass-through

            if (_cubeTarget != null)
            {
                Graphics.Blit(_cubeTarget, dest, _cubemapToEquirectangularMaterial);
            }
            else
            {
                Graphics.Blit(source, dest);
            }
        }