private void MergeFogProperties(MyEnvironmentDefinition src)
        {
            if (src.FogProperties.EnableFog != m_defaults.FogProperties.EnableFog)
            {
                FogProperties.EnableFog = src.FogProperties.EnableFog;
            }

            if (src.FogProperties.FogNear != m_defaults.FogProperties.FogNear)
            {
                FogProperties.FogNear = src.FogProperties.FogNear;
            }

            if (src.FogProperties.FogFar != m_defaults.FogProperties.FogFar)
            {
                FogProperties.FogFar = src.FogProperties.FogFar;
            }

            if (src.FogProperties.FogMultiplier != m_defaults.FogProperties.FogMultiplier)
            {
                FogProperties.FogMultiplier = src.FogProperties.FogMultiplier;
            }

            if (src.FogProperties.FogBacklightMultiplier != m_defaults.FogProperties.FogBacklightMultiplier)
            {
                FogProperties.FogBacklightMultiplier = src.FogProperties.FogBacklightMultiplier;
            }

            if (src.FogProperties.FogColor != m_defaults.FogProperties.FogColor)
            {
                FogProperties.FogColor = src.FogProperties.FogColor;
            }
        }
            public void Clear()
            {
                m_cubeSizes       = new float[typeof(MyCubeSize).GetEnumValues().Length];
                m_basePrefabNames = new string[m_cubeSizes.Length * 4]; // Index computed 4 * enumInt + 2*static + creative.

                m_definitionsById = new DefinitionDictionary <MyDefinitionBase>(100);

                m_voxelMaterialsByName   = new Dictionary <string, MyVoxelMaterialDefinition>(10);
                m_voxelMaterialsByIndex  = new Dictionary <byte, MyVoxelMaterialDefinition>(10);
                m_voxelMaterialRareCount = 0;

                m_physicalItemDefinitions = new List <MyPhysicalItemDefinition>(10);

                m_weaponDefinitionsById = new DefinitionDictionary <MyWeaponDefinition>(10);
                m_ammoDefinitionsById   = new DefinitionDictionary <MyAmmoDefinition>(10);

                m_blockPositions         = new Dictionary <string, Vector2I>(10);
                m_uniqueCubeBlocksBySize = new DefinitionDictionary <MyCubeBlockDefinition> [m_cubeSizes.Length];
                for (int i = 0; i < m_cubeSizes.Length; ++i)
                {
                    m_uniqueCubeBlocksBySize[i] = new DefinitionDictionary <MyCubeBlockDefinition>(10);
                }

                m_blueprintsById = new DefinitionDictionary <MyBlueprintDefinitionBase>(10);

                m_spawnGroupDefinitions = new List <MySpawnGroupDefinition>(10);

                m_containerTypeDefinitions = new DefinitionDictionary <MyContainerTypeDefinition>(10);

                m_handItemsById             = new DefinitionDictionary <MyHandItemDefinition>(10);
                m_physicalItemsByHandItemId = new DefinitionDictionary <MyPhysicalItemDefinition>(m_handItemsById.Count);
                m_handItemsByPhysicalItemId = new DefinitionDictionary <MyHandItemDefinition>(m_handItemsById.Count);

                m_scenarioDefinitions      = new List <MyScenarioDefinition>(10);
                m_characters               = new Dictionary <string, MyCharacterDefinition>();
                m_animationsBySkeletonType = new Dictionary <string, Dictionary <string, MyAnimationDefinition> >();

                m_blueprintClasses      = new DefinitionDictionary <MyBlueprintClassDefinition>(10);
                m_blueprintClassEntries = new HashSet <BlueprintClassEntry>();
                m_blueprintsByResultId  = new DefinitionDictionary <MyBlueprintDefinitionBase>(10);

                m_environmentItemsEntries = new HashSet <EnvironmentItemsEntry>();

                m_categoryClasses = new List <MyGuiBlockCategoryDefinition>(25);
                m_categories      = new Dictionary <string, MyGuiBlockCategoryDefinition>(25);

                m_prefabs      = new Dictionary <string, MyPrefabDefinition>();
                m_respawnShips = new Dictionary <string, MyRespawnShipDefinition>();

                m_sounds              = new DefinitionDictionary <MyAudioDefinition>(10);
                m_environmentDef      = new MyEnvironmentDefinition();
                m_behaviorDefinitions = new DefinitionDictionary <MyBehaviorDefinition>(10);
                m_voxelMapStorages    = new Dictionary <string, MyVoxelMapStorageDefinition>(64);
                m_characterNames      = new List <MyCharacterName>(32);

                m_battleDefinition = new MyBattleDefinition();
            }
示例#3
0
        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;
            }
        }
示例#4
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);
            SunRotationAxis = SunProperties.SunRotationAxis;

            MyRenderProxy.UpdateShadowsSettings(ShadowSettings);

            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;
            MyPostprocessSettingsWrapper.PlanetSettings = 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);
            }
        }
示例#5
0
        public void Merge(MyEnvironmentDefinition src)
        {
            MyEnvironmentDefinition other = new MyEnvironmentDefinition {
                Id = src.Id,
                DisplayNameEnum     = src.DisplayNameEnum,
                DescriptionEnum     = src.DescriptionEnum,
                DisplayNameString   = src.DisplayNameString,
                DescriptionString   = src.DescriptionString,
                Icons               = src.Icons,
                Enabled             = src.Enabled,
                Public              = src.Public,
                AvailableInSurvival = src.AvailableInSurvival,
                Context             = src.Context
            };

            MyMergeHelper.Merge <MyEnvironmentDefinition>(this, src, other);
        }
示例#6
0
        public void Merge(MyEnvironmentDefinition src)
        {
            MyEnvironmentDefinition defaults = new MyEnvironmentDefinition();

            // TODO: Find better way to avoid MyDefinitionBase fields to be merged
            defaults.Id = src.Id;
            defaults.DisplayNameEnum     = src.DisplayNameEnum;
            defaults.DescriptionEnum     = src.DescriptionEnum;
            defaults.DisplayNameString   = src.DisplayNameString;
            defaults.DescriptionString   = src.DescriptionString;
            defaults.Icons               = src.Icons;
            defaults.Enabled             = src.Enabled;
            defaults.Public              = src.Public;
            defaults.AvailableInSurvival = src.AvailableInSurvival;
            defaults.Context             = src.Context;

            MyMergeHelper.Merge(this, src, defaults);
        }
        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;
            }
        }
        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.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 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;
            }
        }
        private void MergeSunProperties(MyEnvironmentDefinition src)
        {
            if (src.SunProperties.AmbientColor != m_defaults.SunProperties.AmbientColor)
            {
                SunProperties.AmbientColor = src.SunProperties.AmbientColor;
            }

            if (src.SunProperties.AmbientMultiplier != m_defaults.SunProperties.AmbientMultiplier)
            {
                SunProperties.AmbientMultiplier = src.SunProperties.AmbientMultiplier;
            }

            if (src.SunProperties.BackgroundColor != m_defaults.SunProperties.BackgroundColor)
            {
                SunProperties.BackgroundColor = src.SunProperties.BackgroundColor;
            }

            if (src.SunProperties.AdditionalSunDiffuse != m_defaults.SunProperties.AdditionalSunDiffuse)
            {
                SunProperties.AdditionalSunDiffuse = src.SunProperties.AdditionalSunDiffuse;
            }

            if (src.SunProperties.AdditionalSunIntensity != m_defaults.SunProperties.AdditionalSunIntensity)
            {
                SunProperties.AdditionalSunIntensity = src.SunProperties.AdditionalSunIntensity;
            }

            if (src.SunProperties.AdditionalSunDirection != m_defaults.SunProperties.AdditionalSunDirection)
            {
                SunProperties.AdditionalSunDirection = src.SunProperties.AdditionalSunDirection;
            }

            if (src.SunProperties.EnvironmentAmbientIntensity != m_defaults.SunProperties.EnvironmentAmbientIntensity)
            {
                SunProperties.EnvironmentAmbientIntensity = src.SunProperties.EnvironmentAmbientIntensity;
            }

            if (src.SunProperties.SunDiffuse != m_defaults.SunProperties.SunDiffuse)
            {
                SunProperties.SunDiffuse = src.SunProperties.SunDiffuse;
            }

            if (src.SunProperties.SunIntensity != m_defaults.SunProperties.SunIntensity)
            {
                SunProperties.SunIntensity = src.SunProperties.SunIntensity;
            }

            if (src.SunProperties.SunMaterial != m_defaults.SunProperties.SunMaterial)
            {
                SunProperties.SunMaterial = src.SunProperties.SunMaterial;
            }

            if (src.SunProperties.SunSizeMultiplier != m_defaults.SunProperties.SunSizeMultiplier)
            {
                SunProperties.SunSizeMultiplier = src.SunProperties.SunSizeMultiplier;
            }

            if (src.SunProperties.SunSpecular != m_defaults.SunProperties.SunSpecular)
            {
                SunProperties.SunSpecular = src.SunProperties.SunSpecular;
            }

            if (src.SunProperties.SunDirectionNormalized != m_defaults.SunProperties.SunDirectionNormalized)
            {
                SunProperties.SunDirectionNormalized = src.SunProperties.SunDirectionNormalized;
            }
        }
        public void Merge(MyEnvironmentDefinition src)
        {
            MyEnvironmentDefinition defaults = new MyEnvironmentDefinition();

            // TODO: Find better way to avoid MyDefinitionBase fields to be merged
            defaults.Id = src.Id;
            defaults.DisplayNameEnum = src.DisplayNameEnum;
            defaults.DescriptionEnum = src.DescriptionEnum;
            defaults.DisplayNameString = src.DisplayNameString;
            defaults.DescriptionString = src.DescriptionString;
            defaults.Icons = src.Icons;
            defaults.Enabled = src.Enabled;
            defaults.Public = src.Public;
            defaults.AvailableInSurvival = src.AvailableInSurvival;
            defaults.Context = src.Context;

            MyMergeHelper.Merge(this, src, defaults);
        }
        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;
            }
        }
		private void MergeFogProperties(MyEnvironmentDefinition src)
		{
			if (src.FogProperties.EnableFog != m_defaults.FogProperties.EnableFog)
			{
				FogProperties.EnableFog = src.FogProperties.EnableFog;
			}

			if (src.FogProperties.FogNear != m_defaults.FogProperties.FogNear)
			{
				FogProperties.FogNear = src.FogProperties.FogNear;
			}

			if (src.FogProperties.FogFar != m_defaults.FogProperties.FogFar)
			{
				FogProperties.FogFar = src.FogProperties.FogFar;
			}

			if (src.FogProperties.FogMultiplier != m_defaults.FogProperties.FogMultiplier)
			{
				FogProperties.FogMultiplier = src.FogProperties.FogMultiplier;
			}

			if (src.FogProperties.FogBacklightMultiplier != m_defaults.FogProperties.FogBacklightMultiplier)
			{
				FogProperties.FogBacklightMultiplier = src.FogProperties.FogBacklightMultiplier;
			}

			if (src.FogProperties.FogColor != m_defaults.FogProperties.FogColor)
			{
				FogProperties.FogColor = src.FogProperties.FogColor;
			}

            if (src.FogProperties.FogDensity != m_defaults.FogProperties.FogDensity)
            {
                FogProperties.FogDensity = src.FogProperties.FogDensity;
            }
		}
		private void MergeSunProperties(MyEnvironmentDefinition src)
		{
			if (src.SunProperties.AmbientColor != m_defaults.SunProperties.AmbientColor)
			{
				SunProperties.AmbientColor = src.SunProperties.AmbientColor;
			}

			if (src.SunProperties.AmbientMultiplier != m_defaults.SunProperties.AmbientMultiplier)
			{
				SunProperties.AmbientMultiplier = src.SunProperties.AmbientMultiplier;
			}

			if (src.SunProperties.BackgroundColor != m_defaults.SunProperties.BackgroundColor)
			{
				SunProperties.BackgroundColor = src.SunProperties.BackgroundColor;
			}

			if (src.SunProperties.BackSunDiffuse != m_defaults.SunProperties.BackSunDiffuse)
			{
				SunProperties.BackSunDiffuse = src.SunProperties.BackSunDiffuse;
			}

			if (src.SunProperties.BackSunIntensity != m_defaults.SunProperties.BackSunIntensity)
			{
				SunProperties.BackSunIntensity = src.SunProperties.BackSunIntensity;
			}

			if (src.SunProperties.EnvironmentAmbientIntensity != m_defaults.SunProperties.EnvironmentAmbientIntensity)
			{
				SunProperties.EnvironmentAmbientIntensity = src.SunProperties.EnvironmentAmbientIntensity;
			}

			if (src.SunProperties.SunDiffuse != m_defaults.SunProperties.SunDiffuse)
			{
				SunProperties.SunDiffuse = src.SunProperties.SunDiffuse;
			}

			if (src.SunProperties.SunIntensity != m_defaults.SunProperties.SunIntensity)
			{
				SunProperties.SunIntensity = src.SunProperties.SunIntensity;
			}

			if (src.SunProperties.SunMaterial != m_defaults.SunProperties.SunMaterial)
			{
				SunProperties.SunMaterial = src.SunProperties.SunMaterial;
			}

			if (src.SunProperties.SunSizeMultiplier != m_defaults.SunProperties.SunSizeMultiplier)
			{
				SunProperties.SunSizeMultiplier = src.SunProperties.SunSizeMultiplier;
			}

			if (src.SunProperties.SunSpecular != m_defaults.SunProperties.SunSpecular)
			{
				SunProperties.SunSpecular = src.SunProperties.SunSpecular;
			}

			if (src.SunProperties.SunDirectionNormalized != m_defaults.SunProperties.SunDirectionNormalized)
			{
				SunProperties.SunDirectionNormalized = src.SunProperties.SunDirectionNormalized;
			}
		}
		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;
			}
		}
示例#16
0
            public void Clear(bool unload = false)
            {
                base.Clear();

                m_cubeSizes       = new float[typeof(MyCubeSize).GetEnumValues().Length];
                m_basePrefabNames = new string[m_cubeSizes.Length * 4]; // Index computed 4 * enumInt + 2*static + creative.

                m_definitionsById = new DefinitionDictionary <MyDefinitionBase>(100);

                m_voxelMaterialsByName   = new Dictionary <string, MyVoxelMaterialDefinition>(10);
                m_voxelMaterialsByIndex  = new Dictionary <byte, MyVoxelMaterialDefinition>(10);
                m_voxelMaterialRareCount = 0;

                m_physicalItemDefinitions = new List <MyPhysicalItemDefinition>(10);

                m_weaponDefinitionsById = new DefinitionDictionary <MyWeaponDefinition>(10);
                m_ammoDefinitionsById   = new DefinitionDictionary <MyAmmoDefinition>(10);

                m_blockPositions         = new Dictionary <string, Vector2I>(10);
                m_uniqueCubeBlocksBySize = new DefinitionDictionary <MyCubeBlockDefinition> [m_cubeSizes.Length];
                for (int i = 0; i < m_cubeSizes.Length; ++i)
                {
                    m_uniqueCubeBlocksBySize[i] = new DefinitionDictionary <MyCubeBlockDefinition>(10);
                }

                m_blueprintsById = new DefinitionDictionary <MyBlueprintDefinitionBase>(10);

                m_spawnGroupDefinitions = new List <MySpawnGroupDefinition>(10);

                m_containerTypeDefinitions = new DefinitionDictionary <MyContainerTypeDefinition>(10);

                m_handItemsById             = new DefinitionDictionary <MyHandItemDefinition>(10);
                m_physicalItemsByHandItemId = new DefinitionDictionary <MyPhysicalItemDefinition>(m_handItemsById.Count);
                m_handItemsByPhysicalItemId = new DefinitionDictionary <MyHandItemDefinition>(m_handItemsById.Count);

                m_scenarioDefinitions      = new List <MyScenarioDefinition>(10);
                m_characters               = new Dictionary <string, MyCharacterDefinition>();
                m_animationsBySkeletonType = new Dictionary <string, Dictionary <string, MyAnimationDefinition> >();

                m_blueprintClasses      = new DefinitionDictionary <MyBlueprintClassDefinition>(10);
                m_blueprintClassEntries = new HashSet <BlueprintClassEntry>();
                m_blueprintsByResultId  = new DefinitionDictionary <MyBlueprintDefinitionBase>(10);

                m_environmentItemsEntries = new HashSet <EnvironmentItemsEntry>();
                m_componentBlockEntries   = new HashSet <MyComponentBlockEntry>();

                m_componentBlocks    = new HashSet <MyDefinitionId>(MyDefinitionId.Comparer);
                m_componentIdToBlock = new Dictionary <MyDefinitionId, MyCubeBlockDefinition>(MyDefinitionId.Comparer);

                m_categoryClasses = new List <MyGuiBlockCategoryDefinition>(25);
                m_categories      = new Dictionary <string, MyGuiBlockCategoryDefinition>(25);

                m_prefabs      = new Dictionary <string, MyPrefabDefinition>();
                m_respawnShips = new Dictionary <string, MyRespawnShipDefinition>();

                m_sounds              = new DefinitionDictionary <MyAudioDefinition>(10);
                m_environmentDef      = new MyEnvironmentDefinition();
                m_behaviorDefinitions = new DefinitionDictionary <MyBehaviorDefinition>(10);
                m_voxelMapStorages    = new Dictionary <string, MyVoxelMapStorageDefinition>(64);
                m_characterNames      = new List <MyCharacterName>(32);

                m_battleDefinition = new MyBattleDefinition();

                m_planetGeneratorDefinitions = new DefinitionDictionary <MyPlanetGeneratorDefinition>(5);

                m_componentGroups       = new DefinitionDictionary <MyComponentGroupDefinition>(4);
                m_componentGroupMembers = new Dictionary <MyDefinitionId, MyTuple <int, MyComponentGroupDefinition> >();

                m_planetPrefabDefinitions = new DefinitionDictionary <MyPlanetPrefabDefinition>(5);

                m_groupedIds = new Dictionary <string, Dictionary <string, MyGroupedIds> >();

                m_scriptedGroupDefinitions = new DefinitionDictionary <MyScriptedGroupDefinition>(10);
                m_pirateAntennaDefinitions = new DefinitionDictionary <MyPirateAntennaDefinition>(4);

                m_componentSubstitutions = new Dictionary <MyDefinitionId, MyComponentSubstitutionDefinition>();

                m_destructionDefinition = new MyDestructionDefinition();

                m_mapMultiBlockDefToCubeBlockDef = new Dictionary <string, MyCubeBlockDefinition>();
                m_factionDefinitionsByTag.Clear();

                m_idToRope = new Dictionary <MyDefinitionId, MyRopeDefinition>(MyDefinitionId.Comparer);

                m_gridCreateDefinitions = new DefinitionDictionary <MyGridCreateToolDefinition>(3);

                m_entityComponentDefinitions = new DefinitionDictionary <MyComponentDefinitionBase>(10);
                m_entityContainers           = new DefinitionDictionary <MyContainerDefinition>(10);
                if (unload)
                {
                    m_physicalMaterialsByName = new Dictionary <string, MyPhysicalMaterialDefinition>();
                }

                m_lootBagDefinition = null;
            }
		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;
            }
		}