示例#1
0
        public static void InitEnvironmentSettings(MyObjectBuilder_EnvironmentSettings environmentBuilder = null)
        {
            var environment = MyDefinitionManager.Static.EnvironmentDefinition;
            var o = environment.BackgroundOrientation;
            BackgroundTexture        = environment.BackgroundTexture;
            BackgroundOrientation    = Quaternion.CreateFromYawPitchRoll(o.Yaw, o.Pitch, o.Roll);
            DistanceToSun            = environment.DistanceToSun;

            SunProperties = environment.SunProperties;
            FogProperties = environment.FogProperties;

            if (environmentBuilder != null)
            {
                Vector3 sunDirection;
                Vector3.CreateFromAzimuthAndElevation(environmentBuilder.SunAzimuth, environmentBuilder.SunElevation, out sunDirection);

                SunProperties.SunDirectionNormalized = sunDirection;
                SunProperties.SunIntensity = environmentBuilder.SunIntensity;

                FogProperties.FogMultiplier = environmentBuilder.FogMultiplier;
                FogProperties.FogDensity = environmentBuilder.FogDensity;
                FogProperties.FogColor = new Color(environmentBuilder.FogColor);
                FogProperties.FogColor.A = 255;
            }
        }
示例#2
0
        public static void InitEnvironmentSettings(MyObjectBuilder_EnvironmentSettings environmentBuilder = null)
        {
            var environment = MyDefinitionManager.Static.EnvironmentDefinition;
            var o           = environment.BackgroundOrientation;

            BackgroundTexture     = environment.BackgroundTexture;
            BackgroundOrientation = Quaternion.CreateFromYawPitchRoll(o.Yaw, o.Pitch, o.Roll);
            DistanceToSun         = environment.DistanceToSun;

            SunProperties = new MySunProperties(environment.SunProperties);
            FogProperties = environment.FogProperties;

            if (environmentBuilder != null)
            {
                Vector3 sunDirection;
                Vector3.CreateFromAzimuthAndElevation(environmentBuilder.SunAzimuth, environmentBuilder.SunElevation, out sunDirection);

                SunProperties.BaseSunDirectionNormalized = sunDirection;

                SunProperties.SunDirectionNormalized = sunDirection;
                SunProperties.SunIntensity           = environmentBuilder.SunIntensity;

                FogProperties.FogMultiplier = environmentBuilder.FogMultiplier;
                FogProperties.FogDensity    = environmentBuilder.FogDensity;
                FogProperties.FogColor      = new Color(environmentBuilder.FogColor);
                FogProperties.FogColor.A    = 255;
            }
        }
示例#3
0
 public static void SetDefaults()
 {
     SunProperties          = MySunProperties.Default;
     FogProperties          = MyFogProperties.Default;
     ImpostorProperties     = new VRageRender.MyImpostorProperties[1];
     ParticleDustProperties = new MyParticleDustProperties();
 }
示例#4
0
 public static void SetDefaults()
 {
     SunProperties          = new MySunProperties(MySunProperties.Default);
     FogProperties          = MyFogProperties.Default;
     ImpostorProperties     = new VRageRender.MyImpostorProperties[1];
     ParticleDustProperties = new MyParticleDustProperties();
     GodRaysProperties      = new MyGodRaysProperties();
     BackgroundTexture      = "BackgroundCube";
 }
示例#5
0
 public static void SetDefaults()
 {
     SunProperties = MySunProperties.Default;
     FogProperties = MyFogProperties.Default;
     ImpostorProperties = new VRageRender.MyImpostorProperties[1];
     ParticleDustProperties = new MyParticleDustProperties();
     GodRaysProperties = new MyGodRaysProperties();
     BackgroundTexture = "BackgroundCube";
 }
示例#6
0
        public static void InitEnvironmentSettings(MyObjectBuilder_EnvironmentSettings environmentBuilder = null)
        {
            if (environmentBuilder != null)
            {
                EnvironmentDefinition = MyDefinitionManager.Static.GetDefinition <MyEnvironmentDefinition>(environmentBuilder.EnvironmentDefinition);
            }
            else if (EnvironmentDefinition == null)
            {
                // Fallback
                EnvironmentDefinition = MyDefinitionManager.Static.GetDefinition <MyEnvironmentDefinition>(MyStringHash.GetOrCompute("Default"));
            }

            var environment = EnvironmentDefinition;

            SunProperties = environment.SunProperties;
            FogProperties = environment.FogProperties;
            SSAOSettings  = environment.SSAOSettings;
            HBAOSettings  = environment.HBAOSettings;
            ShadowSettings.CopyFrom(environment.ShadowSettings);
            NewPipelineSettings.CopyFrom(environment.NewPipelineSettings);
            SunRotationAxis = SunProperties.SunRotationAxis;

            MyRenderProxy.UpdateShadowsSettings(ShadowSettings);
            MyRenderProxy.UpdateNewPipelineSettings(NewPipelineSettings);
            MySector.Lodding.UpdatePreset(environment.UserLoddingSettings, environment.LowLoddingSettings, environment.MediumLoddingSettings, environment.HighLoddingSettings);

            MyMaterialsSettings materialsSettings = new MyMaterialsSettings();

            materialsSettings.CopyFrom(environment.MaterialsSettings);
            MyRenderProxy.UpdateMaterialsSettings(materialsSettings);

            // TODO: Delete MyPostprocessSettingsWrapper and move to have bundled
            // settings in MySector and change all references to point here
            MyPostprocessSettingsWrapper.Settings = environment.PostProcessSettings;

            if (environmentBuilder != null)
            {
                Vector3 sunDirection;
                Vector3.CreateFromAzimuthAndElevation(environmentBuilder.SunAzimuth, environmentBuilder.SunElevation, out sunDirection);
                sunDirection.Normalize();

                SunProperties.BaseSunDirectionNormalized = sunDirection;
                SunProperties.SunDirectionNormalized     = sunDirection;
                //SunProperties.SunIntensity = environmentBuilder.SunIntensity;

                FogProperties.FogMultiplier = environmentBuilder.FogMultiplier;
                FogProperties.FogDensity    = environmentBuilder.FogDensity;
                FogProperties.FogColor      = new Color(environmentBuilder.FogColor);
            }
        }
示例#7
0
        public static void InitEnvironmentSettings(MyObjectBuilder_EnvironmentSettings environmentBuilder = null)
        {
            if (environmentBuilder != null)
            {
                EnvironmentDefinition = MyDefinitionManager.Static.GetDefinition <MyEnvironmentDefinition>(environmentBuilder.EnvironmentDefinition);
            }
            else if (EnvironmentDefinition == null)
            {
                // Fallback
                EnvironmentDefinition = MyDefinitionManager.Static.GetDefinition <MyEnvironmentDefinition>(MyStringHash.GetOrCompute("Default"));
            }

            var environment = EnvironmentDefinition;
            var o           = environment.BackgroundOrientation;

            BackgroundTexture                 = environment.BackgroundTexture;
            BackgroundTextureNight            = environment.BackgroundTextureNight;
            BackgroundTextureNightPrefiltered = environment.BackgroundTextureNightPrefiltered;
            BackgroundOrientation             = Quaternion.CreateFromYawPitchRoll(o.Yaw, o.Pitch, o.Roll);
            DistanceToSun = environment.DistanceToSun;

            SunProperties = new MySunProperties(environment.SunProperties);
            FogProperties = environment.FogProperties;

            if (environmentBuilder != null)
            {
                Vector3 sunDirection;
                Vector3.CreateFromAzimuthAndElevation(environmentBuilder.SunAzimuth, environmentBuilder.SunElevation, out sunDirection);

                SunProperties.SunDirectionNormalized = sunDirection;
                SunProperties.SunIntensity           = environmentBuilder.SunIntensity;

                FogProperties.FogMultiplier = environmentBuilder.FogMultiplier;
                FogProperties.FogDensity    = environmentBuilder.FogDensity;
                FogProperties.FogColor      = new Color(environmentBuilder.FogColor);
                FogProperties.FogColor.A    = 255;
            }
        }