Exemplo n.º 1
0
 void OnDeserialized()
 {
     this.CreateImageShaderFromPass();
     //instead of creating a gammaLUT we get the one that was saved.
     this.gammaLut = this.GetComponent <GammaLUT>();
     this.gammaLut.SetTargetMat(this.imageShaderMat);
 }
        private void propagateCameraChanges()
        {
            if (this.myCameras.Length <= 1)
            {
                return;
            }

            GameObject        original = this.myCameras[0];
            GammaLUT          glut     = original.GetComponent <GammaLUT>();
            ImageShaderScript iss      = original.GetComponent <ImageShaderScript>();
            FullScreenEffects fSFX     = original.GetComponent <FullScreenEffects>();

            for (int i = 1; i < this.myCameras.Length; i++)
            {
                GameObject other = this.myCameras[i];
                if (glut != null)
                {
                    GammaLUT glut2 = other.GetComponent <GammaLUT>();
                    glut2.brightness = glut.brightness;
                    glut2.contrast   = glut.contrast;
                    glut2.gamma      = glut.gamma;
                }
                if (iss != null)
                {
                    ImageShaderScript iss2 = other.GetComponent <ImageShaderScript>();
                    iss2.HSL = iss.HSL;
                }
                else if (fSFX != null)
                {
                    Color             hsv   = fSFX.mat.GetColor("_HsvAdjust");
                    FullScreenEffects fSFX2 = other.GetComponent <FullScreenEffects>();
                    fSFX2.mat.SetColor("_HsvAdjust", hsv);
                }
            }
        }
        void OnDeserialized()
        {
            this.gammaLUTScript = this.GetComponent<GammaLUT>();
            this.gammaLUTScript.SetTargetMat(mat);

            //Hack to disable/re-enable this script after deserialization.
            //Required because OnRenderImage won't get called unless you do this...
            this.enabled = false;
            this.enabled = true;
        }
        // Use this for initialization
        void Awake()
        {
            this.mat = new Material(Shader.Find("iCinema/FullScreenCameraShader"));
            if (LevelSerializer.isBeingObjectTreeLoaded(this.gameObject)) {
            return;
            }

            this.gammaLUTScript = gameObject.AddComponent<GammaLUT>();
            this.gammaLUTScript.SetTargetMat(mat);
        }
Exemplo n.º 5
0
        void OnDeserialized()
        {
            this.gammaLUTScript = this.GetComponent <GammaLUT>();
            this.gammaLUTScript.SetTargetMat(mat);

            //Hack to disable/re-enable this script after deserialization.
            //Required because OnRenderImage won't get called unless you do this...
            this.enabled = false;
            this.enabled = true;
        }
Exemplo n.º 6
0
        // Use this for initialization
        void Awake()
        {
            this.mat = new Material(Shader.Find("iCinema/FullScreenCameraShader"));
            if (LevelSerializer.isBeingObjectTreeLoaded(this.gameObject))
            {
                return;
            }

            this.gammaLUTScript = gameObject.AddComponent <GammaLUT>();
            this.gammaLUTScript.SetTargetMat(mat);
        }
Exemplo n.º 7
0
        protected override void DoAwake()
        {
            if (LevelSerializer.isBeingObjectTreeLoaded(this.gameObject))
            {
                return;         //Assign gammalut after loading
            }
            // ImageShader needs a GammaLUT for Brightness/Contrast/Gamma to work
            // Use existing GammaLUT if it exists...
            this.gammaLut = this.gameObject.GetComponent <GammaLUT>();

            // ...or create one
            if (this.gammaLut == null)
            {
                this.gammaLut = this.gameObject.AddComponent <GammaLUT>();
            }
        }
        public void doDrawGUI()
        {
            if (myCameras == null)
            {
                myCameras = getDebugCamera.getDebugPanelCameras();
            }
            GameObject mc;

            if (myCameras.Length == 0)
            {
                mc = null;
            }
            else
            {
                mc = myCameras[0];
            }

            FullScreenEffects fSFX = null;

            if (mc != null)
            {
                fSFX = mc.GetComponent <FullScreenEffects>();
            }

            //#########################################################
            //# Refresh Camera button                                 #
            //#########################################################

            if (GUILayout.Button("Refresh Camera Ref"))
            {
                myCameras = getDebugCamera.getDebugPanelCameras();
            }


            //#########################################################
            //# Ambient Light Colour Picker                           #
            //#########################################################
            Color ambiColour = RenderSettings.ambientLight;

            ambiColour = ambientLightColour.DrawGUI(ambiColour);
            RenderSettings.ambientLight = ambiColour;


            //#####################################################
            //# Gamma, brightness, contrast                       #
            //#####################################################
            GammaLUT glut = mc.GetComponent <GammaLUT>();

            if (glut != null && glut.enabled)
            {
                glut.DrawDebugGUI();
            }
            else
            {
                GUILayout.Label("Main Camera does not have \nGammaLUT attached/enabled");
            }

            //#####################################################
            //# Hue, Saturation, Value                            #
            //#####################################################
            ImageShaderScript iss = mc.GetComponent <ImageShaderScript>();

            if (iss != null)
            {
                iss.DrawDebugGUI();
            }
            else if (fSFX != null && fSFX.enabled)
            {
                if (fSFX.mat != null && fSFX.mat.HasProperty("_HsvAdjust"))
                {
                    Color hsv = fSFX.mat.GetColor("_HsvAdjust");
                    hsv = hsvColour.DrawGUI(hsv);
                    fSFX.mat.SetColor("_HsvAdjust", hsv);
                }
                else
                {
                    GUILayout.Label("Warning: No _HsvAdjust in camera's shader");
                }
            }
            //#########################################################
            //# Grid, blend                                           #
            //#########################################################
            foreach (icDebugGUI icdg in otherGlobals)
            {
                try {
                    icdg.DrawDebugGUI();
                } catch (NullReferenceException) {
                    //icdg script is disabled
                }
            }

            this.propagateCameraChanges();
        }
 void OnDeserialized()
 {
     this.CreateImageShaderFromPass();
     //instead of creating a gammaLUT we get the one that was saved.
     this.gammaLut = this.GetComponent<GammaLUT>();
     this.gammaLut.SetTargetMat(this.imageShaderMat);
 }
        protected override void DoAwake()
        {
            if (LevelSerializer.isBeingObjectTreeLoaded(this.gameObject)) {
            return;	//Assign gammalut after loading
            }
            // ImageShader needs a GammaLUT for Brightness/Contrast/Gamma to work
            // Use existing GammaLUT if it exists...
            this.gammaLut = this.gameObject.GetComponent<GammaLUT>();

            // ...or create one
            if (this.gammaLut == null) {
            this.gammaLut = this.gameObject.AddComponent<GammaLUT>();
            }
        }