public SkyIslandMapImagesPhase( IStageIdentity stageIdentity, IStageBounds stageBounds, IAsyncFactory <ChunkOverheadKey, IDisposableValue <IReadOnlySkyIslandMapChunk> > chunkFactory, IKeyValueStore statsStore, SkyIslandMapImagesOptions imageOptions = null, GenerationOptions generationOptions = null) { Contracts.Requires.That(stageIdentity != null); Contracts.Requires.That(stageBounds != null); Contracts.Requires.That(chunkFactory != null); Contracts.Requires.That(statsStore != null); var phaseIdentity = new GenerationPhaseIdentity(nameof(SkyIslandMapImagesPhase)); var chunkKeys = new ChunkOverheadKeyCollection(stageBounds); var chunkProcessor = new SkyIslandMapChunkImagesProcessor(stageBounds, statsStore, imageOptions); this.Phase = new ChunkedPhase <ChunkOverheadKey, IReadOnlySkyIslandMapChunk>( stageIdentity, phaseIdentity, chunkKeys, chunkFactory, chunkProcessor, generationOptions); }
public ContourPhase( IStageIdentity stageIdentity, IStageBounds stageBounds, IRasterChunkConfig <Index3D> voxelChunkConfig, IAsyncFactory <ChunkKey, IDisposableValue <IReadOnlyVoxelGridChunk> > voxelChunkFactory, IDualContourer <TerrainVoxel, TSurfaceData, NormalColorTextureVertex> contourer, IChunkStore <ChunkKey, SerializedMeshChunk> meshChunkStore, int maxBufferedChunks, BatchSerializeGenerationOptions options = null) { Contracts.Requires.That(stageIdentity != null); Contracts.Requires.That(stageBounds != null); Contracts.Requires.That(voxelChunkConfig != null); Contracts.Requires.That(voxelChunkFactory != null); Contracts.Requires.That(contourer != null); Contracts.Requires.That(meshChunkStore != null); Contracts.Requires.That(maxBufferedChunks > 0); var phaseIdentity = new GenerationPhaseIdentity(nameof(ContourPhase <TSurfaceData>)); var chunkKeys = new ChunkKeyCollection(stageBounds); var poolOptions = new PoolOptions <IMutableDivisibleMesh <NormalColorTextureVertex> >() { ResetAction = mesh => mesh.Clear(), }; this.pool = Pool.WithFactory.New( Factory.From <IMutableDivisibleMesh <NormalColorTextureVertex> >( () => new MutableDivisibleMesh <NormalColorTextureVertex>()), poolOptions); var chunkFactory = new ContourMeshFactory <TSurfaceData>( voxelChunkConfig, voxelChunkFactory, this.pool, contourer); var serializer = DivisibleMeshSerializer.NormalColorTextureVertices.WithColorAlpha[ options?.SerializationEndianness ?? DefaultSerializationEndianness]; var persistableFactory = new SerializeMeshChunkFactory(chunkFactory, serializer); this.Phase = new ChunkedBatchingPhase <ChunkKey, SerializedMeshChunk>( stageIdentity, phaseIdentity, chunkKeys, persistableFactory, meshChunkStore, maxBufferedChunks, options); this.Completion = this.CompleteAsync(); }
public SkyIslandMapAbsolutePhase( IStageIdentity stageIdentity, IStageBounds stageBounds, IRasterChunkConfig <Index2D> chunkConfig, IAsyncChunkPopulator <ISkyIslandMapChunk> chunkPopulator, IChunkStore <ChunkOverheadKey, SerializedSkyIslandMapChunk> chunkStore, int maxBufferedChunks, BatchSerializeGenerationOptions options = null) { Contracts.Requires.That(stageIdentity != null); Contracts.Requires.That(stageBounds != null); Contracts.Requires.That(chunkConfig != null); Contracts.Requires.That(chunkPopulator != null); Contracts.Requires.That(chunkStore != null); Contracts.Requires.That(maxBufferedChunks > 0); var phaseIdentity = new GenerationPhaseIdentity(nameof(SkyIslandMapAbsolutePhase)); var chunkKeys = new ChunkOverheadKeyCollection(stageBounds); var poolOptions = new PoolOptions <SkyIslandMapChunkResources>() { }; this.pool = Pool.WithFactory.New(new SkyIslandMapChunkResourcesFactory(chunkConfig), poolOptions); var chunkFactory = new SkyIslandMapChunkPoolingFactory(this.pool, chunkPopulator); var serializer = new SkyIslandMapChunkResourcesSerializer( SkyIslandMapsSerializer.Get[options?.SerializationEndianness ?? DefaultSerializationEndianness], chunkConfig); var persister = new SkyIslandMapChunkPersister(serializer); var persistableFactory = ChunkFactory.Persister.Create(chunkFactory, persister); this.Phase = new ChunkedBatchingPhase <ChunkOverheadKey, SerializedSkyIslandMapChunk>( stageIdentity, phaseIdentity, chunkKeys, persistableFactory, chunkStore, maxBufferedChunks, options); this.Completion = this.CompleteAsync(); }