Beispiel #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));
                }
            }
        }
Beispiel #2
0
        public override void ChangedWorldConfig(GraphicsDevice gd)
        {
            //destroy any features that are no longer enabled.

            var config = WorldConfig.Current;

            if (config.AdvancedLighting && config.Complex)
            {
                State.AmbientLight?.Dispose();
                State.AmbientLight = null;
                Light?.Dispose();
                Light = null;
                if (Light == null)
                {
                    Light = new LMapBatch(gd, 6);
                    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 (Blueprint != null && !FSOEnvironment.Enable3D)
            {
                var shad3D = (Blueprint.WCRC != null);
                if (config.Shadow3D != shad3D)
                {
                    if (Light != null && 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);
                }
            }
        }
Beispiel #3
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));
                }
            }
        }
Beispiel #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);
            }

            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();
                }
            }
        }
Beispiel #5
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);
        }