Esempio n. 1
0
        public virtual void ChangedWorldConfig(GraphicsDevice gd)
        {
            //destroy any features that are no longer enabled.

            var config = WorldConfig.Current;

            if (config.AdvancedLighting)
            {
                State.AmbientLight?.Dispose();
                State.AmbientLight = null;
                Light?.Dispose();
                Light = null;
                if (Light == null)
                {
                    Light = new LMapBatch(gd, 8);
                    if (Blueprint != null)
                    {
                        Light?.Init(Blueprint);
                        Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.ROOM_CHANGED));
                        Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OUTDOORS_LIGHTING_CHANGED));
                    }
                    State.Light = Light;
                }
            }
            else
            {
                Light?.Dispose();
                Light       = null;
                State.Light = null;
                if (State.AmbientLight == null)
                {
                    State.AmbientLight = new Texture2D(gd, 256, 256);
                }
                if (Blueprint != null)
                {
                    Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OUTDOORS_LIGHTING_CHANGED));
                }
            }

            if (Blueprint != null && !FSOEnvironment.Enable3D)
            {
                var shad3D = (Blueprint.WCRC != null);
                if (config.Shadow3D != shad3D)
                {
                    if (config.AdvancedLighting && config.Shadow3D)
                    {
                        Blueprint.WCRC           = new RC.WallComponentRC();
                        Blueprint.WCRC.blueprint = Blueprint;
                        Blueprint.WCRC.Generate(gd, State, false);
                    }
                    else
                    {
                        Blueprint.WCRC?.Dispose();
                        Blueprint.WCRC = null;
                    }
                    Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OUTDOORS_LIGHTING_CHANGED));
                }
            }
        }
Esempio n. 2
0
        public void ChangedWorldConfig(GraphicsDevice gd)
        {
            //destroy any features that are no longer enabled.

            var config = WorldConfig.Current;

            if (config.AdvancedLighting)
            {
                State.AmbientLight?.Dispose();
                State.AmbientLight = null;
                if (Light == null)
                {
                    Light = new LMapBatch(gd, 8);
                    if (Blueprint != null)
                    {
                        Light?.Init(Blueprint);
                        Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.ROOM_CHANGED));
                        Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OUTDOORS_LIGHTING_CHANGED));
                    }
                    State.Light = Light;
                }
            }
            else
            {
                Light?.Dispose();
                Light       = null;
                State.Light = null;
                if (State.AmbientLight == null)
                {
                    State.AmbientLight = new Texture2D(gd, 256, 256);
                }
                if (Blueprint != null)
                {
                    Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OUTDOORS_LIGHTING_CHANGED));
                }
            }
        }
Esempio n. 3
0
        public virtual void ChangedWorldConfig(GraphicsDevice gd)
        {
            //destroy any features that are no longer enabled.

            var config = WorldConfig.Current;

            if (ForceAdvLight)
            {
                config.LightingMode = Math.Max(config.LightingMode, 1);
            }

            if (config.AdvancedLighting)
            {
                State.AmbientLight?.Dispose();
                State.AmbientLight = null;
                Light?.Dispose();
                Light = null;
                if (Light == null)
                {
                    Light = new LMapBatch(gd, 16);
                    if (Blueprint != null)
                    {
                        Light?.Init(Blueprint);
                        Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.ROOM_CHANGED));
                        Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OUTDOORS_LIGHTING_CHANGED));
                    }
                    State.Light = Light;
                }
            }
            else
            {
                Light?.Dispose();
                Light       = null;
                State.Light = null;
                if (State.AmbientLight == null)
                {
                    State.AmbientLight = new Texture2D(gd, 256, 256);
                }
                if (Blueprint != null)
                {
                    Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OUTDOORS_LIGHTING_CHANGED));
                }
            }

            if (Blueprint != null && !FSOEnvironment.Enable3D)
            {
                var shad3D = (Blueprint.WCRC != null);
                if (config.Shadow3D != shad3D)
                {
                    if (config.AdvancedLighting && config.Shadow3D)
                    {
                        Blueprint.WCRC           = new RC.WallComponentRC();
                        Blueprint.WCRC.blueprint = Blueprint;
                        Blueprint.WCRC.Generate(gd, State, false);
                    }
                    else
                    {
                        Blueprint.WCRC?.Dispose();
                        Blueprint.WCRC = null;
                    }
                    Blueprint.Damage.Add(new BlueprintDamage(BlueprintDamageType.OUTDOORS_LIGHTING_CHANGED));
                }
            }

            if (!FSOEnvironment.Enable3D)
            {
                var last = PPXDepthEngine.MSAA;
                PPXDepthEngine.MSAA = ((WorldConfig.Current.AA > 0) ? 4 : 0);
                if (last != PPXDepthEngine.MSAA)
                {
                    PPXDepthEngine.InitScreenTargets();
                }
            }
        }
Esempio n. 4
0
        public virtual void ChangedWorldConfig(GraphicsDevice gd)
        {
            //destroy any features that are no longer enabled.

            var config = WorldConfig.Current;

            if (ForceAdvLight)
            {
                config.LightingMode = Math.Max(config.LightingMode, 1);
            }
            State.DisableSmoothRotation = !config.EnableTransitions;

            if (config.AdvancedLighting)
            {
                State.AmbientLight?.Dispose();
                State.AmbientLight = null;
                Light?.Dispose();
                Light = null;
                if (Light == null)
                {
                    Light = new LMapBatch(gd, 16);
                    if (Blueprint != null)
                    {
                        Light?.Init(Blueprint);
                        Blueprint.Changes.SetFlag(BlueprintGlobalChanges.ROOM_CHANGED);
                        Blueprint.Changes.SetFlag(BlueprintGlobalChanges.OUTDOORS_LIGHTING_CHANGED);
                    }
                    State.Light = Light;
                }
            }
            else
            {
                Light?.Dispose();
                Light       = null;
                State.Light = null;
                if (State.AmbientLight == null)
                {
                    State.AmbientLight = new Texture2D(gd, 256, 256);
                }
                if (Blueprint != null)
                {
                    Blueprint.Changes.SetFlag(BlueprintGlobalChanges.OUTDOORS_LIGHTING_CHANGED);
                }
            }

            if (Blueprint != null && !FSOEnvironment.Enable3D)
            {
                var shad3D = (Blueprint.WCRC != null);
                if (config.Shadow3D != shad3D)
                {
                    if (config.AdvancedLighting && config.Shadow3D)
                    {
                        Blueprint.WCRC           = new RC.WallComponentRC();
                        Blueprint.WCRC.blueprint = Blueprint;
                        Blueprint.WCRC.Generate(gd, State, false);
                    }
                    else
                    {
                        Blueprint.WCRC?.Dispose();
                        Blueprint.WCRC = null;
                    }
                    Blueprint.Changes.SetFlag(BlueprintGlobalChanges.OUTDOORS_LIGHTING_CHANGED);
                }
            }
            ChangeAAMode(gd);
        }