Beispiel #1
0
    protected void InjectSourceColorToImage()
    {
        lerpMat.SetFloat(PROP_LERP_EMISSION, lerpEmission);
        lerpMat.SetFloat(PROP_LERP_DISSIPATION, lerpDissipation);
        lerpMat.SetTexture(PROP_PREV_TEX, _imageTex0.Texture);
        Graphics.Blit(_sourceTex.Texture, _imageTex1.Texture, lerpMat);
        _sourceTex.Release();
        _imageTex0.Release();

        NotifyTextureOnChange(_imageTex1.Texture);
        SwapImageTexture();
    }
Beispiel #2
0
        private void OnEnable()
        {
            sender       = GetComponent <SpoutSender>();
            targetCamera = GetComponent <Camera>();

            targetTex = new ResizableRenderTexture();

            validator.Reset();
            validator.Validation += () => {
                Debug.LogFormat("Update Spout : {0}", data);
                SetTargetTexture(null);
                guidata = new GUIData(data);

                var frt = new FormatRT()
                {
                    textureFormat = format,
                    depth         = 24,
                    useMipMap     = false,
                    antiAliasing  = QualitySettings.antiAliasing,
                    readWrite     = RenderTextureReadWrite.Default,
                    filterMode    = FilterMode.Bilinear,
                    wrapMode      = TextureWrapMode.Clamp,
                    anisoLevel    = 0
                };

                if (sender != null)
                {
                    sender.enabled = data.spout;
                }

                if (data.spout)
                {
                    targetTex.Format = frt;
                    targetTex.Size   = data.Size;
                    SetTargetTexture(targetTex);
                }
                else
                {
                    targetTex.Release();
                }

                events.ActiveOnEnabled.Invoke(data.spout);
                events.ActiveOnDisabled.Invoke(!data.spout);
            };
            Load();

            validator.Validate();
        }
Beispiel #3
0
    public void reScrape()
    {
        //_sourceTex.Dispose();
        //_sourceTex = null;
        //_sourceTex = new ResizableRenderTexture(new nobnak.Gist.Resizable.FormatRT()
        //{

        //	depth = 24,
        //	textureFormat = textureFormatSource,
        //	readWrite = RenderTextureReadWrite.Linear,
        //	antiAliasing = QualitySettings.antiAliasing
        //});
        _sourceTex.Release();
        _imageTex0.Release();
        _imageTex1.Release();
    }