Esempio n. 1
0
 private void Start()
 {
     defaultFog = RenderSettings.fog;
     defaultFogColor = RenderSettings.fogColor;
     defaultFogDensity = RenderSettings.fogDensity;
     defaultFogMod = RenderSettings.fogMode;
 }
Esempio n. 2
0
        //------------------------------------------------------------------------------------------------------------------
        private void SetWeatherType_1()
        {
            this.m_ambientEquatorColor = new Color(1.0f, 1.0f, 1.0f);
            this.m_ambientGroundColor  = new Color(1.0f, 1.0f, 1.0f);
            this.m_ambientIntensity    = 1.0f;
            this.m_ambientLight        = new Color(1.0f, 1.0f, 1.0f);
            this.m_ambientMode         = AmbientMode.Skybox;
            //this.m_ambientProbe = SphericalHarmonicsL2;
            this.m_ambientSkyColor             = new Color(1.0f, 1.0f, 1.0f);
            this.m_customReflection            = null;
            this.m_defaultReflectionMode       = DefaultReflectionMode.Skybox;
            this.m_defaultReflectionResolution = 128;
            this.m_flareFadeSpeed      = 3.0f;
            this.m_flareStrength       = 1.0f;
            this.m_fog                 = true;
            this.m_fogColor            = new Color(0.5f, 0.5f, 0.5f);
            this.m_fogDensity          = 0.01f;
            this.m_fogEndDistance      = 300.0f;
            this.m_fogMode             = FogMode.Linear;
            this.m_fogStartDistance    = 0;
            this.m_haloStrength        = 0.5f;
            this.m_reflectionBounces   = 1;
            this.m_reflectionIntensity = 1.0f;

            Material skyboxMaterial = null;

            this.m_skybox = skyboxMaterial;
        }
Esempio n. 3
0
        public GameObject fpc;              // firstPersonController

        // Use this for initialization
        void Start()
        {
            _firstPersonController = GetComponent <FirstPersonController>();

            _characterController = GetComponent <CharacterController>();

            _fogColorWater = new Color(0.2f, 0.65f, 0.75f, 0.5f);

            Transform fpChar = transform.FindChild("FirstPersonCharacter");

            _blur = fpChar.GetComponent <Blur>();

            _camera = fpChar.GetComponent <Camera>();

            // Default values for FirstPersonController on start
            _defWalkspeed         = WalkSpeed;
            _defRunspeed          = RunSpeed;
            _defJumpspeed         = JumpSpeed;
            _defGravityMultiplier = GravityMultiplier;

            _defFogMode    = RenderSettings.fogMode;
            _defFogDensity = RenderSettings.fogDensity;
            _defFogColor   = RenderSettings.fogColor;
            _defFogEnabled = RenderSettings.fog;

            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
        }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        if (trans.position.y < wysokosc)
        {
            //zapamietywanie domyslnych ustawien mgly
            TMPfog         = RenderSettings.fog;
            TMPkolorMgly   = RenderSettings.fogColor;
            TMPgestoscMgly = RenderSettings.fogDensity;
            TMPtrybMgly    = RenderSettings.fogMode;
            TMPstartMgly   = RenderSettings.fogStartDistance;
            TMPkoniecMgly  = RenderSettings.fogEndDistance;

            //nadanie nowych ustawien mgly
            RenderSettings.fog              = fog;
            RenderSettings.fogColor         = kolorMgly;
            RenderSettings.fogDensity       = gestoscMgly;
            RenderSettings.fogMode          = trybMgly;
            RenderSettings.fogStartDistance = startMgly;
            RenderSettings.fogEndDistance   = koniecMgly;
        }
        else
        {
            //przywracanie domyslnych ustawien mgly
            RenderSettings.fog              = TMPfog;
            RenderSettings.fogColor         = TMPkolorMgly;
            RenderSettings.fogDensity       = TMPgestoscMgly;
            RenderSettings.fogMode          = TMPtrybMgly;
            RenderSettings.fogStartDistance = TMPstartMgly;
            RenderSettings.fogEndDistance   = TMPkoniecMgly;
        }
    }
Esempio n. 5
0
 void Update()
 {
     // if it's underwater...
     if (curWater && Camera.main.transform.position.y < curWater.transform.position.y + 5f)
     {
         Debug.Log("if test to go under water");
         if (!underwater)
         { // turn on underwater effect only once
             Debug.Log("going underwater ");
             oldFog                    = RenderSettings.fog;
             oldMode                   = RenderSettings.fogMode;
             oldDens                   = RenderSettings.fogDensity;
             oldColor                  = RenderSettings.fogColor;
             RenderSettings.fog        = true;
             RenderSettings.fogMode    = FogMode.Exponential;
             RenderSettings.fogDensity = underwaterDens;
             RenderSettings.fogColor   = underwaterColor;
             underwater                = true;
         }
     }
     else // but if it's not underwater...
     {
         Debug.Log("if test to leave water");
     }
     if (underwater)
     { // turn off underwater effect, if any
         Debug.Log("leaving water ");
         RenderSettings.fog        = oldFog;
         RenderSettings.fogMode    = oldMode;
         RenderSettings.fogDensity = oldDens;
         RenderSettings.fogColor   = oldColor;
         underwater = false;
     }
 }
Esempio n. 6
0
        public override void PopulateCommandBuffer(CommandBuffer cb)
        {
            FogModel.Settings settings = base.model.settings;
            Material          mat      = base.context.materialFactory.Get("Hidden/Post FX/Fog");

            mat.shaderKeywords = null;
            mat.SetColor(Uniforms._FogColor, RenderSettings.fogColor);
            mat.SetFloat(Uniforms._Density, RenderSettings.fogDensity);
            mat.SetFloat(Uniforms._Start, RenderSettings.fogStartDistance);
            mat.SetFloat(Uniforms._End, RenderSettings.fogEndDistance);
            FogMode fogMode = RenderSettings.fogMode;

            if (fogMode == FogMode.Linear)
            {
                mat.EnableKeyword("FOG_LINEAR");
            }
            else if (fogMode == FogMode.Exponential)
            {
                mat.EnableKeyword("FOG_EXP");
            }
            else if (fogMode == FogMode.ExponentialSquared)
            {
                mat.EnableKeyword("FOG_EXP2");
            }
            RenderTextureFormat format = !base.context.isHdr ? RenderTextureFormat.Default : RenderTextureFormat.DefaultHDR;

            cb.GetTemporaryRT(Uniforms._TempRT, base.context.width, base.context.height, 0x18, FilterMode.Bilinear, format);
            cb.Blit(2, Uniforms._TempRT);
            cb.Blit(Uniforms._TempRT, 2, mat, !settings.excludeSkybox ? 0 : 1);
            cb.ReleaseTemporaryRT(Uniforms._TempRT);
        }
        //private void UpdateWidget()
        //{
        //    ambientLight = RenderSettings.ambientLight;
        //    ambientEquatorColor = RenderSettings.ambientEquatorColor;
        //    ambientGroundColor = RenderSettings.ambientGroundColor;
        //    ambientSkyColor = RenderSettings.ambientSkyColor;
        //    ambientIntensity = RenderSettings.ambientIntensity;

        //    ambientMode = RenderSettings.ambientMode;
        //    ambientProbe = RenderSettings.ambientProbe;

        //    //public MaterialWidget.MaterialTextureProperty customReflection;
        //    //private Cubemap m_customReflection;
        //    defaultReflectionMode = RenderSettings.defaultReflectionMode;
        //    defaultReflectionResolution = RenderSettings.defaultReflectionResolution;
        //    reflectionBounces = RenderSettings.reflectionBounces;
        //    reflectionIntensity = RenderSettings.reflectionIntensity;

        //    flareFadeSpeed = RenderSettings.flareFadeSpeed;
        //    flareStrength = RenderSettings.flareStrength;

        //    fog = RenderSettings.fog;
        //    fogMode = RenderSettings.fogMode;
        //    fogColor = RenderSettings.fogColor;
        //    fogDensity = RenderSettings.fogDensity;
        //    fogStartDistance = RenderSettings.fogStartDistance;
        //    fogEndDistance = RenderSettings.fogEndDistance;

        //    haloStrength = RenderSettings.haloStrength;

        //    //public SkyboxWidget skybox;
        //    //public LightWidget sun;
        //}

        public void ResetToDefaults()
        {
            ambientMode = UnityEngine.Rendering.AmbientMode.Skybox;
            skyboxSettings.ambientIntensity = 1;
            ambientColor = new Color(54 / 255f, 58 / 255f, 66 / 255f, 255 / 255f);
            gradientAmbientColors.ambientEquatorColor = new Color(29 / 255f, 32 / 255f, 34 / 255f, 255 / 255f);
            gradientAmbientColors.ambientGroundColor  = new Color(12 / 255f, 11 / 255f, 9 / 255f, 255 / 255f);

            defaultReflectionMode = UnityEngine.Rendering.DefaultReflectionMode.Skybox;

            defaultReflectionResolution = 128;
            reflectionIntensity         = 1;
            reflectionBounces           = 1;
            flareFadeSpeed = 3;
            flareStrength  = 1;

            fog              = false;
            fogMode          = FogMode.ExponentialSquared;
            fogColor         = new Color(128 / 255f, 128 / 255f, 128 / 255f, 255 / 255f);
            fogDensity       = 0.01f;
            fogStartDistance = 0;
            fogEndDistance   = 300;

            haloStrength = 0.5f;
        }
Esempio n. 8
0
 private void Start()
 {
     defaultFog        = RenderSettings.fog;
     defaultFogColor   = RenderSettings.fogColor;
     defaultFogDensity = RenderSettings.fogDensity;
     defaultFogMod     = RenderSettings.fogMode;
 }
Esempio n. 9
0
 public void enterFog(FogMode mode, Color color)
 {
     RenderSettings.fog      = true;
     RenderSettings.fogMode  = mode;
     RenderSettings.fogColor = color;
     fogAppear = true;
 }
Esempio n. 10
0
 // Use this for initialization
 void Start()
 {
     normalColor     = RenderSettings.fogColor;
     normalDensity   = RenderSettings.fogDensity;
     underwaterColor = new Color(0.22f, 0.65f, 0.77f, 0.5f);
     normalFogMode   = RenderSettings.fogMode;
 }
Esempio n. 11
0
    void Start()
    {
        myTransform      = transform;
        mainCamTransform = Camera.main.transform;
        //assign this item's playerObj and weaponObj value
        playerObj = mainCamTransform.GetComponent <CameraKick>().playerObj;
        weaponObj = mainCamTransform.GetComponent <CameraKick>().weaponObj;
        //set up underwater sound effects
        audioSource        = gameObject.AddComponent <AudioSource>();
        audioSource.clip   = underwaterSound;
        audioSource.loop   = true;
        audioSource.volume = 0.8f;
        //store original fog values to apply to render settings when player surfaces
        fogEnabled         = RenderSettings.fog;
        origFogColor       = RenderSettings.fogColor;
        origFogDensity     = RenderSettings.fogDensity;
        origFogMode        = RenderSettings.fogMode;
        origLinearFogStart = RenderSettings.fogStartDistance;
        origLinearFogEnd   = RenderSettings.fogEndDistance;
        origLightColor     = RenderSettings.ambientLight;
        //store original sun/directional light color
        if (SunlightObj)
        {
            origSunightColor = SunlightObj.color;
        }

        rippleEffect.emit = false;
    }
Esempio n. 12
0
 public FogSettings(float d, FogMode m, Color c, Material s)
 {
     distanceOrDensity = d;
     mode   = m;
     color  = c;
     skybox = s;
 }
Esempio n. 13
0
 public override void OnInspectorGUI()
 {
     base.serializedObject.Update();
     this.m_ShowEditor = EditorGUILayout.ToggleTitlebar(this.m_ShowEditor, FogEditor.Styles.fogHeader, this.m_Fog);
     if (this.m_ShowEditor)
     {
         EditorGUI.indentLevel++;
         EditorGUI.BeginDisabledGroup(!this.m_Fog.boolValue);
         EditorGUILayout.PropertyField(this.m_FogColor, new GUILayoutOption[0]);
         EditorGUILayout.PropertyField(this.m_FogMode, new GUILayoutOption[0]);
         EditorGUI.indentLevel++;
         FogMode intValue = (FogMode)this.m_FogMode.intValue;
         if (intValue != FogMode.Linear)
         {
             EditorGUILayout.PropertyField(this.m_FogDensity, FogEditor.Styles.fogDensity, new GUILayoutOption[0]);
         }
         else
         {
             EditorGUILayout.PropertyField(this.m_LinearFogStart, FogEditor.Styles.fogLinearStart, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_LinearFogEnd, FogEditor.Styles.fogLinearEnd, new GUILayoutOption[0]);
         }
         EditorGUI.indentLevel--;
         if (SceneView.IsUsingDeferredRenderingPath())
         {
             EditorGUILayout.HelpBox(FogEditor.Styles.fogWarning.text, MessageType.Info);
         }
         EditorGUILayout.EndFadeGroup();
         EditorGUI.EndDisabledGroup();
         EditorGUI.indentLevel--;
     }
     base.serializedObject.ApplyModifiedProperties();
 }
Esempio n. 14
0
        // Use this for initialization
        void Start()
        {
            _firstPersonController = GetComponent <FirstPersonController>();

            _characterController = GetComponent <CharacterController>();

            _fogColorWater = new Color(0.2f, 0.65f, 0.75f, 0.5f);

            //Transform fpChar = transform.FindChild("FirstPersonCharacter");
            Transform fpChar = GameObject.Find("[CameraRig].Camera(head)").transform;

            //          _blur = fpChar.GetComponent<Blur>();

            _camera = fpChar.GetComponent <Camera>();

            // Default values for FirstPersonController on start
            _defWalkspeed         = WalkSpeed;
            _defRunspeed          = RunSpeed;
            _defJumpspeed         = JumpSpeed;
            _defGravityMultiplier = GravityMultiplier;

            _defFogMode    = RenderSettings.fogMode;
            _defFogDensity = RenderSettings.fogDensity;
            _defFogColor   = RenderSettings.fogColor;
            _defFogEnabled = RenderSettings.fog;
        }
Esempio n. 15
0
        public static void Render(FogMode Mode, bool UseRange)
        {
            var g_pDevice = GuiController.Instance.D3dDevice;

            // Enable fog blending.
            g_pDevice.SetRenderState(RenderStates.FogEnable, true);

            // Set the fog color.
            g_pDevice.RenderState.FogColor = Color.DarkGray;


            // Set fog parameters.
            if (FogMode.Linear == Mode)
            {
                g_pDevice.SetRenderState(RenderStates.FogTableMode, (int)Mode);
                g_pDevice.SetRenderState(RenderStates.FogStart, START);
                g_pDevice.SetRenderState(RenderStates.FogEnd, END);
            }
            else
            {
                g_pDevice.SetRenderState(RenderStates.FogTableMode, (int)Mode);
                g_pDevice.SetRenderState(RenderStates.FogDensity, DENSITY);
            }

            // Enable range-based fog if desired (only supported for
            //   vertex fog). For this example, it is assumed that UseRange
            //   is set to a nonzero value only if the driver exposes the
            //   D3DPRASTERCAPS_FOGRANGE capability.
            // Note: This is slightly more performance intensive
            //   than non-range-based fog.
            if (UseRange)
            {
                g_pDevice.SetRenderState(RenderStates.RangeFogEnable, true);
            }
        }
Esempio n. 16
0
    // Use this for initialization
    void Start()
    {
        _cam = playerCamera.GetComponent <AFPC_Cam> ();
        if (_cam.useUnderwaterImageEffects)
        {
            imageEffectsCamera.GetComponent <AFPC_UnderWaterDisplaceEffect> ().enabled = false;
            imageEffectsCamera.GetComponent <AFPC_UnderWaterBlurEffect> ().enabled     = false;
        }

        if (GetComponent <AudioSource> ())
        {
            _audioSrc = GetComponent <AudioSource> ();
        }
        else
        {
            gameObject.AddComponent <AudioSource> ();
        }
        _audioSrc             = GetComponent <AudioSource> ();
        _audioSrc.volume      = audioVolume;
        _audioSrc.playOnAwake = true;
        initialFogDensity     = RenderSettings.fogDensity;
        initialFogEnabled     = RenderSettings.fog;
        initialFogMode        = RenderSettings.fogMode;
        initialFogColor       = RenderSettings.fogColor;
    }
Esempio n. 17
0
 public FogSettings()
 {
     this.fogColor   = RenderSettings.fogColor;
     this.fog        = RenderSettings.fog;
     this.fogMode    = RenderSettings.fogMode;
     this.fogDensity = RenderSettings.fogDensity;
 }
Esempio n. 18
0
    // Update is called once per frame
    void Update()
    {
        if (fog)
        {
            checkFog = checks[0];
        }
        else
        {
            checkFog = checks[1];
        }

        RenderSettings.fogColor   = new Color(r, g, b, 1);
        RenderSettings.fogDensity = fogDensity;

        if (m == 0)
        {
            fmode = FogMode.Linear;
        }
        else if (m == 1)
        {
            fmode = FogMode.Exponential;
        }
        else
        {
            fmode = FogMode.ExponentialSquared;
        }
        RenderSettings.fogMode = fmode;

        if (m == 0)
        {
            RenderSettings.fogStartDistance = startDist;
            RenderSettings.fogEndDistance   = endDist;
        }
    }
 public FixedFunctionProgramsParameters()
 {
     fogMode    = FogMode.None;
     fogColor   = ColorEx.Black;
     fogDensity = 0.0f;
     fogStart   = 0.0f;
     fogEnd     = 0.0f;
 }
Esempio n. 20
0
 public void setFogProperties(FogMode fogMode, ColourValue fogColour, float fogStart, float fogEnd, float fogDensity)
 {
     RTShaderPINVOKE.FFPFog_setFogProperties(swigCPtr, (int)fogMode, ColourValue.getCPtr(fogColour), fogStart, fogEnd, fogDensity);
     if (RTShaderPINVOKE.SWIGPendingException.Pending)
     {
         throw RTShaderPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 21
0
    static int IntToEnum(IntPtr L)
    {
        int     arg0 = (int)LuaDLL.lua_tonumber(L, 1);
        FogMode o    = (FogMode)arg0;

        LuaScriptMgr.PushEnum(L, o);
        return(1);
    }
Esempio n. 22
0
 public void OverrideSkyboxFog(FogMode mode, float density, float start, float end)
 {
     m_CustomFogData.X = (float)mode;
     m_CustomFogData.Y = density;
     m_CustomFogData.Z = start;
     m_CustomFogData.W = end;
     m_OverrideFog     = mode != FogMode.None;
 }
Esempio n. 23
0
 public void setFog(bool overrideScene, FogMode mode, ColourValue colour)
 {
     OgrePINVOKE.Technique_setFog__SWIG_3(swigCPtr, overrideScene, (int)mode, ColourValue.getCPtr(colour));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 24
0
 public void setFog(bool overrideScene, FogMode mode)
 {
     OgrePINVOKE.Technique_setFog__SWIG_4(swigCPtr, overrideScene, (int)mode);
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 25
0
 public void setFog(bool overrideScene, FogMode mode, ColourValue colour, float expDensity, float linearStart)
 {
     OgrePINVOKE.Technique_setFog__SWIG_1(swigCPtr, overrideScene, (int)mode, ColourValue.getCPtr(colour), expDensity, linearStart);
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 26
0
 public void setFog(bool overrideScene, FogMode mode, ColourValue colour, float expDensity)
 {
     OgrePINVOKE.MaterialPtr_setFog__SWIG_2(swigCPtr, overrideScene, (int)mode, ColourValue.getCPtr(colour), expDensity);
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
 private void SetFog(LightingProfile current, LightingProfile source, float blend)
 {
     fog              = source.fog;
     fogMode          = source.fogMode;
     fogColor         = Color.Lerp(current.fogColor, source.fogColor, blend);
     fogDensity       = Mathf.Lerp(current.fogDensity, source.fogDensity, blend);
     fogEndDistance   = Mathf.Lerp(current.fogEndDistance, source.fogEndDistance, blend);
     fogStartDistance = Mathf.Lerp(current.fogStartDistance, source.fogStartDistance, blend);
 }
Esempio n. 28
0
 public void fetch()
 {
     fogEnabled       = RenderSettings.fog;
     fogColor         = RenderSettings.fogColor;
     fogDensity       = RenderSettings.fogDensity;
     fogStartDistance = RenderSettings.fogStartDistance;
     fogEndDistance   = RenderSettings.fogEndDistance;
     fogMode          = RenderSettings.fogMode;
 }
Esempio n. 29
0
 private void OnRenderImage(RenderTexture source, RenderTexture destination)
 {
     if (!base.isSupported || (!this.distanceFog && !this.heightFog))
     {
         Graphics.Blit(source, destination);
     }
     else
     {
         Vector4   vector8;
         Transform transform     = this._camera.transform;
         float     nearClipPlane = this._camera.nearClipPlane;
         float     farClipPlane  = this._camera.farClipPlane;
         float     aspect        = this._camera.aspect;
         Matrix4x4 identity      = Matrix4x4.identity;
         float     num5          = this._camera.fieldOfView * 0.5f;
         Vector3   vector        = ((transform.right * nearClipPlane) * Mathf.Tan(num5 * 0.01745329f)) * aspect;
         Vector3   vector2       = (transform.up * nearClipPlane) * Mathf.Tan(num5 * 0.01745329f);
         Vector3   vector3       = ((transform.forward * nearClipPlane) - vector) + vector2;
         float     num6          = (vector3.magnitude * farClipPlane) / nearClipPlane;
         vector3.Normalize();
         Vector3 vector4 = ((transform.forward * nearClipPlane) + vector) + vector2;
         vector4.Normalize();
         Vector3 vector5 = ((transform.forward * nearClipPlane) + vector) - vector2;
         vector5.Normalize();
         Vector3 vector6 = ((transform.forward * nearClipPlane) - vector) - vector2;
         vector6.Normalize();
         identity.SetRow(0, vector3 * num6);
         identity.SetRow(1, vector4 * num6);
         identity.SetRow(2, vector5 * num6);
         identity.SetRow(3, vector6 * num6);
         Vector3 position = transform.position;
         float   y        = position.y - this.height;
         this.fogMaterial.SetMatrix("_FrustumCornersWS", identity);
         this.fogMaterial.SetVector("_CameraWS", position);
         this.fogMaterial.SetVector("_HeightParams", new Vector4(this.height, y, (y > 0f) ? 0f : 1f, (this.heightDensity * 0.5f) * this.ShaftDensity));
         this.fogMaterial.SetVector("_DistanceParams", new Vector4(-Mathf.Max(this.startDistance, 0f), 0f, 0f, 0f));
         this.fogMaterial.SetVector("_FogColor", (Vector4)this.fogColor);
         this.fogMaterial.SetFloat("_FogFacCoef", this.fogFacCoef);
         this.fogMaterial.SetInt("_horizontalFog", !this.horizontalFog ? 0 : 1);
         FogMode fogMode          = RenderSettings.fogMode;
         float   fogDensity       = RenderSettings.fogDensity;
         float   fogStartDistance = RenderSettings.fogStartDistance;
         float   fogEndDistance   = RenderSettings.fogEndDistance;
         bool    flag             = fogMode == FogMode.Linear;
         float   f     = !flag ? 0f : (fogEndDistance - fogStartDistance);
         float   num13 = (Mathf.Abs(f) <= 0.0001f) ? 0f : (1f / f);
         vector8.x = fogDensity * 1.201122f;
         vector8.y = fogDensity * 1.442695f;
         vector8.z = !flag ? 0f : -num13;
         vector8.w = !flag ? 0f : (fogEndDistance * num13);
         this.fogMaterial.SetVector("_SceneFogParams", vector8);
         this.fogMaterial.SetVector("_SceneFogMode", new Vector4((float)fogMode, !this.useRadialDistance ? ((float)0) : ((float)1), 0f, 0f));
         int passNr = 0;
         passNr = (!this.distanceFog || !this.heightFog) ? (!this.distanceFog ? 2 : 1) : 0;
         CustomGraphicsBlit(source, destination, this.fogMaterial, passNr);
     }
 }
 public FogComponent(bool useFog, Color32 color, FogMode fogMode, float density, float startDistance, float endDistance)
 {
     this.useFog        = useFog;
     this.fogColor      = color;
     this.fogMode       = fogMode;
     this.density       = density;
     this.startDistance = startDistance;
     this.endDistance   = endDistance;
 }
 public void Update_GlobalFog(Camera mainCamera, bool enabled, FogMode fogMode, Color fogColor,
                              float fogIntensity, float linearStart, float linearEnd)
 {
     RenderSettings.fog              = enabled;
     RenderSettings.fogColor         = fogColor;
     RenderSettings.fogDensity       = fogIntensity;
     RenderSettings.fogMode          = fogMode;
     RenderSettings.fogStartDistance = linearStart;
     RenderSettings.fogEndDistance   = linearEnd;
 }
Esempio n. 32
0
        private void Start() {
            // Reading the initial fog state
            _defaultFog = RenderSettings.fog;
            _defaultFogMode = RenderSettings.fogMode;
            _defaultFogColor = RenderSettings.fogColor;
            _defaultFogDensity = RenderSettings.fogDensity;
            _defaultFogStartDistance = RenderSettings.fogStartDistance;
            _defaultFogEndDistance = RenderSettings.fogEndDistance;
            _defaultSkybox = RenderSettings.skybox;
			waterObject = GameObject.Find("Water").transform;
        }
Esempio n. 33
0
        /// <summary>
        /// luo sumu
        /// </summary>
        /// <param name="mode"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="density"></param>
        public static void CreateFog(FogMode mode, float start, float end, float density)
        {
            GL.Fog(FogParameter.FogMode, (int)mode);

            GL.Fog(FogParameter.FogColor, new float[] { Color.X, Color.Y, Color.Z });
            GL.Fog(FogParameter.FogDensity, density);
            GL.Hint(HintTarget.FogHint, HintMode.DontCare);

            GL.Fog(FogParameter.FogStart, start);
            GL.Fog(FogParameter.FogEnd, end);
            GL.Enable(EnableCap.Fog);
        }
 public void getFromRenderSettings()
 {
     fog = RenderSettings.fog;
     fogColor = RenderSettings.fogColor;
     fogMode = RenderSettings.fogMode;
     fogDensity = RenderSettings.fogDensity;
     linearFogStart = RenderSettings.fogStartDistance;
     linearFogEnd = RenderSettings.fogEndDistance;
     ambientLight = RenderSettings.ambientLight;
     skyboxMaterial = RenderSettings.skybox;
     haloStrength = RenderSettings.haloStrength;
     flareStrength = RenderSettings.flareStrength;
 }
Esempio n. 35
0
        private void Start() {
            // Check if the script is attached to a Camera
            _camera = gameObject.GetComponent<Camera>();
            if (_camera == null) {
                Debug.LogError(string.Format("The {0} script can only be attached to the Camera!", GetType()), transform);
                Destroy(this);
                return;
            }

            // Adding Rigidbody and Collider required for receiving trigger events
            Rigidbody tempRigidbody = gameObject.GetComponent<Rigidbody>();
            if (tempRigidbody == null) {
                tempRigidbody = gameObject.AddComponent<Rigidbody>();
                tempRigidbody.isKinematic = true;
                tempRigidbody.useGravity = false;
            } else {
                Debug.LogWarning("Rigidbody component is already attached to this camera, unexpected behaviour may occur",
                                 transform);
            }

            Collider tempCollider = gameObject.GetComponent<Collider>();
            if (tempCollider == null) {
                tempCollider = gameObject.AddComponent<BoxCollider>();
                tempCollider.isTrigger = true;
                ((BoxCollider) tempCollider).size = Vector3.zero;
            } else {
                Debug.LogWarning("Collider already attached to this camera, unexpected behaviour may occur", transform);
            }

            _waterDetector = GetComponent<WaterDetector>() ?? gameObject.AddComponent<WaterDetector>();

            // Reading the initial fog state
            _defaultFog = RenderSettings.fog;
            _defaultFogMode = RenderSettings.fogMode;
            _defaultFogColor = RenderSettings.fogColor;
            _defaultFogDensity = RenderSettings.fogDensity;
            _defaultFogStartDistance = RenderSettings.fogStartDistance;
            _defaultFogEndDistance = RenderSettings.fogEndDistance;
            _defaultSkybox = RenderSettings.skybox;
        }
Esempio n. 36
0
        public override void SetFog(FogMode mode, ColorEx color, Real density, Real start, Real end)
		{
			int fogMode;

			switch ( mode )
			{
				case FogMode.Exp:
					fogMode = Gl.GL_EXP;
					break;
				case FogMode.Exp2:
					fogMode = Gl.GL_EXP2;
					break;
				case FogMode.Linear:
					fogMode = Gl.GL_LINEAR;
					break;
				default:
					if ( fogEnabled )
					{
						Gl.glDisable( Gl.GL_FOG );
						fogEnabled = false;
					}
					return;
			} // switch

            if (!fogEnabled)
            {
                Gl.glEnable( Gl.GL_FOG );
                fogEnabled = true;
            }
            Gl.glFogi( Gl.GL_FOG_MODE, fogMode );
			
            // fog color values
			color.ToArrayRGBA( _tempColorVals );
			Gl.glFogfv( Gl.GL_FOG_COLOR, _tempColorVals );
			Gl.glFogf( Gl.GL_FOG_DENSITY, density );
			Gl.glFogf( Gl.GL_FOG_START, start );
			Gl.glFogf( Gl.GL_FOG_END, end );
			

			// TODO: Fog hints maybe?
		}
Esempio n. 37
0
	//Nav mesh settings can't be accessed via script :(

	//Lightmapping is VERY version-specific. You may have to modify the settings that are compared
	public void CaptureSettings() {
#if UNITY_5
#else
		aoAmount = LightmapEditorSettings.aoAmount;
		aoContrast = LightmapEditorSettings.aoContrast;
		bounceBoost = LightmapEditorSettings.bounceBoost;	 
		bounceIntensity = LightmapEditorSettings.bounceIntensity;
		bounces = LightmapEditorSettings.bounces;
		
		quality = LightmapEditorSettings.quality;
		skyLightColor = LightmapEditorSettings.skyLightColor;
		skyLightIntensity = LightmapEditorSettings.skyLightIntensity;

		finalGatherContrastThreshold = LightmapEditorSettings.finalGatherContrastThreshold;
		finalGatherGradientThreshold = LightmapEditorSettings.finalGatherGradientThreshold;
		finalGatherInterpolationPoints = LightmapEditorSettings.finalGatherInterpolationPoints;
		finalGatherRays = LightmapEditorSettings.finalGatherRays;
		lastUsedResolution = LightmapEditorSettings.lastUsedResolution;
		lockAtlas = LightmapEditorSettings.lockAtlas;
#if !(UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5)
		bakedColorSpace = LightmapSettings.bakedColorSpace;
#endif
#endif
		ambientLight = RenderSettings.ambientLight;
#if UNITY_4_3 || UNITY_4_5 || UNITY_5 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3
		flareFadeSpeed = RenderSettings.flareFadeSpeed;
#endif
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
#else
		lightProbes = LightmapSettings.lightProbes;
		padding = LightmapEditorSettings.padding;
#endif
		flareStrength = RenderSettings.flareStrength;
		fog = RenderSettings.fog;
		fogColor = RenderSettings.fogColor;
		fogDensity = RenderSettings.fogDensity;
		fogEndDistance = RenderSettings.fogEndDistance;
		fogMode = RenderSettings.fogMode;
		fogStartDistance = RenderSettings.fogStartDistance;
		haloStrength = RenderSettings.haloStrength;
		skybox = RenderSettings.skybox;

		lightmaps = LightmapSettings.lightmaps;
		lightmapsMode = LightmapSettings.lightmapsMode;

		aoMaxDistance = LightmapEditorSettings.aoMaxDistance;
		maxAtlasHeight = LightmapEditorSettings.maxAtlasHeight;
		maxAtlasWidth = LightmapEditorSettings.maxAtlasWidth;
		resolution = LightmapEditorSettings.resolution;
		textureCompression = LightmapEditorSettings.textureCompression;
	}
        public SceneManager(string smName)
        {
            this.smName = smName;
            cameraList = new Dictionary<string, Camera>();
            //lightList = new LightList();
            //entityList = new EntityList();
            movableObjectCollectionMap = new Dictionary<string, Dictionary<string, MovableObject>>();
            sceneNodeList = new Dictionary<string, SceneNode>();
            //billboardSetList = new Dictionary<string, BillboardSet>();
            animationList = new Dictionary<string, Animation>();
            animationStateList = new AnimationStateSet();
            regionList = new List<Region>();

            // create the root scene node
            rootSceneNode = new SceneNode(this, "Root");
            defaultRootNode = rootSceneNode;

            // default to no fog
            fogMode = FogMode.None;

            // no shadows by default
            shadowTechnique = ShadowTechnique.None;

            illuminationStage = IlluminationRenderStage.None;
            renderingNoShadowQueue = false;
            renderingMainGroup = false;
            shadowColor = new ColorEx(0.25f, 0.25f, 0.25f);
            shadowDirLightExtrudeDist = 10000;
            shadowIndexBufferSize = 51200;
            shadowTextureOffset = 0.6f;
            shadowTextureFadeStart = 0.7f;
            shadowTextureFadeEnd = 0.9f;
            shadowTextureSize = 512;
            shadowTextureConfigDirty = true;
            ShadowTextureCount = 1;
            findVisibleObjects = true;
            suppressRenderStateChanges = false;
            suppressShadows = false;
            shadowUseInfiniteFarPlane = true;
            shadowCasterRenderBackFaces = true;
            defaultShadowCameraSetup = new DefaultShadowCameraSetup();
        }
Esempio n. 39
0
		/// <summary>
		/// Sets the fogging mode applied to each pass.
		/// </summary>
		/// <remarks>
		/// This property actually exists on the Pass class. For simplicity, this method allows 
		/// you to set these properties for every current Pass within this Technique. If 
		/// you need more precision, retrieve the Pass instance and set the
		/// property there.
		/// <see ref="Pass.SetFog"></see>
		/// </remarks>
		public void SetFog( bool overrideScene, FogMode mode, ColorEx color, Real expDensity, Real linearStart, Real linearEnd )
		{
			// load each technique
			foreach ( Pass p in _passes )
			{
				p.SetFog( overrideScene, mode, color, expDensity, linearStart, linearEnd );
			}
		}
Esempio n. 40
0
		/// <summary>
		///
		/// </summary>
		/// <param name="mode"></param>
		/// <param name="color"></param>
		/// <param name="density"></param>
		public virtual void SetFog( FogMode mode, ColorEx color, float density )
		{
			// set all the fog information
			this.fogMode = mode;
			this.fogColor = color;
			this.fogDensity = density;
			this.fogStart = 0.0f;
			this.fogEnd = 1.0f;
		}
 public void SetFog(FogMode fogMode, ColorEx fogColor, float fogStart, float fogEnd, float fogScale)
 {
     this.fogColor = fogColor;
     fogParams = new Vector4(fogStart, fogEnd, fogScale, 0);
 }
Esempio n. 42
0
		/// <summary>
		///    Overloaded method.
		/// </summary>
		/// <param name="overrideScene">
		///    If true, you authorise this pass to override the scene's fog params with it's own settings.
		///    If you specify false, so other parameters are necessary, and this is the default behaviour for passs.
		/// </param>
		/// <param name="mode">
		///    Only applicable if <paramref name="overrideScene"/> is true. You can disable fog which is turned on for the
		///    rest of the scene by specifying FogMode.None. Otherwise, set a pass-specific fog mode as
		///    defined in the enum FogMode.
		/// </param>
		/// <param name="color">
		///    The color of the fog. Either set this to the same as your viewport background color,
		///    or to blend in with a skydome or skybox.
		/// </param>
		/// <param name="density">
		///    The density of the fog in FogMode.Exp or FogMode.Exp2 mode, as a value between 0 and 1. 
		///    The default is 0.001.
		/// </param>
		public void SetFog( bool overrideScene, FogMode mode, ColorEx color, float density )
		{
			SetFog( overrideScene, mode, color, density, 0.0f, 1.0f );
		}
Esempio n. 43
0
		/// <summary>
		///    Overloaded method.
		/// </summary>
		/// <param name="overrideScene">
		///    If true, you authorise this pass to override the scene's fog params with it's own settings.
		///    If you specify false, so other parameters are necessary, and this is the default behaviour for passs.
		/// </param>
		/// <param name="mode">
		///    Only applicable if <paramref name="overrideScene"/> is true. You can disable fog which is turned on for the
		///    rest of the scene by specifying FogMode.None. Otherwise, set a pass-specific fog mode as
		///    defined in the enum FogMode.
		/// </param>
		public void SetFog( bool overrideScene, FogMode mode )
		{
			SetFog( overrideScene, mode, ColorEx.White, 0.001f, 0.0f, 1.0f );
		}
Esempio n. 44
0
		/// <summary>
		///    Default constructor.
		/// </summary>
		/// <param name="parent">Technique that owns this Pass.</param>
		/// <param name="index">Index of this pass.</param>
		public Pass( Technique parent, int index )
		{
			this._parent = parent;
			this._index = index;

			lock ( passLock )
			{
				this.passId = nextPassId++;
			}

			// color defaults
			_ambient = ColorEx.White;
			_diffuse = ColorEx.White;
			_specular = ColorEx.Black;
			_emissive = ColorEx.Black;

			// by default, don't override the scene's fog settings
			_fogOverride = false;
			_fogMode = FogMode.None;
			_fogColor = ColorEx.White;
			_fogStart = 0;
			_fogEnd = 1;
			_fogDensity = 0.001f;

			// default blending (overwrite)
			_sourceBlendFactor = SceneBlendFactor.One;
			_destinationBlendFactor = SceneBlendFactor.Zero;



			// depth buffer settings
			_depthCheck = true;
			_depthWrite = true;
			_colorWriteEnabled = true;
			_depthFunction = CompareFunction.LessEqual;

			// cull settings
			_cullingMode = CullingMode.Clockwise;
			_manualCullingMode = ManualCullingMode.Back;

			// light settings
			_lightingEnabled = true;
			_runOnlyForOneLightType = true;
			_onlyLightType = LightType.Point;
			_shadingMode = Shading.Gouraud;

			// Default max lights to the global max
			_maxSimultaneousLights = Config.MaxSimultaneousLights;

			_name = index.ToString();

            IterationCount = 1;

			DirtyHash();
		}
Esempio n. 45
0
		public override void SetFog( FogMode mode, Core.ColorEx color, Real density, Real linearStart, Real linearEnd )
		{
			//Ogre empty...
		}
Esempio n. 46
0
        /// <summary>
        ///    Default constructor.
        /// </summary>
        /// <param name="parent">Technique that owns this Pass.</param>
        /// <param name="index">Index of this pass.</param>
        public Pass(Technique parent, int index)
        {
            this.parent = parent;
            this.index = index;

            lock (passLock) {
                this.passId = nextPassId++;
            }

            // color defaults
            ambient = ColorEx.White;
            diffuse = ColorEx.White;
            specular = ColorEx.Black;
            emissive = ColorEx.Black;

            // by default, don't override the scene's fog settings
            fogOverride = false;
            fogMode = FogMode.None;
            fogColor = ColorEx.White;
            fogStart = 0;
            fogEnd = 1;
            fogDensity = 0.001f;

            // default blending (overwrite)
            sourceBlendFactor = SceneBlendFactor.One;
            destBlendFactor = SceneBlendFactor.Zero;

            // depth buffer settings
            depthCheck = true;
            depthWrite = true;
            colorWrite = true;
            alphaRejectFunction = CompareFunction.AlwaysPass;
            alphaRejectValue = 0;
            depthFunc = CompareFunction.LessEqual;

            depthBiasConstant = 0f;
            depthBiasSlopeScale = 0f;

            // cull settings
            cullMode = CullingMode.Clockwise;
            manualCullMode = ManualCullingMode.Back;

            // light settings
            lightingEnabled = true;
            runOnlyForOneLightType = true;
            lightsPerIteration = 1;
            runOncePerLight = false;
            onlyLightType = LightType.Point;
            shadeOptions = Shading.Gouraud;

            // Default max lights to the global max
            maxLights = Config.MaxSimultaneousLights;

            // Starting light index
            startLight = 0;

            // Default to solid
            sceneDetail = SceneDetailLevel.Solid;

            // Iteration count of 1
            passIterationCount = 1;

            // pointSize, etc.
            pointSize = 1.0f;
            pointMinSize = 0f;
            pointMaxSize = 0f;
            pointSpritesEnabled = false;
            pointAttenuationEnabled = false;
            pointAttenuationConstant = 1.0f;
            pointAttenuationLinear = 0f;
            pointAttenuationQuadratic = 0f;

            contentTypeLookupBuilt = false;

            name = index.ToString();

            DirtyHash();
        }
Esempio n. 47
0
		public FFPFog()
		{
			this.fogMode = FogMode.None;
			this.calcMode = FFPFog.CalcMode.PerVertex;
			this.passOverrideParams = false;
		}
Esempio n. 48
0
		public void SetFogProperties( FogMode fogMode, ColorEx fogColor, float fogStart, float fogEnd, float fogDensity )
		{
			this.fogMode = fogMode;
			this.fogColorValue = fogColor;
			this.fogParamsValue = new Vector4( fogDensity, fogStart, fogEnd, fogEnd != fogStart ? 1/( fogEnd - fogStart ) : 0 );
		}
 /// <summary>
 ///		Sets the fog with the given params.
 /// </summary>
 /// <param name="mode"></param>
 /// <param name="color"></param>
 /// <param name="density"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 public abstract void SetFog(FogMode mode, ColorEx color, float density, float start, float end);
Esempio n. 50
0
		public void SetFogSettings(bool enabled, Color color, float density, float startDistance, float endDistance, FogMode fogMode) {
		
#if UNITY_EDITOR
			UnityEditor.EditorUtility.SetDirty (this);
#endif

			_fogSettings.SetProperties (enabled, color, density, startDistance, endDistance, fogMode);
		
		}
Esempio n. 51
0
		/// <summary>
		///    Sets the fogging mode applied to this pass.
		/// </summary>
		/// <remarks>
		///    Fogging is an effect that is applied as polys are rendered. Sometimes, you want
		///    fog to be applied to an entire scene. Other times, you want it to be applied to a few
		///    polygons only. This pass-level specification of fog parameters lets you easily manage
		///    both.
		///    <p/>
		///    The SceneManager class also has a SetFog method which applies scene-level fog. This method
		///    lets you change the fog behavior for this pass compared to the standard scene-level fog.
		/// </remarks>
		/// <param name="overrideScene">
		///    If true, you authorise this pass to override the scene's fog params with it's own settings.
		///    If you specify false, so other parameters are necessary, and this is the default behaviour for passs.
		/// </param>
		/// <param name="mode">
		///    Only applicable if <paramref name="overrideScene"/> is true. You can disable fog which is turned on for the
		///    rest of the scene by specifying FogMode.None. Otherwise, set a pass-specific fog mode as
		///    defined in the enum FogMode.
		/// </param>
		/// <param name="color">
		///    The color of the fog. Either set this to the same as your viewport background color,
		///    or to blend in with a skydome or skybox.
		/// </param>
		/// <param name="density">
		///    The density of the fog in FogMode.Exp or FogMode.Exp2 mode, as a value between 0 and 1. 
		///    The default is 0.001.
		/// </param>
		/// <param name="start">
		///    Distance in world units at which linear fog starts to encroach. 
		///    Only applicable if mode is FogMode.Linear.
		/// </param>
		/// <param name="end">
		///    Distance in world units at which linear fog becomes completely opaque.
		///    Only applicable if mode is FogMode.Linear.
		/// </param>
		public void SetFog( bool overrideScene, FogMode mode, ColorEx color, float density, float start, float end )
		{
			_fogOverride = overrideScene;

			// set individual params if overriding scene level fog
			if ( overrideScene )
			{
				_fogMode = mode;
				_fogColor = color;
				_fogDensity = density;
				_fogStart = start;
				_fogEnd = end;
			}
		}
Esempio n. 52
0
		public virtual void SetFog( FogMode mode, ColorEx color, Real expDensity, Real linearStart, Real linearEnd )
		{
			// mode ignored
			this.fogColor = color;
			this.fogParams.x = expDensity;
			this.fogParams.y = linearStart;
			this.fogParams.z = linearEnd;
			this.fogParams.w = linearEnd != linearStart ? 1/( linearEnd - linearStart ) : 0;
		}
Esempio n. 53
0
		/// <summary>
		///    Overloaded method.
		/// </summary>
		/// <param name="overrideScene">
		///    If true, you authorise this pass to override the scene's fog params with it's own settings.
		///    If you specify false, so other parameters are necessary, and this is the default behaviour for passs.
		/// </param>
		/// <param name="mode">
		///    Only applicable if <paramref name="overrideScene"/> is true. You can disable fog which is turned on for the
		///    rest of the scene by specifying FogMode.None. Otherwise, set a pass-specific fog mode as
		///    defined in the enum FogMode.
		/// </param>
		/// <param name="color">
		///    The color of the fog. Either set this to the same as your viewport background color,
		///    or to blend in with a skydome or skybox.
		/// </param>
		public void SetFog( bool overrideScene, FogMode mode, ColorEx color )
		{
			SetFog( overrideScene, mode, color, 0.001f, 0.0f, 1.0f );
		}
			public FixedFunctionProgramsParameters()
			{
				fogMode = FogMode.None;
				fogColor = ColorEx.Black;
				fogDensity = 0.0f;
				fogStart = 0.0f;
				fogEnd = 0.0f;
			}
Esempio n. 55
0
		public string getProgramSource( FogMode fogMode, string syntax, bool shadowReceiver )
		{
			if ( shadowReceiver )
			{
				if ( syntax == "arbvp1" )
				{
					return mShadowReceiverArbvp1;
				}
				else
				{
					return mShadowReceiverVs_1_1;
				}
			}
			else
			{

				switch ( fogMode )
				{
					case FogMode.None:
						if ( syntax == "arbvp1" )
						{
							return mNoFogArbvp1;
						}
						else
						{
							return mNoFogVs_1_1;
						}
						break;
					case FogMode.Linear:
						if ( syntax == "arbvp1" )
						{
							return mLinearFogArbvp1;
						}
						else
						{
							return mLinearFogVs_1_1;
						}
						break;
					case FogMode.Exp:
						if ( syntax == "arbvp1" )
						{
							return mExpFogArbvp1;
						}
						else
						{
							return mExpFogVs_1_1;
						}
						break;
					case FogMode.Exp2:
						if ( syntax == "arbvp1" )
						{
							return mExp2FogArbvp1;
						}
						else
						{
							return mExp2FogVs_1_1;
						}
						break;
				};
			}
			// default
			return string.Empty;

		}
Esempio n. 56
0
 private static extern void cogl_set_fog(IntPtr color, FogMode mode, float density, float z_near, float z_far);
Esempio n. 57
0
		/// <summary>
		///		Sets the fogging mode applied to the scene.
		/// </summary>
		/// <remarks>
		///		This method sets up the scene-wide fogging effect. These settings
		///		apply to all geometry rendered, UNLESS the material with which it
		///		is rendered has it's own fog settings (see Material.SetFog).
		/// </remarks>
		/// <param name="mode">Set up the mode of fog as described in the FogMode
		///		enum, or set to FogMode.None to turn off.</param>
		/// <param name="color">The color of the fog. Either set this to the same
		///		as your viewport background color, or to blend in with a skydome or skybox.</param>
		/// <param name="density">The density of the fog in Exp or Exp2.
		///		mode, as a value between 0 and 1. The default is 0.001. </param>
		/// <param name="linearStart">Distance in world units at which linear fog starts to
		///		encroach. Only applicable if mode is</param>
		/// <param name="linearEnd">Distance in world units at which linear fog becomes completely
		///		opaque. Only applicable if mode is</param>
		public virtual void SetFog( FogMode mode, ColorEx color, float density, float linearStart, float linearEnd )
		{
			// set all the fog information
			this.fogMode = mode;
			this.fogColor = color;
			this.fogDensity = density;
			this.fogStart = linearStart;
			this.fogEnd = linearEnd;
		}
Esempio n. 58
0
 public static void SetFog(Color color, FogMode mode, float density, float zNear, float zFar)
 {
     cogl_set_fog (color == null ? IntPtr.Zero : color.Handle, mode, density, zNear, zFar);
 }
Esempio n. 59
0
        public SceneManager( string name )
			: base()
		{
			this.cameraList = new CameraCollection();
			this.sceneNodeList = new SceneNodeCollection();
			this.animationList = new AnimationCollection();
			this.animationStateList = new AnimationStateSet();
			this.regionList = new List<StaticGeometry.Region>();

			this.shadowCasterQueryListener = new ShadowCasterSceneQueryListener( this );

			// create the root scene node
			this.rootSceneNode = new SceneNode( this, "Root" );
			this.rootSceneNode.SetAsRootNode();
			this.defaultRootNode = this.rootSceneNode;

			this.name = name;

			// default to no fog
			this.fogMode = FogMode.None;

			// no shadows by default
			this.shadowTechnique = ShadowTechnique.None;

			// setup default shadow camera setup
			this._defaultShadowCameraSetup = new DefaultShadowCameraSetup();

			this.illuminationStage = IlluminationRenderStage.None;
			this.renderingNoShadowQueue = false;
			this.renderingMainGroup = false;
			this.shadowColor.a = this.shadowColor.r = this.shadowColor.g = this.shadowColor.b = 0.25f;
			this.shadowDirLightExtrudeDist = 10000;
			this.shadowIndexBufferSize = 51200;
			this.shadowTextureOffset = 0.6f;
			this.shadowTextureFadeStart = 0.7f;
			this.shadowTextureFadeEnd = 0.9f;
			this.shadowTextureSize = 512;
			this.shadowTextureCount = 1;
			this.findVisibleObjects = true;
			this.suppressRenderStateChanges = false;
			this.suppressShadows = false;
			this.shadowUseInfiniteFarPlane = true;
		}
Esempio n. 60
0
        //property.Expanded =  EditorGUILayout.Foldout( property.Expanded, property.GetPropertyType().PropertyTypeString() );
        public void Draw()
        {
            var shaderNameContent = new GUIContent(
                    "Shader Name",
                    "Name for shader. Includes the hierarchy listing, that is, MyShaders/Shader will be in a folder called \"MyShaders\" in the shader selection dropdown. Also used when referring to fallback shaders.");

            var oldColor = GUI.color;
            if( string.IsNullOrEmpty(_shaderName ) )
            {
                GUI.color = Color.red;
            }
            _shaderName.Value = EditorGUILayout.TextField(shaderNameContent, _shaderName.Value);
            GUI.color = oldColor;

            var shaderFallbackContent = new GUIContent(
                    "Shader Fallback",
                    "Fallback shader to use in case this shader can not be used.");

            _shaderFallback.Value = EditorGUILayout.TextField( shaderFallbackContent, _shaderFallback.Value );

            var targetContent = new GUIContent("Shader Model","Requires more recent hardware to use the shader, but allows for more instructions, texture reads, and more input information.");
            _shaderTarget = (ShaderTarget)EditorGUILayout.EnumPopup( targetContent, _shaderTarget );

            var excludePathContent = new GUIContent("Exclude Path","Exclude a renderpath from shader generation");
            _excludePath = (ExcludePath)EditorGUILayout.EnumPopup( excludePathContent, _excludePath );

            GUILayout.Space(8);
            _showQueueSettings = EditorGUILayout.Foldout( _showQueueSettings, "Queue Settings" );
            if( _showQueueSettings )
            {
                var renderTypeContent = new GUIContent("Render Type","This is the rendertype tag inserted into the shader. Can be used for shader replace");
                _renderType = (RenderType)EditorGUILayout.EnumPopup( renderTypeContent, _renderType );

                if ( _renderType == RenderType.Custom )
                    _renderTypeCustom.Value = EditorGUILayout.TextField( "Custom Type" ,_renderTypeCustom.Value );

                var queueContent = new GUIContent("Render Queue","The render queue that this material will be put in");
                _queue = (Queue)EditorGUILayout.EnumPopup( queueContent, _queue );

                var offContent = new GUIContent(
                    "Queue Offset",
                    "Offset for drawing. Used to ensure some things draw before or after others, it specifically is an offset from the given queue- That is to say, you won't have a transparent object draw before an opaque object (or similar) due to this offset.");
                _queueAdjust = EditorGUILayout.IntSlider(offContent, _queueAdjust.Value, -100, 100);
            }

            GUILayout.Space( 8 );
            _showCullingAndDepthSettings = EditorGUILayout.Foldout( _showCullingAndDepthSettings, "Culling and Depth Settings" );
            if( _showCullingAndDepthSettings )
            {
                var zWriteContent = new GUIContent("Write Depth","Depth is considered when testing other objects. Disable for certain effects, like letting other things draw over yourself, or for speed on most overlays.");
                _zWrite = (ZWrite)EditorGUILayout.EnumPopup( zWriteContent, _zWrite );

                var cullModeContent = new GUIContent("CullMode","Select back / forward to clip backwards facing polygons");
                _cullMode = (CullMode)EditorGUILayout.EnumPopup( cullModeContent, _cullMode );

                var zTestContent = new GUIContent("ZTest","Select Z-Test Value");
                _zTest = (ZTest)EditorGUILayout.EnumPopup( zTestContent, _zTest );

                var enableLODContent = new GUIContent("Enable LOD","Enable Shader LOD scaling");
                _enableLOD = EditorGUILayout.BeginToggleGroup( enableLODContent, _enableLOD );
                _lod = EditorGUILayout.IntSlider( "LOD", _lod, 0, 1000 );
                EditorGUILayout.EndToggleGroup();
            }

            GUILayout.Space( 8 );
            _showBlending = EditorGUILayout.Foldout( _showBlending, "Blending Settings" );
            if( _showBlending )
            {
                var blendingTypeContent = new GUIContent("Blend Type","Use a build in blend mode or a custom blend mode");
                _blending = (BlendingType)EditorGUILayout.EnumPopup( blendingTypeContent, _blending );

                if( CustomBlendingEnabled() )
                {
                    var srcBlendContent = new GUIContent("Src Blend Mode","How the source channel of blending is used");
                    _srcBlend = (BlendingMode)EditorGUILayout.EnumPopup( srcBlendContent, _srcBlend );

                    var dstBlendContent = new GUIContent("Dst Blend Mode","How the destination channel of blending is used");
                    _dstBlend = (BlendingMode)EditorGUILayout.EnumPopup( dstBlendContent, _dstBlend );
                }
            }

            GUILayout.Space( 8 );
            _showColorAndLighting = EditorGUILayout.Foldout( _showColorAndLighting, "Color And Lighting Settings" );
            if( _showColorAndLighting )
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label( "Color Mask:", GUILayout.ExpandWidth(false) );
                _colorMaskR.Value = EditorExtensions.ToggleButton( _colorMaskR.Value, "R","Mask R Channel");
                _colorMaskG.Value = EditorExtensions.ToggleButton( _colorMaskG.Value, "G","Mask G Channel");
                _colorMaskB.Value = EditorExtensions.ToggleButton( _colorMaskB.Value, "B","Mask B Channel");
                _colorMaskA.Value = EditorExtensions.ToggleButton( _colorMaskA.Value, "A","Mask A Channel");
                GUILayout.EndHorizontal();

                _dualForward = GUILayout.Toggle( _dualForward, new GUIContent( "Forward Dual Lightmaps","Use dual lightmaps in the forward rendering path" ));
                _fullForwardShadows = GUILayout.Toggle( _fullForwardShadows, new GUIContent( "Forward Full Shadows", "Support all shadow types in Forward rendering path." ));
                _softVegetation = GUILayout.Toggle( _softVegetation, new GUIContent( "Soft Vegetation", "Makes the surface shader only be rendered when Soft Vegetation is on." ));
                _noAmbient = GUILayout.Toggle( _noAmbient, new GUIContent( "No Ambient", "Do not apply any ambient lighting or spherical harmonics lights."));
                _noLightmap = GUILayout.Toggle( _noLightmap, new GUIContent( "No Lightmaps", "Disables lightmap support in this shader (makes a shader smaller)." ));
                _addShadow = GUILayout.Toggle( _addShadow, new GUIContent( "Advanced Shadow Pass", "Performs vertex transformations and clipping for the shadow pass, you need to use this if shadows do not display properly." ));

                _ignoreProjectors = GUILayout.Toggle( _ignoreProjectors, new GUIContent( "Ignore Projectors", "Ignores projector components, should be used if your doing custom vertex transformations or most transparency" ));
                _approxview = GUILayout.Toggle( _approxview, new GUIContent( "Approximate View", "Computes normalized view direction per-vertex instead of per-pixel, for shaders that need it. This is faster, but view direction is not entirely correct when camera gets close to surface." ));
                _halfasview = GUILayout.Toggle( _halfasview, new GUIContent( "Half As View", "Pass half-direction vector into the lighting function instead of view-direction. Half-direction will be computed and normalized per vertex. This is faster, but not entirely correct." ));
                _noForwardAdd = GUILayout.Toggle( _noForwardAdd, new GUIContent( "Disable Forward Add", "Disables Forward rendering additive pass. This makes the shader support one full directional light, with all other lights computed per-vertex/SH. Makes shaders smaller as well." ));
            }

            GUILayout.Space( 8 );
            _showFogSettings = EditorGUILayout.Foldout( _showFogSettings, "Fog Settings" );
            if( _showFogSettings )
            {
                _fogModeOverride = EditorGUILayout.BeginToggleGroup( "Fog Mode Override", _fogModeOverride );
                var fogModeContent = new GUIContent("Fog Mode","The type of fog to use");
                _fogMode = (FogMode)EditorGUILayout.EnumPopup( fogModeContent, _fogMode );

                if( _fogMode == FogMode.Linear )
                {
                    _fogNearLinear.Value = EditorGUILayout.FloatField( "Near Linear Range:", _fogNearLinear );
                    _fogFarLinear.Value = EditorGUILayout.FloatField( "Far Linear Range:", _fogFarLinear );
                }
                EditorGUILayout.EndToggleGroup();

                _fogColorOverride = EditorGUILayout.BeginToggleGroup( "Fog Color Override", _fogColorOverride );
                _fogColor.Value = EditorGUILayout.ColorField("Fog Color:", _fogColor );
                EditorGUILayout.EndToggleGroup();

                _fogDensityOverride = EditorGUILayout.BeginToggleGroup( "Fog Density Override", _fogDensityOverride );
                _fogDensity.Value = EditorGUILayout.FloatField( "Fog Density:", _fogDensity );
                EditorGUILayout.EndToggleGroup();
            }
        }