protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            MyObjectBuilder_EnvironmentDefinition objBuilder = (MyObjectBuilder_EnvironmentDefinition)builder;

            BackgroundTexture = objBuilder.EnvironmentTexture;
            BackgroundOrientation = new MyOrientation(
                MathHelper.ToRadians(objBuilder.EnvironmentOrientation.Yaw),
                MathHelper.ToRadians(objBuilder.EnvironmentOrientation.Pitch),
                MathHelper.ToRadians(objBuilder.EnvironmentOrientation.Roll));

            SmallShipMaxSpeed = objBuilder.SmallShipMaxSpeed;
            LargeShipMaxSpeed = objBuilder.LargeShipMaxSpeed;
			EnvironmentalParticles = objBuilder.EnvironmentalParticles;
            SmallShipMaxAngularSpeed = objBuilder.SmallShipMaxAngularSpeed;
            LargeShipMaxAngularSpeed = objBuilder.LargeShipMaxAngularSpeed;
            FogProperties.Deserialize(objBuilder);
            SunProperties.Deserialize(objBuilder);
        }
		protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            MyObjectBuilder_EnvironmentDefinition objBuilder = (MyObjectBuilder_EnvironmentDefinition)builder;
            FogProperties = objBuilder.FogProperties;
            SunProperties = objBuilder.SunProperties;
            PostProcessSettings = objBuilder.PostProcessSettings;
            SSAOSettings = objBuilder.SSAOSettings;
            HBAOSettings = objBuilder.HBAOSettings;
            ShadowSettings.CopyFrom(objBuilder.ShadowSettings);
            SmallShipMaxSpeed = objBuilder.SmallShipMaxSpeed;
            LargeShipMaxSpeed = objBuilder.LargeShipMaxSpeed;
            SmallShipMaxAngularSpeed = objBuilder.SmallShipMaxAngularSpeed;
            LargeShipMaxAngularSpeed = objBuilder.LargeShipMaxAngularSpeed;
            ContourHighlightColor = new Color(objBuilder.ContourHighlightColor);
            ContourHighlightThickness = objBuilder.ContourHighlightThickness;
            HighlightPulseInSeconds = objBuilder.HighlightPulseInSeconds;
            EnvironmentTexture = objBuilder.EnvironmentTexture;
            EnvironmentOrientation = objBuilder.EnvironmentOrientation;
        }
		public void Merge(MyEnvironmentDefinition src)
		{
			if (src.BackgroundTexture != m_defaults.BackgroundTexture)
			{
				BackgroundTexture = src.BackgroundTexture;
			}

			if (Math.Abs(src.BackgroundOrientation.Yaw - m_defaults.BackgroundOrientation.Yaw) > DELTA ||
				Math.Abs(src.BackgroundOrientation.Pitch - m_defaults.BackgroundOrientation.Pitch) > DELTA ||
				Math.Abs(src.BackgroundOrientation.Roll - m_defaults.BackgroundOrientation.Roll) > DELTA)
			{
				BackgroundOrientation = src.BackgroundOrientation;
			}

			if (src.DistanceToSun != m_defaults.DistanceToSun)
			{
				DistanceToSun = src.DistanceToSun;
			}

			MergeSunProperties(src);
			MergeFogProperties(src);

			if(!src.EnvironmentalParticles.Equals(m_defaults.EnvironmentalParticles))
			{
				foreach(var particleEffect in src.EnvironmentalParticles)
				{
					if (EnvironmentalParticles.Contains(particleEffect))
						continue;
					EnvironmentalParticles.Add(particleEffect);
				}
			}
				
			

			if (src.LargeShipMaxSpeed != m_defaults.LargeShipMaxSpeed)
			{
				LargeShipMaxSpeed = src.LargeShipMaxSpeed;
			}
			if (src.SmallShipMaxSpeed != m_defaults.SmallShipMaxSpeed)
			{
				SmallShipMaxSpeed = src.SmallShipMaxSpeed;
			}
			if (src.m_smallShipMaxAngularSpeed != m_defaults.m_smallShipMaxAngularSpeed)
			{
				SmallShipMaxAngularSpeed = src.m_smallShipMaxAngularSpeed;
			}
			if (src.m_largeShipMaxAngularSpeed != m_defaults.m_largeShipMaxAngularSpeed)
			{
				LargeShipMaxAngularSpeed = src.m_largeShipMaxAngularSpeed;
			}
		}
		public void Merge(MyEnvironmentDefinition src)
		{
			if (src.BackgroundTexture != m_defaults.BackgroundTexture)
			{
				BackgroundTexture = src.BackgroundTexture;
			}

			if (Math.Abs(src.BackgroundOrientation.Yaw - m_defaults.BackgroundOrientation.Yaw) > DELTA ||
				Math.Abs(src.BackgroundOrientation.Pitch - m_defaults.BackgroundOrientation.Pitch) > DELTA ||
				Math.Abs(src.BackgroundOrientation.Roll - m_defaults.BackgroundOrientation.Roll) > DELTA)
			{
				BackgroundOrientation = src.BackgroundOrientation;
			}

			if (src.DistanceToSun != m_defaults.DistanceToSun)
			{
				DistanceToSun = src.DistanceToSun;
			}

			MergeSunProperties(src);
			MergeFogProperties(src);

			if(src.EnvironmentalParticles != m_defaults.EnvironmentalParticles)
				EnvironmentalParticles = src.EnvironmentalParticles;

			if (src.LargeShipMaxSpeed != m_defaults.LargeShipMaxSpeed)
			{
				LargeShipMaxSpeed = src.LargeShipMaxSpeed;
			}
			if (src.SmallShipMaxSpeed != m_defaults.SmallShipMaxSpeed)
			{
				SmallShipMaxSpeed = src.SmallShipMaxSpeed;
			}
			if (src.m_smallShipMaxAngularSpeed != m_defaults.m_smallShipMaxAngularSpeed)
			{
				SmallShipMaxAngularSpeed = src.m_smallShipMaxAngularSpeed;
			}
			if (src.m_largeShipMaxAngularSpeed != m_defaults.m_largeShipMaxAngularSpeed)
			{
				LargeShipMaxAngularSpeed = src.m_largeShipMaxAngularSpeed;
			}
		}
		protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            MyObjectBuilder_EnvironmentDefinition objBuilder = (MyObjectBuilder_EnvironmentDefinition)builder;

            BackgroundTexture                 = objBuilder.EnvironmentTexture;
            BackgroundTextureNight            = objBuilder.EnvironmentTextureNight ?? BackgroundTexture;
            BackgroundTextureNightPrefiltered = objBuilder.EnvironmentTextureNightPrefiltered ?? BackgroundTextureNight;
            BackgroundOrientation = new MyOrientation(
                MathHelper.ToRadians(objBuilder.EnvironmentOrientation.Yaw),
                MathHelper.ToRadians(objBuilder.EnvironmentOrientation.Pitch),
                MathHelper.ToRadians(objBuilder.EnvironmentOrientation.Roll));

            SmallShipMaxSpeed = objBuilder.SmallShipMaxSpeed;
            LargeShipMaxSpeed = objBuilder.LargeShipMaxSpeed;
			EnvironmentalParticles = objBuilder.EnvironmentalParticles;
            SmallShipMaxAngularSpeed = objBuilder.SmallShipMaxAngularSpeed;
            LargeShipMaxAngularSpeed = objBuilder.LargeShipMaxAngularSpeed;
            ContourHighlightColor = new Color(objBuilder.ContourHighlightColor);
            ContourHighlightThickness = objBuilder.ContourHighlightThickness;
            HighlightPulseInSeconds = objBuilder.HighlightPulseInSeconds;
            FogProperties.Deserialize(objBuilder);
            SunProperties.Deserialize(objBuilder);
        }
		public void Merge(MyEnvironmentDefinition src)
		{
			if (src.BackgroundTexture != m_defaults.BackgroundTexture)
			{
				BackgroundTexture = src.BackgroundTexture;
			}

            if (src.BackgroundTextureNight != m_defaults.BackgroundTextureNight)
            {
                BackgroundTextureNight = src.BackgroundTextureNight;
            }

            if (src.BackgroundTextureNightPrefiltered != m_defaults.BackgroundTextureNightPrefiltered)
            {
                BackgroundTextureNightPrefiltered = src.BackgroundTextureNightPrefiltered;
            }

			if (Math.Abs(src.BackgroundOrientation.Yaw - m_defaults.BackgroundOrientation.Yaw) > DELTA ||
				Math.Abs(src.BackgroundOrientation.Pitch - m_defaults.BackgroundOrientation.Pitch) > DELTA ||
				Math.Abs(src.BackgroundOrientation.Roll - m_defaults.BackgroundOrientation.Roll) > DELTA)
			{
				BackgroundOrientation = src.BackgroundOrientation;
			}

			if (src.DistanceToSun != m_defaults.DistanceToSun)
			{
				DistanceToSun = src.DistanceToSun;
			}

			MergeSunProperties(src);
			MergeFogProperties(src);

			if(!src.EnvironmentalParticles.Equals(m_defaults.EnvironmentalParticles))
			{
				foreach(var particleEffect in src.EnvironmentalParticles)
				{
					if (EnvironmentalParticles.Contains(particleEffect))
						continue;
					EnvironmentalParticles.Add(particleEffect);
				}
			}
				
			

			if (src.LargeShipMaxSpeed != m_defaults.LargeShipMaxSpeed)
			{
				LargeShipMaxSpeed = src.LargeShipMaxSpeed;
			}
			if (src.SmallShipMaxSpeed != m_defaults.SmallShipMaxSpeed)
			{
				SmallShipMaxSpeed = src.SmallShipMaxSpeed;
			}
			if (src.m_smallShipMaxAngularSpeed != m_defaults.m_smallShipMaxAngularSpeed)
			{
				SmallShipMaxAngularSpeed = src.m_smallShipMaxAngularSpeed;
			}
			if (src.m_largeShipMaxAngularSpeed != m_defaults.m_largeShipMaxAngularSpeed)
			{
				LargeShipMaxAngularSpeed = src.m_largeShipMaxAngularSpeed;
			}
            if (src.ContourHighlightColor != m_defaults.ContourHighlightColor)
            {
                ContourHighlightColor = src.ContourHighlightColor;
            }
            if (src.ContourHighlightThickness != m_defaults.ContourHighlightThickness)
            {
                ContourHighlightThickness = src.ContourHighlightThickness;
            }

            if(src.HighlightPulseInSeconds != m_defaults.HighlightPulseInSeconds)
            {
                HighlightPulseInSeconds = src.HighlightPulseInSeconds;
            }
		}