Exemplo n.º 1
0
        public DemoPartition(DemoPartitionContext context)
        {
            if (context == null) throw new ArgumentNullException("context");

            this.context = context;

            settings = context.Settings;

            heightMap = new NoiseHeightMap(context.GraphicsDevice, settings.HeightMapWidth, settings.HeightMapHeight);
            heightMap.NoiseSource = context.Noise;

            normalMap = new NormalMap(context.GraphicsDevice, settings.HeightMapWidth, settings.HeightMapHeight);
            normalMap.HeightMap = heightMap;
            normalMap.Amplitude = settings.HeightScale;

            noiseRainMap = new NoiseRainMap(settings.HeightMapWidth, settings.HeightMapHeight);
            noiseRainMap.NoiseSource = rainNoise.Sample;
            noiseRainMap.RainAmount = 0.5f;

            uniformRainMap = new Map<float>(settings.HeightMapWidth, settings.HeightMapHeight);
            uniformRainMap.Fill(0.8f);

            terrainRainMap = new Map<float>(settings.HeightMapWidth, settings.HeightMapHeight);

            hydraulicErosion.HeightMap = heightMap;
            //hydraulicErosion.RainMap = noiseRainMap;
            //hydraulicErosion.RainMap = uniformRainMap;
            hydraulicErosion.RainMap = terrainRainMap;

            fastHydraulicErosion.HeightMap = heightMap;
            //fastHydraulicErosion.RainMap = noiseRainMap;
            //fastHydraulicErosion.RainMap = uniformRainMap;
            fastHydraulicErosion.RainMap = terrainRainMap;

            musgraveHydraulicErosion.HeightMap = heightMap;
            //musgraveHydraulicErosion.RainMap = noiseRainMap;
            //musgraveHydraulicErosion.RainMap = uniformRainMap;
            musgraveHydraulicErosion.RainMap = terrainRainMap;

            thermalErosion.HeightMap = heightMap;

            fastThermalErosion.HeightMap = heightMap;

            terrain = new CDLODTerrain(context.Settings);
            terrain.HeightMap = heightMap;
        }
Exemplo n.º 2
0
        public DemoPartition(DemoPartitionContext context)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            this.context = context;

            settings = context.Settings;

            heightMap = new Map<float>(settings.HeightMapWidth, settings.HeightMapHeight);

            terrain = new CDLODTerrain(context.Settings);
            terrain.HeightMap = heightMap;

            texture = new Texture2D(context.GraphicsDevice, settings.HeightMapWidth, settings.HeightMapWidth, false, SurfaceFormat.Single);

            md.Destination = heightMap;
            md.Seed = context.MDSeed;

            fastThermalErosion.HeightMap = heightMap;
            fastThermalErosion.Talus = 0.5f;
        }