コード例 #1
0
        public static StreamingStageMeshFactory CreateSkyIsland()
        {
            var stageIdentity = new StageIdentity("Test Stage");
            var multiNoise    = new NoiseFactory(seed: 0);

            // maps
            var mapChunkConfig = new SkyIslandMapChunkConfig(VoxelChunkConfig.TreeDepth);
            var stageBounds    = new StageBounds(new ChunkKey(0, 0, 0), new Index3D(1, 8, 1));
            var mapConfig      = SkyIslandMapGenerationConfigService.CreatePreconfigured(stageBounds, mapChunkConfig).Build();

            var mapChunkPopulator = new AsyncChunkPopulator <ISkyIslandMapChunk>(
                new SkyIslandMapChunkPopulator(mapConfig, stageBounds, multiNoise));

            var mapChunkCacheBuilder = new SkyIslandMapChunkCacheBuilder(mapChunkConfig, mapChunkPopulator);
            var mapCacheOptions      = new ChunkCacheBuilderOptions <SkyIslandMapChunkResources>()
            {
                StashCapacityMultiplier = 2,
                EagerFillPool           = true,
            };

            mapChunkCacheBuilder.CreateAndAssignStandardResourceStash(CacheSizeInBytes / 10, mapCacheOptions);
            var mapChunkCache = mapChunkCacheBuilder.Build();

            // voxels
            var voxelChunkPopulator = new SkyIslandVoxelGridChunkPopulator(
                SkyIslandVoxelGridGenerationConfigService.CreatePreconfigured().Build(),
                mapChunkCache.AsReadOnly,
                multiNoise);

            return(CreateMeshFactory(multiNoise, voxelChunkPopulator, mapChunkCache));
        }
コード例 #2
0
        public static StreamingStageMeshFactory CreateCubes()
        {
            var stageIdentity = new StageIdentity("Test Stage");
            var multiNoise    = new NoiseFactory(seed: 0);

            var voxelChunkPopulator = new CubeVoxelGridChunkPopulator(
                new TerrainVoxel(TerrainMaterial.Stone, byte.MaxValue));

            return(CreateMeshFactory(multiNoise, voxelChunkPopulator.WrapWithAsync()));
        }
コード例 #3
0
        public static StreamingStageMeshFactory CreateNoise()
        {
            var stageIdentity = new StageIdentity("Test Stage");
            var multiNoise    = new NoiseFactory(seed: 0);

            var voxelChunkPopulator = new NoiseWorldVoxelGridChunkPopulator(
                multiNoise.Create(0),
                noiseScaling: .05,
                numberOfOctaves: 2,
                material: TerrainMaterial.Grass);

            return(CreateMeshFactory(multiNoise, voxelChunkPopulator.WrapWithAsync()));
        }