Example #1
0
        private void OnDrawGizmosSelected()
        {
            if (TargetSky == null)
            {
                TargetSky = GetComponent <mset.Sky>();
            }

            if (TriggerIsActive)
            {
                Color c = new Color(1.0f, 0.5f, 0.0f, 0.5f);
                Gizmos.color = c;
                Matrix4x4 mat = new Matrix4x4();
                mat = this.transform.localToWorldMatrix;

                Gizmos.matrix = mat;
                if (UnityEditor.Selection.activeGameObject == this.gameObject)
                {
                    Gizmos.DrawCube(TriggerDimensions.center, -TriggerDimensions.size);
                    Gizmos.DrawCube(TriggerDimensions.center, TriggerDimensions.size);
                }
                c.a          = 1f;
                Gizmos.color = c;
                Gizmos.DrawWireCube(TriggerDimensions.center, TriggerDimensions.size);
            }
            //UnityEditor.SceneView.onSceneGUIDelegate();
        }
Example #2
0
 public void BlendToGlobalSky(mset.Sky nusky)
 {
     if (HasLocalSky)
     {
         BlendToSky(nusky);
     }
     HasLocalSky = false;
 }
Example #3
0
 //call once
 public void SnapToSky(mset.Sky nusky)
 {
     if (nusky == null)
     {
         return;
     }
     CurrentSky = PreviousSky = nusky;
     blendTimer = 0f;
 }
Example #4
0
 public void SnapToSky(mset.Sky nusky)
 {
     if (nusky == null)
     {
         return;
     }
     if (BindType == AnchorBindType.TargetSky)
     {
         return;
     }
     Blender.SnapToSky(nusky);
     HasLocalSky = true;
 }
Example #5
0
 public void BlendToSky(mset.Sky nusky)
 {
     if (nusky == null)
     {
         return;
     }
     //ignore if swaps if we are glued to a specific sky
     if (BindType == AnchorBindType.TargetSky)
     {
         return;
     }
     Blender.BlendToSky(nusky);
     HasLocalSky = true;
 }
Example #6
0
 public void BlendToGlobalSky(mset.Sky next, float blendTime, float skipTime)
 {
     if (next != null)
     {
         nextSky = next;
                         #if UNITY_EDITOR
         nextBlendTime = Application.isPlaying ? blendTime : 0f;
                         #else
         nextBlendTime = blendTime;
                         #endif
         nextSkipTime = skipTime;
     }
     //??? Harmless but weird? where did this come from?
     _GlobalSky = nextSky;
 }
Example #7
0
        //delayed setup for blending between global skies
        private void HandleGlobalSkyChange()
        {
            //Switch skies
            if (nextSky != null)
            {
                ResetLightBlend();
                if (BlendingSupport && nextBlendTime > 0f)
                {
                    //BLEND
                    mset.Sky currSky = GlobalBlender.CurrentSky;
                    GlobalBlender.BlendTime = nextBlendTime;
                    GlobalBlender.BlendToSky(nextSky);

                    mset.Sky[] allSkies = GameObject.FindObjectsOfType <mset.Sky>();
                    foreach (mset.Sky sky in allSkies)
                    {
                        sky.ToggleChildLights(false);
                    }
                    GlobalBlender.SkipTime(nextSkipTime);
                    StartLightBlend(currSky, nextSky);
                }
                else
                {
                    //SNAP
                    GlobalBlender.SnapToSky(nextSky);
                    nextSky.Apply(0);
                    nextSky.Apply(1);
                    mset.Sky[] allSkies = GameObject.FindObjectsOfType <mset.Sky>();
                    foreach (mset.Sky sky in allSkies)
                    {
                        sky.ToggleChildLights(false);
                    }
                    nextSky.ToggleChildLights(true);
                }

                _GlobalSky = nextSky;
                nextSky    = null;

                if (!Application.isPlaying)
                {
                    this.EditorApplySkies(true);
                }
            }

            //Update
            UpdateLightBlend();
        }
Example #8
0
        // Use this for initialization
        void Start()
        {
            //make sure the default state for all Skyshop keywords is off
            mset.Sky.ScrubGlobalKeywords();

                        #if !USE_PROPERTY_BLOCKS
            //HACK: Without property blocks, shared materials may have gotten edited and need to be scrubbed here
            Renderer[] rends = FindObjectsOfType <Renderer>() as Renderer[];
            if (rends != null)
            {
                foreach (Renderer r in rends)
                {
                    if (r != null && r.sharedMaterials != null)
                    {
                        mset.Sky.ScrubKeywords(r.sharedMaterials);
                    }
                }
            }
                        #endif

            //force some setters and getters to run
            _SkyboxMaterial   = SkyboxMaterial;                 //get
            ShowSkybox        = _ShowSkybox;                    //set
            BlendingSupport   = _BlendingSupport;               //set
            ProjectionSupport = _ProjectionSupport;             //set

            if (_GlobalSky == null)
            {
                _GlobalSky = gameObject.GetComponent <mset.Sky>();
            }
            if (_GlobalSky == null)
            {
                _GlobalSky = GameObject.FindObjectOfType <mset.Sky>();
            }
            GlobalBlender.SnapToSky(_GlobalSky);
        }
Example #9
0
        private void StartLightBlend(mset.Sky prev, mset.Sky next)
        {
            //get a list of lights and intensities from the sky we're blending away from
            prevLights      = null;
            prevIntensities = null;
            if (prev)
            {
                prevLights = prev.GetComponentsInChildren <Light>();
                if (prevLights != null && prevLights.Length > 0)
                {
                    prevIntensities = new float[prevLights.Length];
                    for (int i = 0; i < prevLights.Length; ++i)
                    {
                        prevLights[i].enabled = true;
                        prevIntensities[i]    = prevLights[i].intensity;
                    }
                }
            }

            nextLights      = null;
            nextIntensities = null;
            if (next)
            {
                nextLights = next.GetComponentsInChildren <Light>();
                if (nextLights != null && nextLights.Length > 0)
                {
                    nextIntensities = new float[nextLights.Length];
                    for (int i = 0; i < nextLights.Length; ++i)
                    {
                        nextIntensities[i]      = nextLights[i].intensity;
                        nextLights[i].enabled   = true;
                        nextLights[i].intensity = 0f;
                    }
                }
            }
        }
Example #10
0
 //call once
 public void BlendToSky(mset.Sky nusky)
 {
     if (nusky == null)
     {
         return;
     }
     if (CurrentSky != nusky)
     {
         //do some blending
         if (CurrentSky == null)
         {
             //nothing to blend from
             PreviousSky = CurrentSky = nusky;
             blendTimer  = 0f;
         }
         else
         {
             PreviousSky      = CurrentSky;
             CurrentSky       = nusky;
             currentBlendTime = blendTime;
             blendTimer       = currentBlendTime;
         }
     }
 }
Example #11
0
 void Awake()
 {
     TargetSky = GetComponent <mset.Sky>();
 }
        public void OnSceneGUI()
        {
            myapp = this.target as mset.SkyApplicator;

            if (mset.SkyApplicatorInspector.triggerEdit && myapp.TriggerIsActive)
            {
                mset.Sky sky    = myapp.GetComponent <mset.Sky>();
                Vector3  campos = Vector3.zero;
                if (Camera.current != null)
                {
                    campos = Camera.current.transform.position;
                }

                Vector3 skyScale = sky.transform.lossyScale;
                if (skyScale.x == 0)
                {
                    skyScale.x = 0.001f;
                }
                if (skyScale.y == 0)
                {
                    skyScale.y = 0.001f;
                }
                if (skyScale.z == 0)
                {
                    skyScale.z = 0.001f;
                }

                xscale = x2scale = myapp.TriggerDimensions.size.x * 0.5f * skyScale.x;
                yscale = y2scale = myapp.TriggerDimensions.size.y * 0.5f * skyScale.y;
                zscale = z2scale = myapp.TriggerDimensions.size.z * 0.5f * skyScale.z;

                Handles.color = new Color(1.0f, 0.5f, 0.0f, 0.9f);
                Vector3 dotpos;

                Vector3 boxcenter = sky.transform.localToWorldMatrix.MultiplyPoint(myapp.TriggerDimensions.center);

                dotpos = xscale * sky.transform.right + boxcenter;
                dotpos = Handles.Slider(dotpos, sky.transform.right, (dotpos - campos).magnitude / 10.0f, Handles.ArrowCap, 0.05f);
                xscale = (dotpos - boxcenter).magnitude;

                dotpos  = (x2scale * -sky.transform.right) + boxcenter;
                dotpos  = Handles.Slider(dotpos, -sky.transform.right, (dotpos - campos).magnitude / 10.0f, Handles.ArrowCap, 0.05f);
                x2scale = (dotpos - boxcenter).magnitude;

                dotpos = yscale * sky.transform.up + boxcenter;
                dotpos = Handles.Slider(dotpos, sky.transform.up, (dotpos - campos).magnitude / 10.0f, Handles.ArrowCap, 0.05f);
                yscale = (dotpos - boxcenter).magnitude;

                dotpos  = y2scale * -sky.transform.up + boxcenter;
                dotpos  = Handles.Slider(dotpos, -sky.transform.up, (dotpos - campos).magnitude / 10.0f, Handles.ArrowCap, 0.05f);
                y2scale = (dotpos - boxcenter).magnitude;

                dotpos = zscale * sky.transform.forward + boxcenter;
                dotpos = Handles.Slider(dotpos, sky.transform.forward, (dotpos - campos).magnitude / 10.0f, Handles.ArrowCap, 0.05f);
                zscale = (dotpos - boxcenter).magnitude;

                dotpos  = z2scale * -sky.transform.forward + boxcenter;
                dotpos  = Handles.Slider(dotpos, -sky.transform.forward, (dotpos - campos).magnitude / 10.0f, Handles.ArrowCap, 0.05f);
                z2scale = (dotpos - boxcenter).magnitude;

                Bounds dim = myapp.TriggerDimensions;

                float xposDiff = dim.size.x - (xscale / skyScale.x) * 2 - (dim.size.x - (x2scale / skyScale.x) * 2);
                float yposDiff = dim.size.y - (yscale / skyScale.y) * 2 - (dim.size.y - (y2scale / skyScale.y) * 2);
                float zposDiff = dim.size.z - (zscale / skyScale.z) * 2 - (dim.size.z - (z2scale / skyScale.z) * 2);

                dim.center += new Vector3(-xposDiff * 0.25f, -yposDiff * 0.25f, -zposDiff * 0.25f);
                dim.size    = new Vector3((xscale + x2scale) / skyScale.x, (yscale + y2scale) / skyScale.y, (zscale + z2scale) / skyScale.z);

                if (dim.center != myapp.TriggerDimensions.center || dim.size != myapp.TriggerDimensions.size)
                {
                    Undo.RecordObject(myapp, "Sky Trigger Resize");
                    myapp.TriggerDimensions = dim;

                    mset.SkyManager mgr = mset.SkyManager.Get();
                    if (mgr)
                    {
                        mgr.EditorUpdate(true);
                    }
                    EditorUtility.SetDirty(target);
                }

                //Hammer this for now
                myapp.HasChanged = true;
            }
        }
Example #13
0
		//call once
		public void SnapToSky(mset.Sky nusky) {
			if(nusky == null) return;
			CurrentSky = PreviousSky = nusky;
			blendTimer = 0f;
		}
Example #14
0
		//call once
		public void BlendToSky(mset.Sky nusky) {
			if(nusky == null) return;
			if(CurrentSky != nusky) {
				//do some blending
				if(CurrentSky == null) {
					//nothing to blend from
					PreviousSky = CurrentSky = nusky;
					blendTimer = 0f;
				}
				else {
					PreviousSky = CurrentSky;
					CurrentSky = nusky;
					currentBlendTime = blendTime;
					blendTimer = currentBlendTime;
				}
			}
		}
Example #15
0
        public void Apply(Renderer target)
        {
            // Binds IBL data, exposure, and a skybox texture globally or to a specific game object

            if (this.enabled && this.gameObject.activeInHierarchy)
            {
                //certain global parameters are only bound on a global basis
                if (target == null)
                {
                    //turn off previously bound sky
                    if (mset.Sky.activeSky != null)
                    {
                        mset.Sky.activeSky.UnApply();
                    }
                    mset.Sky.activeSky = this;
                    ToggleChildLights(true);
                    Shader.SetGlobalFloat("_SkyID", skyID);

                    ApplySkybox();
                    //toggle between linear-space (gamma-corrected) and gamma-space (uncorrected) shader permutations
                    Shader.DisableKeyword("MARMO_GAMMA");
                    Shader.DisableKeyword("MARMO_LINEAR");
                    if (linearSpace)
                    {
                        Shader.EnableKeyword("MARMO_LINEAR");
                    }
                    else
                    {
                        Shader.EnableKeyword("MARMO_GAMMA");
                    }

                    //box projection requires Unity 4.3+
                                #if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2)
                    //enable box projection (on the shaders that support it) only if the bound sky has dimensions
                    Shader.DisableKeyword("MARMO_BOX_PROJECTION_OFF");
                    Shader.DisableKeyword("MARMO_BOX_PROJECTION");
                    if (hasDimensions)
                    {
                        Shader.EnableKeyword("MARMO_BOX_PROJECTION");
                    }
                    else
                    {
                        Shader.EnableKeyword("MARMO_BOX_PROJECTION_OFF");
                    }
                                #endif
                }
                else
                {
                    Material mat = getTargetMaterial(target);
                    mat.SetFloat("_SkyID", skyID);
                    //per-material keywords were introduced in Unity 4.3
                                #if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2)
                    //enable box projection only if the bound sky has dimensions
                    mat.DisableKeyword("MARMO_BOX_PROJECTION_OFF");
                    mat.DisableKeyword("MARMO_BOX_PROJECTION");
                    if (hasDimensions)
                    {
                        mat.EnableKeyword("MARMO_BOX_PROJECTION");
                    }
                    else
                    {
                        mat.EnableKeyword("MARMO_BOX_PROJECTION_OFF");
                    }
                                #endif
                }

                //upload the sky transform to the shader
                ApplySkyTransform(target);
                ApplyExposures(target);
                ApplyIBL(target);
            }
        }
Example #16
0
		void Awake() {
			TargetSky = GetComponent<mset.Sky>();
		}
Example #17
0
 public void BlendToGlobalSky(mset.Sky next)
 {
     BlendToGlobalSky(next, GlobalBlendTime, 0f);
 }
Example #18
0
        //	SerializedProperty damageProp;
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUI.changed = false;
            mset.SkyAnchor.AnchorBindType nubind = (mset.SkyAnchor.AnchorBindType)EditorGUILayout.EnumPopup(
                new GUIContent("Sky Bind Type", "Sky Bind Type -\n" + myanchor.BindType),
                (mset.SkyAnchor.AnchorBindType)myanchor.BindType,
                GUILayout.Width(300)
                );
            myanchor.HasChanged = myanchor.BindType != nubind;
            myanchor.BindType   = nubind;

            if (myanchor.BindType == mset.SkyAnchor.AnchorBindType.Center)
            {
                myanchor.HasChanged |= myanchor.transform.hasChanged;
            }
            else if (myanchor.BindType == mset.SkyAnchor.AnchorBindType.Offset)
            {
                Vector3 offset = EditorGUILayout.Vector3Field("Local Offset", myanchor.AnchorOffset);
                myanchor.HasChanged  |= !myanchor.AnchorOffset.Equals(offset);
                myanchor.AnchorOffset = offset;
            }
            else if (myanchor.BindType == mset.SkyAnchor.AnchorBindType.TargetTransform)
            {
                Transform targetT = (Transform)EditorGUILayout.ObjectField(myanchor.AnchorTransform, typeof(Transform), true);

                myanchor.HasChanged |= (targetT != myanchor.AnchorTransform);
                if (targetT)
                {
                    myanchor.HasChanged |= targetT.hasChanged;
                }
                myanchor.AnchorTransform = targetT;
            }
            else if (myanchor.BindType == SkyAnchor.AnchorBindType.TargetSky)             //sky bind
            {
                mset.Sky prevSky = myanchor.AnchorSky;
                //		myanchor.AnchorSky = (mset.Sky)EditorGUILayout.ObjectField(myanchor.AnchorSky, typeof(mset.Sky), true);
                skyPickMode = true;
                if (!skyPickMode)
                {
                    skyPickMode = GUILayout.Button("Pick Sky", GUILayout.Width(100));
                    if (skyPickMode)
                    {
                    }
                }
                else
                {
                    currentSkies = GameObject.FindObjectsOfType <mset.Sky>();
                    if (currentSkies != null && currentSkies.Length == 0)
                    {
                        GUILayout.Label("No Skies in Scene", GUILayout.Width(200));
                    }
                    else if (myanchor.AnchorSky == null)
                    {
                        foreach (mset.Sky _sky in currentSkies)
                        {
                            if (GUILayout.Button(_sky.transform.name, GUILayout.Width(200)))
                            {
                                myanchor.AnchorSky = _sky;
                            }
                        }
                    }
                    else
                    {
                        EditorGUILayout.ObjectField(myanchor.AnchorSky, typeof(mset.Sky), true, GUILayout.Width(200));
                        if (GUILayout.Button("Change", GUILayout.Width(150)))
                        {
                            myanchor.AnchorSky = null;
                        }
                    }
                }
                myanchor.HasChanged |= prevSky != myanchor.AnchorSky;
            }
            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
        }
Example #19
0
        public void renderProbeCallback(object data, bool probeIBL, GameObject selection)
        {
            int faceSize = (int)data;
            if( faceSize == -1 ) return;
            if( this.cube == null ) return;

            //when a sky is selected, use play-mode capture probe
            mset.SkyManager mgr = mset.SkyManager.Get();
            mset.Sky sky = null;
            if(Selection.activeGameObject) sky = Selection.activeGameObject.GetComponent<mset.Sky>();

            //send call through SkyManager and play-mode
            if(mgr && sky != null) {
                mset.Sky[] list = new mset.Sky[1];
                list[0] = sky;
                Probeshop.ProbeSkies(null, list, false, probeIBL, null);
            }
            //otherwise, if Unity Pro, use SkyProbe directly in editor
            /*else if(UnityEditorInternal.InternalEditorUtility.HasPro() && PlayerSettings.useDirect3D11) {
                SkyProbe probe = new SkyProbe();
                Cubemap targetCube = this.cube;

                //if( targetCube == null ) {
                //	targetCube = new Cubemap(faceSize, TextureFormat.ARGB32, this.mipmapped);
                //}
                probe.cubeRT = new RenderTexture(faceSize, faceSize, 24, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.sRGB);
                probe.cubeRT.isCubemap = true;
                probe.cubeRT.useMipMap = this.mipmapped;
                probe.cubeRT.generateMips = this.mipmapped;

                Transform at = Selection.activeTransform;
                if( at == null ) at = Camera.main.transform;
                if(selection != null)
                {
                    at = selection.transform;
                }
                probe.capture(targetCube, at.position, at.rotation, this.HDR, this.renderLinear, this.type == Type.SIM);

                SerializedObject srTarget = new SerializedObject(targetCube);
                mset.AssetUtil.setLinear(srTarget, false);
                updateInput(false);
                RenderTexture.DestroyImmediate(probe.cubeRT);
            }*/
            else {
                Debug.LogError("Sky Manager not found in the scene, it is required for probe capture.");
            }
        }
Example #20
0
		public void BlendToGlobalSky(mset.Sky next, float blendTime, float skipTime) {
			if(next != null) {
				nextSky = next;
				#if UNITY_EDITOR
				nextBlendTime = Application.isPlaying ? blendTime : 0f;
				#else
				nextBlendTime = blendTime;
				#endif
				nextSkipTime = skipTime;
			}
			//??? Harmless but weird? where did this come from?
			_GlobalSky = nextSky;
		}
Example #21
0
		// Use this for initialization
		void Start() {
			//make sure the default state for all Skyshop keywords is off
			mset.Sky.ScrubGlobalKeywords();

			#if !USE_PROPERTY_BLOCKS
			//HACK: Without property blocks, shared materials may have gotten edited and need to be scrubbed here
			Renderer[] rends = FindObjectsOfType<Renderer>() as Renderer[];
			if(rends != null) {
				foreach(Renderer r in rends) {
					if(r != null && r.sharedMaterials != null) mset.Sky.ScrubKeywords(r.sharedMaterials);
				}
			}
			#endif

			//force some setters and getters to run
			_SkyboxMaterial = SkyboxMaterial;		//get
			ShowSkybox = _ShowSkybox;				//set
			BlendingSupport = _BlendingSupport; 	//set
			ProjectionSupport = _ProjectionSupport; //set

			if(_GlobalSky == null) _GlobalSky = gameObject.GetComponent<mset.Sky>();
			if(_GlobalSky == null) _GlobalSky = GameObject.FindObjectOfType<mset.Sky>();
			GlobalBlender.SnapToSky(_GlobalSky);
		}
Example #22
0
		//delayed setup for blending between global skies
		private void HandleGlobalSkyChange() {
			//Switch skies
			if( nextSky != null ) {
				ResetLightBlend();
				if( BlendingSupport && nextBlendTime > 0f ) {
					//BLEND
					mset.Sky currSky = GlobalBlender.CurrentSky;
					GlobalBlender.BlendTime = nextBlendTime;
					GlobalBlender.BlendToSky(nextSky);

					mset.Sky[] allSkies = GameObject.FindObjectsOfType<mset.Sky>();
					foreach(mset.Sky sky in allSkies) {
						sky.ToggleChildLights(false);
					}
					GlobalBlender.SkipTime(nextSkipTime);					
					StartLightBlend(currSky, nextSky);
				} else {
					//SNAP
					GlobalBlender.SnapToSky(nextSky);
					nextSky.Apply(0);
					nextSky.Apply(1);
					mset.Sky[] allSkies = GameObject.FindObjectsOfType<mset.Sky>();
					foreach(mset.Sky sky in allSkies) {
						sky.ToggleChildLights(false);
					}
					nextSky.ToggleChildLights(true);
				}

				_GlobalSky = nextSky;
				nextSky = null;

				if(!Application.isPlaying) {
					this.EditorApplySkies(true);
				}
			}

			//Update
			UpdateLightBlend();
		}
Example #23
0
        public void Apply(Renderer target)
        {
            // Binds IBL data, exposure, and a skybox texture globally or to a specific game object

            if(this.enabled && this.gameObject.activeInHierarchy) {
                //certain global parameters are only bound on a global basis
                if(target == null) {
                    //turn off previously bound sky
                    if(mset.Sky.activeSky != null) mset.Sky.activeSky.UnApply();
                    mset.Sky.activeSky = this;
                    ToggleChildLights(true);
                    Shader.SetGlobalFloat("_SkyID", skyID);

                    ApplySkybox();
                    //toggle between linear-space (gamma-corrected) and gamma-space (uncorrected) shader permutations
                    Shader.DisableKeyword("MARMO_GAMMA");
                    Shader.DisableKeyword("MARMO_LINEAR");
                    if(linearSpace) Shader.EnableKeyword("MARMO_LINEAR");
                    else 			Shader.EnableKeyword("MARMO_GAMMA");

                //box projection requires Unity 4.3+
                #if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2)
                    //enable box projection (on the shaders that support it) only if the bound sky has dimensions
                    Shader.DisableKeyword("MARMO_BOX_PROJECTION_OFF");
                    Shader.DisableKeyword("MARMO_BOX_PROJECTION");
                    if(hasDimensions)	Shader.EnableKeyword("MARMO_BOX_PROJECTION");
                    else 				Shader.EnableKeyword("MARMO_BOX_PROJECTION_OFF");
                #endif
                } else {
                    Material mat = getTargetMaterial(target);
                    mat.SetFloat("_SkyID", skyID);
                //per-material keywords were introduced in Unity 4.3
                #if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2)
                    //enable box projection only if the bound sky has dimensions
                    mat.DisableKeyword("MARMO_BOX_PROJECTION_OFF");
                    mat.DisableKeyword("MARMO_BOX_PROJECTION");
                    if(hasDimensions)	mat.EnableKeyword("MARMO_BOX_PROJECTION");
                    else 				mat.EnableKeyword("MARMO_BOX_PROJECTION_OFF");
                #endif
                }

                //upload the sky transform to the shader
                ApplySkyTransform(target);
                ApplyExposures(target);
                ApplyIBL(target);
            }
        }
Example #24
0
        //Probes all skies in list of skies, and all sky components in list of game objects. Either list can be null when convenient.
        //If probeAll is false, only skies marked as "Is Probe" are considered
        public void ProbeSkies(GameObject[] objects, mset.Sky[] skies, bool probeAll, bool probeIBL)
        {
            int             skipCount = 0;
            List <mset.Sky> probes    = new List <mset.Sky>();
            string          notProbes = "";

            if (skies != null)
            {
                foreach (mset.Sky sky in skies)
                {
                    if (sky)
                    {
                        if (probeAll || sky.IsProbe)
                        {
                            probes.Add(sky);
                        }
                        else
                        {
                            skipCount++;
                            notProbes += sky.name + "\n";
                        }
                    }
                }
            }
            if (objects != null)
            {
                foreach (GameObject obj in objects)
                {
                    mset.Sky sky = obj.GetComponent <mset.Sky>();
                    if (sky)
                    {
                        if (probeAll || sky.IsProbe)
                        {
                            probes.Add(sky);
                        }
                        else
                        {
                            skipCount++;
                            notProbes += sky.name + "\n";
                        }
                    }
                }
            }
            if (skipCount > 0)
            {
                                #if UNITY_EDITOR
                bool k = UnityEditor.EditorUtility.DisplayDialog(skipCount + " skies not probes", "The following skies are not marked as probes and will be skipped:\n" + notProbes, "Ok", "Cancel");
                if (!k)
                {
                    return;
                }
                                #endif
            }
            if (probes.Count > 0)
            {
                this.ProbeExposures = probeIBL ? Vector4.one : Vector4.zero;
                this.SkiesToProbe   = new mset.Sky[probes.Count];
                for (int i = 0; i < probes.Count; ++i)
                {
                    this.SkiesToProbe[i] = probes[i];
                }
            }
        }
Example #25
0
		private void OnDrawGizmosSelected() {
			if(TargetSky == null) TargetSky = GetComponent<mset.Sky>();

			if(TriggerIsActive) {
				Color c = new Color(1.0f, 0.5f, 0.0f, 0.5f);
				Gizmos.color = c;
				Matrix4x4 mat = new Matrix4x4();
				mat = this.transform.localToWorldMatrix;

				Gizmos.matrix = mat;
				if(UnityEditor.Selection.activeGameObject == this.gameObject) {
					Gizmos.DrawCube(TriggerDimensions.center, -TriggerDimensions.size);
					Gizmos.DrawCube(TriggerDimensions.center, TriggerDimensions.size);
				}
				c.a = 1f;
				Gizmos.color = c;
				Gizmos.DrawWireCube(TriggerDimensions.center, TriggerDimensions.size);
			}
			//UnityEditor.SceneView.onSceneGUIDelegate();
		}
Example #26
0
 public void BlendToGlobalSky(mset.Sky next, float blendTime)
 {
     BlendToGlobalSky(next, blendTime, 0f);
 }
Example #27
0
 public void SnapToGlobalSky(mset.Sky nusky)
 {
     SnapToSky(nusky);
     HasLocalSky = false;
 }