Ejemplo n.º 1
0
        public bool Inspect()
        {
            var changed = pegi.toggleDefaultInspector(this).nl();

            if (!gameObject.GetComponent <Camera>())
            {
                "No Camera Detected on this Game Object. I need camera".writeWarning();
            }

            "Post Process Method".editEnum(ref _postProcessMethod).nl();

            pegi.nl();

            "Copy shader".edit(ref copyShader).nl();

            "Post-Process".edit(ref postProcessShader).nl();

            "Iterations:".edit(ref postProcessIteration).nl();

            pegi.nl();

            if (_screenTexture)
            {
                "Screen".edit(ref _screenTexture);
                if (icon.Refresh.Click().nl())
                {
                    RequestUpdate(() => Debug.Log("Screen Generating done"));
                }
            }
            else if ("Request Screen Render".Click())
            {
                RequestUpdate(() => Debug.Log("Screen Generating done"));
            }

            pegi.nl();

            if (!IsUsingCrt)
            {
                if (_renderTextures.Length < 2)
                {
                    pegi.writeWarning("Need 2 Render Textures for Post-Process");
                    if ("Fix".Click())
                    {
                        _renderTextures = new RenderTexture[2];
                    }
                }
                else
                {
                    "Render Textures".edit_Array(ref _renderTextures).nl();
                }
            }
            else
            {
                "Custom Render Texture".edit(ref _effetBuffer).nl();
            }

            if ("Debug".foldout(ref _showDependencies).nl())
            {
                if (copyShader)
                {
                    "Copy Shader. Supported={0} | Pass Count = {1}".F(copyShader.isSupported, copyShader.passCount).nl();
                }


                "State".editEnum(ref step).nl();

                "Buffers".write();

                if ("Swap".Click())
                {
                    Swap();
                }

                if ("Screen->Buffer".Click())
                {
                    BlitRt(_screenTexture, copyShader);
                }

                if ("Blur".Click())
                {
                    BlitRt(postProcessShader);
                }

                pegi.nl();

                "Screen Texture (Optional):".edit(ref _screenTexture).nl();

                if (_screenTexture)
                {
                    _screenTexture.write(250, alphaBlend: false);
                }

                pegi.nl();

                if (_effectMaterialInstance)
                {
                    "Temp Mat Instance".write(_effectMaterialInstance);
                    if (icon.Clear.Click().nl())
                    {
                        _effectMaterialInstance.DestroyWhateverUnityObject();
                        _effectMaterialInstance = null;
                    }
                }
                else
                {
                    "Material (Optional)".edit(ref materialPrototype).nl(ref changed);
                }


                if (!IsUsingCrt)
                {
                    if (!_renderTextures.IsNullOrEmpty())
                    {
                        "Main Texture: {0}".F(MainTexture).nl();

                        MainTexture.write(250, alphaBlend: false);
                        pegi.nl();

                        "Previous Texture: {0}".F(PreviousTexture).nl();
                        PreviousTexture.write(250, alphaBlend: false);
                        pegi.nl();
                    }
                }
                else
                {
                    _effetBuffer.write(250, alphaBlend: false);
                    pegi.nl();
                }
            }


            return(changed);
        }
Ejemplo n.º 2
0
        public bool Inspect()
        {
            var changed = pegi.toggleDefaultInspector(this).nl();

            if (!MyCamera)
            {
                "No Camera Detected on this Game Object. I need camera".writeWarning();
                if ("Try Find".Click())
                {
                    MyCamera = gameObject.GetComponent <Camera>();
                }

                pegi.nl();
            }

            "Post Process Method".editEnum(ref postProcessMethod);

            if ("Request Update".Click().nl())
            {
                RequestUpdate();
            }

            if (postProcessMethod == PostProcessMethod.CustomRenderTexture && !effetBuffer)
            {
                pegi.writeWarning("Custom render texture not assigned");

                pegi.nl();

                "Effect Buffer".edit(ref effetBuffer).nl();
            }

            if ("Config".foldout(ref _showDependencies).nl())
            {
                "Allow Scren Grab To Rt".toggleIcon(ref allowScreenGrabToRt).nl();

                if (allowScreenGrabToRt)
                {
                    "Use Second Buffer For Screen Read".toggleIcon(ref useSecondBufferForRenderTextureScreenGrab);

                    pegi.FullWindow.DocumentationClickOpen("If you are expecting to make a Screen Grab while screen grab is showing on a screen, enable this." +
                                                           " Same Texture can't be read from and written to at the same time. Black screen or other will show.");
                }

                pegi.nl();

                if ("Mouse Position to shader".toggleIcon(ref mousePositionToShader, hideTextWhenTrue: true))
                {
                    UseMousePosition.Enabled = mousePositionToShader;
                }

                if (mousePositionToShader)
                {
                    mousePosition.ToString().write_ForCopy();
                }

                pegi.nl();

                "Screen".edit(ref _screenReadTexture2D).nl();

                "Copy shader".edit(ref copyShader).nl();

                "Post-Process".edit(ref postProcessShader).nl();

                "Blur Iterations:".edit(ref postProcessIteration).nl();

                if (!IsUsingCrt)
                {
                    if (_renderTextures.Count < 2)
                    {
                        pegi.writeWarning("Need 2 Render Textures for Post-Process");
                    }

                    "Render Textures".edit_List_UObj(ref _renderTextures).nl();
                }
                else
                {
                    "Custom Render Texture".edit(ref effetBuffer).nl();
                }
            }

            if ("Debug".foldout(ref _showDebug).nl())
            {
                if (copyShader)
                {
                    "Copy Shader. Supported={0} | Pass Count = {1}".F(copyShader.isSupported, copyShader.passCount).nl();
                }

                "State".editEnum(ref step).nl();

                "Buffers".write();

                if ("Swap".Click())
                {
                    Swap();
                }

                if ("Screen Capture -> Effect Buffer".Click())
                {
                    BlitToEffectBuffer(CurrentScreenReadTexture, copyShader);
                }

                if ("Blur".Click())
                {
                    BlitBetweenEffectBuffers(postProcessShader);
                }

                pegi.nl();

                "Screen Texture (Optional):".edit(ref _screenReadTexture2D).nl();

                if (_screenReadTexture2D)
                {
                    _screenReadTexture2D.write(250, alphaBlend: false);
                }

                pegi.nl();

                if (_effectMaterialInstance)
                {
                    "Temp Mat Instance".write(_effectMaterialInstance);
                    if (icon.Clear.Click().nl())
                    {
                        _effectMaterialInstance.DestroyWhateverUnityObject();
                        _effectMaterialInstance = null;
                    }
                }
                else
                {
                    "Material (Optional)".edit(ref materialPrototype).nl(ref changed);
                }

                if (!IsUsingCrt)
                {
                    if (!_renderTextures.IsNullOrEmpty())
                    {
                        "Main Texture: {0}".F(MainEffectTexture).nl();

                        MainEffectTexture.write(250, alphaBlend: false);
                        pegi.nl();

                        "Previous Texture: {0}".F(PreviousTexture).nl();
                        PreviousTexture.write(250, alphaBlend: false);
                        pegi.nl();
                    }
                }
                else
                {
                    effetBuffer.write(250, alphaBlend: false);
                    pegi.nl();
                }
            }

            return(changed);
        }