static BiomeLoader() { ComponentTypeRegistory = new ComponentTypeRegistory(); NoiseHelper.SetTypeDefinitionNames(ComponentTypeRegistory); // 利用可能な実体の型を全て登録しておく。 ComponentTypeRegistory.SetTypeDefinitionName(typeof(DefaultBiome)); ComponentTypeRegistory.SetTypeDefinitionName(typeof(DefaultBiome.Range)); }
static ChunkProcedureLoader() { ComponentTypeRegistory = new ComponentTypeRegistory(); // 利用可能な実体の型を全て登録しておく。 NoiseHelper.SetTypeDefinitionNames(ComponentTypeRegistory); ComponentTypeRegistory.SetTypeDefinitionName(typeof(FlatTerrainProcedure)); ComponentTypeRegistory.SetTypeDefinitionName(typeof(DefaultTerrainProcedure)); }
static BiomeManagerLoader() { ComponentTypeRegistory = new ComponentTypeRegistory(); // 利用可能な実体の型を全て登録しておく。 ComponentTypeRegistory.SetTypeDefinitionName(typeof(SingleBiomeManager)); }
static void Main(string[] args) { //================================================================ // // Shared ComponentTypeRegistory // var typeRegistory = new ComponentTypeRegistory(); typeRegistory.SetTypeDefinitionName(typeof(SCurve5)); typeRegistory.SetTypeDefinitionName(typeof(Perlin)); typeRegistory.SetTypeDefinitionName(typeof(SumFractal)); typeRegistory.SetTypeDefinitionName(typeof(ScaleBias)); //================================================================ // // ComponentInfoManager // var componentInfoManager = new ComponentInfoManager(typeRegistory); //================================================================ // // ComponentBundleBuilder // var myNoise = new ScaleBias { Scale = 0.5f, Bias = 0.5f, Source = new SumFractal { Source = new Perlin { Seed = 300, FadeCurve = new SCurve5() } } }; var builder = new ComponentBundleBuilder(componentInfoManager); builder.Add("scaleBias", myNoise); //================================================================ // // Serialization // ComponentBundleDefinition definition; builder.BuildDefinition(out definition); var xmlSerializer = new XmlSerializerAdapter(typeof(ComponentBundleDefinition)); xmlSerializer.WriterSettings.Indent = true; xmlSerializer.WriterSettings.OmitXmlDeclaration = true; var resource = FileResourceLoader.Instance.LoadResource("file:///" + Directory.GetCurrentDirectory() + "/Noise.xml"); using (var stream = resource.Create()) { xmlSerializer.Serialize(stream, definition); } //================================================================ // // Deserialization // ComponentBundleDefinition deserializedDefinition; using (var stream = resource.Open()) { deserializedDefinition = (ComponentBundleDefinition)xmlSerializer.Deserialize(stream, null); } //================================================================ // // Exit // Console.WriteLine("Press Enter to exit."); Console.ReadLine(); }
static RegionLoader() { ComponentTypeRegistory = new ComponentTypeRegistory(); ComponentTypeRegistory.SetTypeDefinitionName(typeof(FlatTerrainProcedure), "FlatTerrain"); }
public static void SetTypeDefinitionNames(ComponentTypeRegistory typeRegistory) { if (typeRegistory == null) { throw new ArgumentNullException("typeRegistory"); } // Face curves. typeRegistory.SetTypeDefinitionName(typeof(NoFadeCurve)); typeRegistory.SetTypeDefinitionName(typeof(SCurve3)); typeRegistory.SetTypeDefinitionName(typeof(SCurve5)); // Gradient noises. typeRegistory.SetTypeDefinitionName(typeof(Perlin)); typeRegistory.SetTypeDefinitionName(typeof(ClassicPerlin)); typeRegistory.SetTypeDefinitionName(typeof(Simplex)); // Perlin fractal function. typeRegistory.SetTypeDefinitionName(typeof(PerlinFractal)); // Musgrave fractal functions. typeRegistory.SetTypeDefinitionName(typeof(Heterofractal)); typeRegistory.SetTypeDefinitionName(typeof(HybridMultifractal)); typeRegistory.SetTypeDefinitionName(typeof(Multifractal)); typeRegistory.SetTypeDefinitionName(typeof(RidgedMultifractal)); typeRegistory.SetTypeDefinitionName(typeof(SinFractal)); typeRegistory.SetTypeDefinitionName(typeof(SumFractal)); // Other fractal functions. typeRegistory.SetTypeDefinitionName(typeof(Billow)); // Utility. typeRegistory.SetTypeDefinitionName(typeof(Const)); // Controllers. typeRegistory.SetTypeDefinitionName(typeof(Add)); typeRegistory.SetTypeDefinitionName(typeof(Cache)); typeRegistory.SetTypeDefinitionName(typeof(Const)); typeRegistory.SetTypeDefinitionName(typeof(Displace)); typeRegistory.SetTypeDefinitionName(typeof(Multiply)); typeRegistory.SetTypeDefinitionName(typeof(ScaleBias)); typeRegistory.SetTypeDefinitionName(typeof(ScalePoint)); typeRegistory.SetTypeDefinitionName(typeof(Select)); // Custom controllers. typeRegistory.SetTypeDefinitionName(typeof(TerrainDensityTest)); }