예제 #1
0
 void OnCameraCapture(RenderTargetIdentifier source, CommandBuffer cb)
 {
     if (_attachedCamera == null)
     {
         return;
     }
     Blitter.Blit(_resources, cb, source, _buffer, _keepAlpha);
 }
예제 #2
0
        void Update()
        {
            // GameView capture mode
            if (_captureMethod == CaptureMethod.GameView)
            {
                PrepareBuffer(Screen.width, Screen.height);
                var temp = RenderTexture.GetTemporary(Screen.width, Screen.height, 0);
                ScreenCapture.CaptureScreenshotIntoRenderTexture(temp);
                Blitter.BlitVFlip(_resources, temp, _buffer, _keepAlpha);
                RenderTexture.ReleaseTemporary(temp);
            }

            // Texture capture mode
            if (_captureMethod == CaptureMethod.Texture)
            {
                if (_sourceTexture == null)
                {
                    return;
                }
                PrepareBuffer(_sourceTexture.width, _sourceTexture.height);
                Blitter.Blit(_resources, _sourceTexture, _buffer, _keepAlpha);
            }

            // Camera capture mode
            if (_captureMethod == CaptureMethod.Camera)
            {
                PrepareCameraCapture(_sourceCamera);
                if (_sourceCamera == null)
                {
                    return;
                }
                PrepareBuffer(_sourceCamera.pixelWidth, _sourceCamera.pixelHeight);
            }

            // Sender lazy initialization
            if (_sender == null)
            {
                _sender = new Sender(_spoutName, _buffer);
            }

            // Sender plugin-side update
            _sender.Update();
        }