Exemplo n.º 1
0
 /// <summary>
 /// Initialises the component.
 /// </summary>
 public void Start()
 {
     this.Terrain = new VoxelTerrain();
     this.MeshGenerator = new MarchingCubesGenerator(this.Terrain, (byte)this.IsoLevel);
     this.Mutator = new TerrainMutator(this.Terrain);
     this.Mutator.MutationOccurred += this.Mutator_MutationOccurred;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Run a test for the marching cubes algorithm.
        /// </summary>
        private static void TestMarchingCubes()
        {
            var terrain = new VoxelTerrain();
            var chunkIndex = new Position(0, 0);
            var noiseGenerator = new NoiseGenerator(1, 16, 0.001f, 0.25f);
            var voxelGenerator = new ChunkVoxelGenerator(noiseGenerator, 0, 50);

            // Load the chunk
            var chunkLoader = new ChunkLoader(voxelGenerator);
            chunkLoader.LoadChunk(terrain, chunkIndex);

            // Generate the mesh
            var meshGenerator = new MarchingCubesGenerator(terrain, 7);
            meshGenerator.UpdateChunk(chunkIndex);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initialises a new instance of the TerrainMutator class.
 /// </summary>
 /// <param name="terrain">The terrain.</param>
 public TerrainMutator(VoxelTerrain terrain)
 {
     this.terrain = terrain;
 }