示例#1
0
        void Update()
        {
            // Receiver lazy initialization
            if (_receiver == null)
            {
                _receiver = new Receiver(_sourceName);
            }

            // Receiver plugin-side update
            _receiver.Update();

            // Do nothing further if no texture is ready yet.
            if (_receiver.Texture == null)
            {
                return;
            }

            // Received texture buffering
            var buffer = PrepareBuffer();

            Blitter.BlitFromSrgb(_resources, _receiver.Texture, buffer);

            // Renderer override
            if (_targetRenderer != null)
            {
                RendererOverride.SetTexture
                    (_targetRenderer, _targetMaterialProperty, buffer);
            }
        }
示例#2
0
 void OnCameraCapture(RenderTargetIdentifier source, CommandBuffer cb)
 {
     if (_attachedCamera == null)
     {
         return;
     }
     Blitter.Blit(_resources, cb, source, _buffer, _keepAlpha);
 }
示例#3
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();
        }