void OnWizardCreate()
        {
            TerrainVolumeData data = VolumeDataAsset.CreateEmptyVolumeData <TerrainVolumeData>(new Region(0, 0, 0, width - 1, height - 1, depth - 1));

            if (generateFloor)
            {
                // Create some ground in the terrain so it shows up in the editor.
                // Soil as a base (mat 1) and then a couple of layers of grass (mat 2).
                TerrainVolumeGenerator.GenerateFloor(data, 6, (uint)1, 8, (uint)2);
            }
        }
        static void CreateTerrainVolume()
        {
            int width  = 128;
            int height = 32;
            int depth  = 128;

            TerrainVolumeData data = VolumeDataAsset.CreateEmptyVolumeData <TerrainVolumeData>(new Region(0, 0, 0, width - 1, height - 1, depth - 1));

            // Create some ground in the terrain so it shows up in the editor.
            // Soil as a base (mat 1) and then a couple of layers of grass (mat 2).
            TerrainVolumeGenerator.GenerateFloor(data, 6, (uint)1, 8, (uint)2);

            // Now create the terrain game object from the data.
            GameObject terrain = TerrainVolume.CreateGameObject(data, true, true);

            // And select it, so the user can get straight on with editing.
            Selection.activeGameObject = terrain;
        }
Beispiel #3
0
        void Start()
        {
            int planetRadius = 60;

            // Randomize the filename incase the file already exists
            System.Random randomIntGenerator = new System.Random();
            int           randomInt          = randomIntGenerator.Next();
            string        saveLocation       = Paths.voxelDatabases + "/planet-" + randomInt + ".vdb";

            Region            volumeBounds = new Region(-planetRadius, -planetRadius, -planetRadius, planetRadius, planetRadius, planetRadius);
            TerrainVolumeData data         = VolumeData.CreateEmptyVolumeData <TerrainVolumeData>(volumeBounds, saveLocation);

            // The numbers below control the thickness of the various layers.
            TerrainVolumeGenerator.GeneratePlanet(data, planetRadius, planetRadius - 1, planetRadius - 10, planetRadius - 35);

            // We need to commit this so that the changes made by the previous,line are actually written
            // to the voxel database. Otherwise they are just kept in temporary storage and will be lost.
            data.CommitChanges();
        }