コード例 #1
0
ファイル: WMORoot.cs プロジェクト: aeo24/WoWMap
        public WMORoot(string filename)
        {
            Filename = filename;
            Data = new ChunkData(filename);

            Read();
        }
コード例 #2
0
ファイル: ADT.cs プロジェクト: aeo24/WoWMap
        private ADT(string filename, ADTType type)
        {
            switch (type)
            {
                case ADTType.Normal: filename += ".adt"; break;
                case ADTType.Objects: filename += "_obj0.adt"; break;
                case ADTType.Textures: filename += "_tex0.adt"; break;
            }

            Filename = filename;
            Data = new ChunkData(filename);
            Type = type;
        }
コード例 #3
0
ファイル: WMOGroup.cs プロジェクト: aeo24/WoWMap
        public WMOGroup(string filename)
        {
            Filename = filename;

            var mainChunk = new ChunkData(filename);
            MOGP = new MOGP(Chunk = mainChunk.GetChunkByName("MOGP"));

            var stream = Chunk.GetStream();
            stream.Seek(Chunk.Offset + MOGP.ChunkHeaderSize, SeekOrigin.Begin);
            SubData = new ChunkData(stream, Chunk.Size - MOGP.ChunkHeaderSize);

            Read();
        }
コード例 #4
0
ファイル: MapChunk.cs プロジェクト: aeo24/WoWMap
        public MapChunk(ADT adt, Chunk chunk, bool isObj0 = false)
        {
            ADT = adt;
            Chunk = chunk;

            var stream = chunk.GetStream();
            if (adt.Type == ADTType.Normal)
            {
                MCNK = new MCNK(chunk);
                Holes = MCNK.Flags.HasFlag(MCNK.MCNKFlags.HighResolutionHoles) ? HighResHoles : TransformToHighRes(MCNK.Holes);

                stream.Seek(chunk.Offset + MCNK.ChunkHeaderSize, SeekOrigin.Begin);
                SubData = new ChunkData(stream, chunk.Size - MCNK.ChunkHeaderSize);
            }
            else
                SubData = new ChunkData(stream, chunk.Size);

            Read();
        }
コード例 #5
0
    //more or less my componet system will update once i learn how to draw custom gui in the inspector
    void Start()
    {
        terrainMaps = new ChunkData(size,size);

        if(passes.fillAllrandomSeed.run)
        {
            terrainMaps.fillAllWithRandomPerlin(passes.fillAllrandomSeed.zoomLevel);
        }

        foreach(clampPass p in passes.clampPasses)
        {
            terrainMaps.clampChannelValues(p);
        }
        foreach(fillType f in passes.randomPerlinFill)
        {
            terrainMaps.fillWithPerlin(f.zoomLevel,f.channel);
        }
        //gameObject.GetComponent<Renderer>().material.SetTexture("_ParallaxMap",terrainMaps.displayTexture); //will allow paralax shaders to render the plane as if the flat quad was built acording to the heightmaps
        gameObject.GetComponent<Renderer>().material.mainTexture = terrainMaps.displayTexture;
    }
コード例 #6
0
        public ChunkData ChunkDataUploadSvrSync(ChunkData chunk)
        {
            /*Gak dipake*/
            MemoryCacher cacher     = new MemoryCacher();
            ChunkData    result     = new ChunkData();
            string       savedchunk = string.Empty;
            object       checkchunk = null;

            //check apakah ada data chunk
            checkchunk           = cacher.GetValue(chunk.ChunkKey);
            result.ChunkCurrent  = chunk.ChunkCurrent;
            result.ChunkKey      = chunk.ChunkKey;
            result.ChunkMaxCount = chunk.ChunkMaxCount;
            result.FileName      = chunk.FileName;
            if (checkchunk != null)
            {
                //resultchunk =jika ada, data chunk lama + data terbaru
                savedchunk       = (string)checkchunk;
                result.DataChunk = savedchunk + chunk.DataChunk;
            }
            else
            {
                //resultchunk =jika tidak ada, data terbaru
                result.DataChunk = chunk.DataChunk;
            }
            //menghapus data chace
            cacher.Delete(chunk.ChunkKey);
            if (chunk.ChunkMaxCount == chunk.ChunkCurrent)
            {
                result.CompleteChunk = true;
            }
            else
            {
                result.CompleteChunk = false;
                //membuat chache data chace

                cacher.AddMinutes(result.ChunkKey, result.DataChunk, chunk.ChunkTimeMinutes);
            }
            return(result);
        }
コード例 #7
0
ファイル: GreenRoom.cs プロジェクト: mctraveler/MineSharp
        protected override ChunkData GenerateChunk()
        {
            Random    r  = new Random();
            ChunkData mc = new ChunkData();

            mc.Complete = true;
            mc.InitContinousChunks(4);
            //Fill with data
            int off = mc.GetIndex(0, 60, 0);

            for (int i = 0; i < off; i++)
            {
                mc.BlockType [i] = (byte)BlockID.Dirt;
            }
            for (int i = 0; i < 16 * 16; i++)
            {
                mc.BlockType [off + i] = (byte)BlockID.Grass;
            }
            off += 16 * 16;
            for (int i = 0; i < 16 * 16; i++)
            {
                if (r.Next(4) == 0)
                {
                    mc.BlockType [off + i] = (byte)BlockID.Rose;
                }
                if (r.Next(5) == 0)
                {
                    mc.BlockType [off + i] = (byte)BlockID.Dandelion;
                }
            }
            for (int n = 0; n < mc.BlockLight.Length; n++)
            {
                mc.BlockLight [n] = 0xff;
            }
            for (int i = 0; i < 16 * 16; i++)
            {
                mc.Biome [i] = (byte)((i >> 3) % 23);
            }
            return(mc);
        }
コード例 #8
0
        public void Save(ChunkData chunk)
        {
            try
            {
                var tables = new[]
                {
                    "PERSON",
                    "OBSERVATION_PERIOD",
                    "PAYER_PLAN_PERIOD",
                    "DEATH",
                    "DRUG_EXPOSURE",
                    "OBSERVATION",
                    "VISIT_OCCURRENCE",
                    "VISIT_DETAIL",
                    "PROCEDURE_OCCURRENCE",
                    "DRUG_ERA",
                    "CONDITION_ERA",
                    "DEVICE_EXPOSURE",
                    "MEASUREMENT",
                    "COHORT",
                    "CONDITION_OCCURRENCE",
                    "COST",
                    "NOTE",
                    "METADATA_TMP",
                    "FACT_RELATIONSHIP"
                };

                Parallel.ForEach(tables, new ParallelOptions {
                    MaxDegreeOfParallelism = 1
                }, t => { Write(chunk, t); });
                //Parallel.ForEach(tables, t => { Write(chunk, t); });
            }
            catch (Exception e)
            {
                Console.WriteLine("WARN_EXC - Save - throw");
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
                throw;
            }
        }
コード例 #9
0
    /// <summary>
    /// Generates a map of moveable tiles based on the given region
    /// </summary>
    /// <param name="chunkRegion"></param>
    public void LoadRegion(ChunkRegion chunkRegion)
    {
        Debug.Log("[PathFinding] Chunk Region " + chunkRegion.X + "," + chunkRegion.Z + " loading");
        //Get region position & generate empty array
        Vec2i rPos = new Vec2i(chunkRegion.X, chunkRegion.Z);

        float[,] tileData = new float[RegionTileSize, RegionTileSize];
        //Iterate whole region and fill array as required
        //TODO - see if there is a quicker way to do this...
        for (int cx = 0; cx < World.RegionSize; cx++)
        {
            for (int cz = 0; cz < World.RegionSize; cz++)
            {
                for (int x = 0; x < World.ChunkSize; x++)
                {
                    for (int z = 0; z < World.ChunkSize; z++)
                    {
                        ChunkData c = chunkRegion.Chunks[cx, cz];
                        if (c == null)
                        {
                            Debug.Error("Chunk Region " + chunkRegion.ToString() + " has null chunk with local: " + cx + "," + cz);
                            continue;
                        }
                        float val = tileData[cx * World.ChunkSize + x, cz *World.ChunkSize + z] = c.GetTile(x, z).SpeedMultiplier;
                        if (c.Objects != null && c.GetObject(x, z) != null)
                        {
                            WorldObjectData wod = c.GetObject(x, z);
                            if (wod.IsCollision)
                            {
                                val = Mathf.Infinity;
                            }
                        }

                        tileData[cx * World.ChunkSize + x, cz *World.ChunkSize + z] = val;
                    }
                }
            }
        }
        RegionTileValues.Add(rPos, tileData);
    }
コード例 #10
0
    public override void decorateChunkData(ChunkData data, FastNoise noise)
    {
        for (int i = 0; i < Constants.ChunkWidth + 1; i++)
        {
            for (int j = 0; j < Constants.ChunkWidth + 1; j++)
            {
                float chance     = 0.000085f;
                bool  tree       = false;
                float noiseVal   = (noise.GetWhiteNoiseInt(i + data.ChunkX * (Constants.ChunkWidth), j + data.ChunkZ * (Constants.ChunkWidth)) * 0.5f + 0.5f);
                bool  shouldTree = noiseVal < chance;
                uint  previous   = 0;
                int   height     = 0;
                for (int k = 0; k < Constants.ChunkHeight; k++)
                {
                    if (!tree && shouldTree && k < 45 && k > 25)
                    {
                        uint c = data.values[(i * (Constants.ChunkWidth + 1) * (Constants.ChunkHeight + 1) + j * (Constants.ChunkHeight + 1) + k)];
                        if (previous > 0 && c % 255 + (c >> 8) % 255 + (c >> 16) % 255 <= 0)
                        {
                            tree = true;
                        }
                        previous = c;
                    }

                    if (tree)
                    {
                        if (height == 2)
                        {
                            data.interactables.Add(new RuinMemory(new Vector3(i, k, j), ruins[(int)((noiseVal / chance) * ruins.Count)].ruinRadius));
                        }
                        if (height == 7)
                        {
                            ruins[(int)((noiseVal / chance) * ruins.Count)].Generate(data, manager, noise, i, j, k);
                        }
                        height++;
                    }
                }
            }
        }
    }
コード例 #11
0
    protected Mesh GenerateChunkMesh(ChunkData data)
    {
        int verticesNumber  = ChunkData.size * ChunkData.size * 4;
        int trianglesNumber = ChunkData.size * ChunkData.size * 6;

        Vector3[] vertices  = new Vector3[verticesNumber];
        int[]     triangles = new int[trianglesNumber];
        Vector3[] normals   = Enumerable.Repeat(Vector3.up, verticesNumber).ToArray();
        Mesh      m         = new Mesh();

        int vi = 0;
        int ti = 0;

        for (int i = 0; i < ChunkData.size; i++)
        {
            for (int j = 0; j < ChunkData.size; j++)
            {
                vertices[vi]     = new Vector3Int(j, 0, i);
                vertices[vi + 1] = new Vector3Int(j, 0, i + 1);
                vertices[vi + 2] = new Vector3Int(j + 1, 0, i + 1);
                vertices[vi + 3] = new Vector3Int(j + 1, 0, i);

                triangles[ti]     = vi;
                triangles[ti + 1] = vi + 1;
                triangles[ti + 2] = vi + 2;

                triangles[ti + 3] = vi;
                triangles[ti + 4] = vi + 2;
                triangles[ti + 5] = vi + 3;

                vi += 4;
                ti += 6;
            }
        }

        m.vertices  = vertices;
        m.triangles = triangles;
        m.normals   = normals;
        return(m);
    }
コード例 #12
0
    public Chunk LoadChunk(Vector2DInt inPosition)
    {
        // Create chunkdata and begin load from disk on a separate thread
        ChunkData chunkData = new ChunkData(inPosition);

        new System.Threading.Thread(() => chunkData.LoadFromDisk(inPosition)).Start();

        // Create blank chunk view
        GameObject chunkTerrainView   = _viewGenerator.GenerateBlankTerrainView(inPosition);
        GameObject chunkFurnitureView = _viewGenerator.GenerateBlankFurnitureView(inPosition);

        // Make the viewGenerator update the UV2 of the view every time the chunk's data changes
        chunkData.OnTerrainDataDirtied += (ChunkData dirtiedData) =>
                                          chunkTerrainView.GetComponent <MeshFilter>().mesh.uv2 = _viewGenerator.GenerateTerrainUV2(dirtiedData); // TODO: Getting these meshfilters before the event saves having to do it every time it's called

        chunkData.OnFurnitureDataDirtied += (ChunkData dirtiedData) =>
                                            chunkFurnitureView.GetComponent <MeshFilter>().mesh.uv2 = _viewGenerator.GenerateFurnitureUV2(dirtiedData); // TODO: Getting these meshfilters before the event saves having to do it every time it's called

        ChunkView chunkView = new ChunkView(chunkTerrainView, chunkFurnitureView);

        return(new Chunk(chunkData, chunkView));
    }
コード例 #13
0
    public VoxelState GetVoxel(Vector3 pos)
    {
        if (!IsVoxelInWorld(pos))
        {
            return(null);
        }

        // Get the ChunkCoord of given voxel.
        int x = Mathf.FloorToInt(pos.x / VoxelData.ChunkWidth);
        int z = Mathf.FloorToInt(pos.z / VoxelData.ChunkWidth);

        // Reverse that to get the actual position of the chunk.
        x *= VoxelData.ChunkWidth;
        z *= VoxelData.ChunkWidth;

        // Does the chunk exist? If not, we need to create it.
        ChunkData chunkData = RequestChunk(new Vector2Int(x, z), true);

        Vector3Int voxel = new Vector3Int((int)(pos.x - x), (int)(pos.y), (int)(pos.z - z));

        return(chunkData.map[voxel.x, voxel.y, voxel.z]);
    }
コード例 #14
0
ファイル: Chunk.cs プロジェクト: MGoBlue07/MinecraftClone
    public void Init()
    {
        chunkObject  = new GameObject();
        meshFilter   = chunkObject.AddComponent <MeshFilter>();
        meshRenderer = chunkObject.AddComponent <MeshRenderer>();

        materials[0]           = World.Instance.material;
        materials[1]           = World.Instance.transparentMaterial;
        meshRenderer.materials = materials;

        chunkObject.transform.SetParent(World.Instance.transform);
        chunkObject.transform.position = new Vector3(coord.x * VoxelData.ChunkWidth, 0f, coord.z * VoxelData.ChunkWidth);
        chunkObject.name = "Chunk " + coord.x + ", " + coord.z;
        position         = chunkObject.transform.position;

        chunkData = World.Instance.worldData.RequestChunk(new Vector2Int((int)position.x, (int)position.z), true);

        lock (World.Instance.ChunkUpdateThreadLock)
        {
            World.Instance.chunksToUpdate.Add(this);
        }
    }
コード例 #15
0
    void GenerateChunkData()
    {
        int chunkDataX = PlanetData.sizeX / ChunkData.size;
        int chunkDataY = PlanetData.sizeY / ChunkData.size;

        chunkData = new ChunkData[chunkDataX, chunkDataY];

        for (int i = 0; i < chunkDataX; i++)
        {
            for (int j = 0; j < chunkDataY; j++)
            {
                for (int i1 = 0; i1 < ChunkData.size; i1++)
                {
                    for (int j1 = 0; j1 < ChunkData.size; j1++)
                    {
                        chunkData[i, j] = new ChunkData();
                        chunkData[i, j].data[i1, j1] = planetData.data[i1 + (i * ChunkData.size), j1 + (j * ChunkData.size)];
                    }
                }
            }
        }
    }
コード例 #16
0
ファイル: NetUtils.cs プロジェクト: MLinksme/Cubecraft
 public static ChunkColumn ReadColumnData(byte[] data, int chunkX, int chunkZ, bool chunksContinuous, bool hasSkyLight, int chunkMask)
 {
     using (MemoryStream memstream = new MemoryStream(data, false))
     {
         InputBuffer input  = new InputBuffer(memstream);
         ChunkColumn column = new ChunkColumn(chunkX, chunkZ);
         for (int chunkY = 0; chunkY < 16; chunkY++)
         {
             if ((chunkMask & (1 << chunkY)) != 0)
             {
                 BlockStorage blocks = new BlockStorage(input);
                 input.ReadData(2048);
                 if (hasSkyLight)
                 {
                     input.ReadData(2048);
                 }
                 column[chunkY] = new ChunkData(blocks);
             }
         }
         return(column);
     }
 }
コード例 #17
0
    public List <ChunkData> ToChunkData()
    {
        List <ChunkData> chunks = new List <ChunkData>(ChunkSize.x * ChunkSize.z);

        foreach (List <WorldObjectData> map in ObjectMaps)
        {
            if (map != null)
            {
                foreach (WorldObjectData obj in map)
                {
                    if (obj != null)
                    {
                        obj.SetPosition(obj.Position + BaseTile.AsVector3());
                    }
                }
            }
        }
        for (int x = 0; x < ChunkSize.x; x++)
        {
            for (int z = 0; z < ChunkSize.z; z++)
            {
                float     height   = ChunkBases == null ? 0 : ChunkBases[x, z].Height;
                ChunkData chunk_xz = new ChunkData(BaseChunk.x + x, BaseChunk.z + z, TileMaps[x, z], true, height, HeightMaps[x, z], ObjectMaps[x, z]);
                ChunkVoxels[x, z].HasBoundryVoxels = true;
                chunk_xz.SetVoxelData(ChunkVoxels[x, z]);
                chunks.Add(chunk_xz);
                if (DEBUG)
                {
                    int count = ObjectMaps[x, z] == null ? 0 : ObjectMaps[x, z].Count;
                    if (count != 0)
                    {
                        Debug.Log("Chunk " + (x + BaseChunk.x) + "," + (z + BaseChunk.z) + " generated, has " + count + " objects");
                    }
                }
            }
        }
        OnCreate();
        return(chunks);
    }
コード例 #18
0
    } // chunk lighting

    private static void ReadMCCV(MemoryStream ADTstream, ChunkData chunkData)
    {
        chunkData.VertexColors = new Color32[145];

        List <int> vertcolors = new List <int>();

        for (int col = 0; col < 145; col++)
        {
            int channelR = ADTstream.ReadByte();
            vertcolors.Add(channelR);
            int channelG = ADTstream.ReadByte();
            vertcolors.Add(channelG);
            int channelB = ADTstream.ReadByte();
            vertcolors.Add(channelB);
            int channelA = ADTstream.ReadByte();
            vertcolors.Add(channelA);

            Color32 colorsRGBA = new Color32((byte)channelR, (byte)channelG, (byte)channelB, (byte)channelA);
            Color32 colorBGRA  = new Color32(colorsRGBA.b, colorsRGBA.g, colorsRGBA.r, colorsRGBA.a);
            chunkData.VertexColors[col] = colorBGRA;
        }
    } // vertex shading
コード例 #19
0
ファイル: WorldData.cs プロジェクト: matanmaron/Blocks
    public VoxelState GetVoxel(Vector3 pos)
    {
        if (!IsVoxelInWorld(pos))
        {
            return(null);
        }
        int x = Mathf.FloorToInt(pos.x / VoxelData.ChunkWidth);
        int z = Mathf.FloorToInt(pos.z / VoxelData.ChunkWidth);

        x *= VoxelData.ChunkWidth;
        z *= VoxelData.ChunkWidth;

        ChunkData chunk = RequestChunk(new Vector2Int(x, z), false);

        if (chunk == null)
        {
            return(null);
        }
        Vector3Int voxel = new Vector3Int((int)(pos.x - x), (int)pos.y, (int)(pos.z - z));

        return(chunk.map[voxel.x, voxel.y, voxel.z]);
    }
コード例 #20
0
ファイル: Chunk.cs プロジェクト: matanmaron/Blocks
    public Chunk(ChunkCoord _chunkCoord)
    {
        coord                  = _chunkCoord;
        chunkObject            = new GameObject();
        meshFilter             = chunkObject.AddComponent <MeshFilter>();
        meshRenderer           = chunkObject.AddComponent <MeshRenderer>();
        materials[0]           = World.Instance.material;
        materials[1]           = World.Instance.transparentMaterial;
        meshRenderer.materials = materials;
        chunkObject.transform.SetParent(World.Instance.transform);
        chunkObject.transform.position = new Vector3(coord.x * VoxelData.ChunkWidth, 0, coord.z * VoxelData.ChunkWidth);
        chunkObject.name = $"Chunk {coord.x},{coord.z}";
        position         = chunkObject.transform.position;

        chunkData       = World.Instance.worldData.RequestChunk(new Vector2Int((int)position.x, (int)position.z), true);
        chunkData.chunk = this;
        World.Instance.AddChunkToUpdate(this);
        if (World.Instance.settings.EnableAnimatedChunks)
        {
            chunkObject.AddComponent <ChunkLoadAnimation>();
        }
    }
コード例 #21
0
    /// <summary>
    /// Instansiates the next chunk.
    /// </summary>
    void CreateNewChunk()
    {
        ChunkData CD = ParseCharToGO(terrains[spawnedChunks]);

        if (CD == null)
        {
            Debug.LogError(terrains[spawnedChunks] + " returns null, make sure that letter is in the chunk database!");
            return;
        }

        SpawnChunk(CD);

        if (CD.type == TerrainType.Enemy)
        {
            CreateEnemies(CD);
        }

        if (spawnedChunks >= levelData.levelInfo.Length)
        {
            spawnedAllChunks = true;
        }
    }
コード例 #22
0
ファイル: MapChunk.cs プロジェクト: WowDevs/WoWMap
        public MapChunk(ADT adt, Chunk chunk, bool isObj0 = false)
        {
            ADT   = adt;
            Chunk = chunk;

            var stream = chunk.GetStream();

            if (adt.Type == ADTType.Normal)
            {
                MCNK  = new MCNK(chunk);
                Holes = MCNK.Flags.HasFlag(MCNK.MCNKFlags.HighResolutionHoles) ? HighResHoles : TransformToHighRes(MCNK.Holes);

                stream.Seek(chunk.Offset + MCNK.ChunkHeaderSize, SeekOrigin.Begin);
                SubData = new ChunkData(stream, chunk.Size - MCNK.ChunkHeaderSize);
            }
            else
            {
                SubData = new ChunkData(stream, chunk.Size);
            }

            Read();
        }
コード例 #23
0
 // Start is called before the first frame update
 void OnEnable()
 {
     singleton = this;
     ClearChildren();
     if (Application.isPlaying)
     {
         var timer = System.Diagnostics.Stopwatch.StartNew();
         playModeData = new ChunkData[data.chunks.GetLength(0), data.chunks.GetLength(1)];
         for (int x = 0; x < data.chunks.GetLength(0); x++)
         {
             for (int y = 0; y < data.chunks.GetLength(1); y++)
             {
                 playModeData[x, y] = new ChunkData(data.chunks[x, y].densities);
             }
         }
         Debug.Log("Copying data took: " + timer.ElapsedMilliseconds + "ms");
     }
     else if (!editModeDeleteExtraTerrain)
     {
         ReloadChunks();
     }
 }
コード例 #24
0
        public override void GetVertices(IBlockAccess world, ChunkData chunkBuilder, BlockCoordinates blockCoordinates, Vector3 position, Block baseBlock)
        {
            var biome = world == null?BiomeUtils.GetBiomeById(0) : world.GetBiome(position);

            if (UseRandomizer)
            {
                BlockStateModelWrapper selectedModel = null;

                var rnd = MathF.Abs(NoiseGenerator.GetValue(position.X * position.Y, position.Z * position.X))
                          * WeightSum;

                for (var index = 0; index < Models.Length; index++)
                {
                    var model = Models[index];
                    rnd -= model.BlockStateModel.Weight;

                    if (rnd < 0)
                    {
                        selectedModel = model;

                        break;
                    }
                }

                CalculateModel(world, blockCoordinates, chunkBuilder, position, baseBlock, selectedModel.BlockStateModel, selectedModel.BlockModel, biome);
            }
            else
            {
                for (var bsModelIndex = 0; bsModelIndex < Models.Length; bsModelIndex++)
                {
                    var bsModel = Models[bsModelIndex];

                    //	if (string.IsNullOrWhiteSpace(bsModel.ModelName)) continue;

                    CalculateModel(world, blockCoordinates, chunkBuilder, position, baseBlock, bsModel.BlockStateModel, bsModel.BlockModel, biome);
                }
            }
        }
コード例 #25
0
    private int GetCubeIndex(int x, int y, int z, ChunkData Chunk)
    {
        int index = 0;

        if (GetVoxelValue(new Vector3Int(x, y, z), 0, Chunk) > SurfaceLevel)
        {
            index |= 1;
        }
        if (GetVoxelValue(new Vector3Int(x, y, z), 1, Chunk) > SurfaceLevel)
        {
            index |= 2;
        }
        if (GetVoxelValue(new Vector3Int(x, y, z), 2, Chunk) > SurfaceLevel)
        {
            index |= 4;
        }
        if (GetVoxelValue(new Vector3Int(x, y, z), 3, Chunk) > SurfaceLevel)
        {
            index |= 8;
        }
        if (GetVoxelValue(new Vector3Int(x, y, z), 4, Chunk) > SurfaceLevel)
        {
            index |= 16;
        }
        if (GetVoxelValue(new Vector3Int(x, y, z), 5, Chunk) > SurfaceLevel)
        {
            index |= 32;
        }
        if (GetVoxelValue(new Vector3Int(x, y, z), 6, Chunk) > SurfaceLevel)
        {
            index |= 64;
        }
        if (GetVoxelValue(new Vector3Int(x, y, z), 7, Chunk) > SurfaceLevel)
        {
            index |= 128;
        }
        return(index);
    }
コード例 #26
0
    } // fill vertex shading with 127

    private static void ReadMCNR(MemoryStream ADTstream, ChunkData chunkData)
    {
        chunkData.VertexNormals = new Vector3[145];

        for (int n = 0; n < 145; n++)
        {
            Vector3 normsRaw = new Vector3(ADTstream.ReadByte(), ADTstream.ReadByte(), ADTstream.ReadByte());

            var calcX = NormalizeValue(normsRaw.x); if (calcX <= 0)
            {
                calcX = 1 + calcX;
            }
            else if (calcX > 0)
            {
                calcX = (1 - calcX) * (-1);
            }
            var calcY = NormalizeValue(normsRaw.y); if (calcY <= 0)
            {
                calcY = 1 + calcY;
            }
            else if (calcY > 0)
            {
                calcY = (1 - calcY) * (-1);
            }
            var calcZ = NormalizeValue(normsRaw.z); if (calcZ <= 0)
            {
                calcZ = 1 + calcZ;
            }
            else if (calcZ > 0)
            {
                calcZ = (1 - calcZ) * (-1);
            }

            chunkData.VertexNormals[n] = new Vector3(calcX, calcZ, calcY);
        }
        // skip unused 13 byte padding //
        ADTstream.Seek(13, SeekOrigin.Current);
    }  // normals
コード例 #27
0
    public void AvailablePoints()
    {
        int maxPoints = 0;
        int minPoints = 0;

        //Finds max and min available points.
        foreach (char letter in terrains)
        {
            ChunkData chunk = ParseCharToGO(letter);
            if (chunk.type == TerrainType.Enemy)
            {
                maxPoints += ScoreManager.instance.enemyPoints;
                minPoints -= ScoreManager.instance.missEnemyPoints;
            }
            else if (chunk.type == TerrainType.Obstacle)
            {
                maxPoints += ScoreManager.instance.obstaclePoints;
                //missed obstacles do not currently count
                //minPoints -= ScoreManager.instance.missObstaclePoints;
            }
        }
        StarSystem.instance.maxPointsAvailable = maxPoints;
    }
コード例 #28
0
    public Chunk Deactivate(Vector3Int pos, Transform parent)
    {
        string name  = Chunk.GetName(parent, pos);
        Chunk  chunk = chunksByName[name];

        chunk.SetActive(false);
        chunksByName.Remove(name);
        reusableChunks.Enqueue(chunk);

        ChunkData data = dataByPos[pos];

        data.AssociatedChunks.Remove(chunk);
        if (data.AssociatedChunks.Count == 0)
        {
            data.IsActive = false;
            if (!bufferedData.Contains(data))
            {
                bufferedData.Add(data);
            }
        }

        return(chunk);
    }
コード例 #29
0
    IEnumerator GenerateTreeHouseHouses(ChunkData chunkData)
    {
        System.Random rand = new System.Random();

        foreach (GameObject villageCenter in chunkData.VillageCenterList)
        {
            //For every child
            for (int i = 0; i < villageCenter.transform.childCount; i++)
            {
                GameObject houseSpawnPoint = villageCenter.transform.GetChild(i).gameObject;
                //If child has HouseSpawnPoint tag
                if (houseSpawnPoint.CompareTag("HouseSpawnPoint"))
                {
                    int randInt = rand.Next(0, TerrainHouseData.HouseSpawnPointPrefabs.Length);

                    GameObject newHouse = Instantiate(TerrainHouseData.HouseSpawnPointPrefabs[randInt], houseSpawnPoint.transform.position, houseSpawnPoint.transform.rotation);
                    newHouse.transform.SetParent(houseSpawnPoint.transform);
                }
            }
        }

        yield return(null);
    }
コード例 #30
0
    public static ChunkData LoadChunk(string worldName, Vector2Int position)
    {
        string chunkName = position.x + "-" + position.y;

        // Get the path to our world saves.
        string loadPath = World.Instance.appPath + "/saves/" + worldName + "/chunks/" + chunkName + ".chunk";

        // Check if a save exists for the name we were passed.
        if (File.Exists(loadPath))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(loadPath, FileMode.Open);

            ChunkData chunkData = formatter.Deserialize(stream) as ChunkData;
            stream.Close();

            return(chunkData);
        }

        // If we didn't find the chunk in our folder, return null and our WorldData script
        // will make a new one.
        return(null);
    }
コード例 #31
0
ファイル: Landscape.cs プロジェクト: coreystj/TurningEdge
        private void SetChunkData(ChunkData chunkData)
        {
            int   index          = 0;
            int   secondaryIndex = 0;
            float color;

            for (int y = 0; y <= _size; y++)
            {
                for (int x = 0; x <= _size; x++)
                {
                    ActionHelper.DoAction(() =>
                    {
                        _heights[index] = chunkData.Heights[index];
                    });
                    ActionHelper.DoAction(() =>
                    {
                        color          = (chunkData.Colors[index] / 100f);
                        _colors[index] = new Color(color, color, color, 1f);
                    });
                    if (x < _size && y < _size)
                    {
                        ActionHelper.DoAction(() =>
                        {
                            _materialIndexes[secondaryIndex] = chunkData.Materials[secondaryIndex];
                        });
                        ActionHelper.DoAction(() =>
                        {
                            _states[secondaryIndex] = chunkData.States[secondaryIndex];
                        });
                        secondaryIndex++;
                    }
                    index++;
                }
            }

            _chunkData = chunkData;
        }
コード例 #32
0
        private static TimelineLayer InitialiseFirstBoard(NamelessGame game, HistoryGenerationSettings settings)
        {
            var       worldBoard = new TimelineLayer(game.WorldSettings.WorldBoardWidth, game.WorldSettings.WorldBoardWidth, 0);
            ChunkData chunkData  = new ChunkData(game.WorldSettings, worldBoard);

            worldBoard.Chunks = chunkData;

            WorldBoardGenerator.PopulateWithInitialData(worldBoard, game);
            WorldBoardGenerator.AnalizeLandmasses(worldBoard, game);
            WorldBoardGenerator.PlaceInitialCivilizations(worldBoard, game);
            //WorldBoardGenerator.PlaceInitialArtifacts(worldBoard, game);
            //WorldBoardGenerator.PlaceResources(worldBoard, game);
            //WorldBoardGenerator.DistributeMetaphysics(worldBoard, game);

            WorldTile firsTile = null;

            foreach (var worldBoardWorldTile in worldBoard.WorldTiles)
            {
                if (worldBoardWorldTile.Settlement != null)
                {
                    IWorldProvider worldProvider = chunkData;
                    firsTile = worldBoardWorldTile;
                    var concreteSettlment = SettlementFactory.GenerateSettlement(game, firsTile, worldBoard, worldProvider);

                    firsTile.Settlement.Concrete = concreteSettlment;
                    break;
                }
            }



            //var concreteSettlment = SettlementFactory.GenerateSettlement(game, firsTile, worldBoard, worldProvider);

            //firsTile.Settlement.Concrete = concreteSettlment;

            return(worldBoard);
        }
コード例 #33
0
    /// <summary>
    /// Generates a chunk that has no special land features
    /// </summary>
    /// <param name="x"></param>
    /// <param name="z"></param>
    /// <param name="cb"></param>
    /// <returns></returns>
    private ChunkData GenerateSimpleChunk(int x, int z, ChunkBase cb)
    {
        if (!cb.IsLand)
        {
            return(new ChunkData(x, z, (int[, ])OCEAN.Clone(), cb.IsLand));
        }
        if (cb.Biome == ChunkBiome.dessert)
        {
            return(new ChunkData(x, z, (int[, ])EMPTY_DESERT.Clone(), cb.IsLand));
        }
        int[,] tiles = (int[, ])EMPTY_PLAINS.Clone();

        GenerationRandom genRan = new GenerationRandom(Seed + x << 16 + z);

        //if(genRan.Random() > 0.1f)
        //    return new ChunkData(x, z, tiles, cb.IsLand);

        Dictionary <int, WorldObjectData> obs = new Dictionary <int, WorldObjectData>(256);

        for (int i = 0; i < World.ChunkSize; i++)
        {
            for (int j = 0; j < World.ChunkSize; j++)
            {
                if (genRan.Random() < 0.01f)
                {
                    obs.Add(WorldObject.ObjectPositionHash(i, j), new Tree(new Vec2i(x * World.ChunkSize + i, z * World.ChunkSize + j)));
                }
                else if (genRan.Random() < 0.3f)
                {
                    //obs.Add(WorldObject.ObjectPositionHash(i, j), new Tree(new Vec2i(x * World.ChunkSize + i, z * World.ChunkSize + j)));
                }
            }
        }
        ChunkData cd = new ChunkData(x, z, tiles, cb.IsLand, obs);

        return(cd);
    }
コード例 #34
0
        public MapData InitializeMap(int x, int y)
        {
            var currentChunk = _chunkDataProvider.GetCurrentChunk(x, y);

            var nbOfBlocksPerChunkRow = (int)Math.Sqrt(AppSettings.BlocksPerChunk);
            var chunkSize             = AppSettings.BlockSizeU * nbOfBlocksPerChunkRow * ORoot.ScreenUnit;

            var chunks = new List <ChunkData>();

            try
            {
                for (int i = 0; i < 6; i++)
                {
                    for (int j = 0; j < 6; j++)
                    {
                        var xReference = (int)(x + (i - 3) * nbOfBlocksPerChunkRow);
                        var yReference = (int)(y + (j - 3) * nbOfBlocksPerChunkRow);

                        var chunk = _chunkDataProvider.GetCurrentChunk(xReference, yReference);
                        if (chunk != null)
                        {
                            chunks.Add(chunk);
                        }
                    }
                }

                _lastCurrentChunk = currentChunk;
            }
            catch (Exception e)
            {
                _logger.Log($"Map Initialization failed : {e.Message}");
            }

            _logger.Log($"Map Initialization succeded");

            return(new MapData(chunks));
        }
コード例 #35
0
        public void Save(ChunkData chunk)
        {
            var timer = new Stopwatch();

            timer.Start();
            try
            {
                UpdateOffset(chunk.KeyMasterOffset);

                Write(chunk.Id, new PersonDataReader(chunk.Persons.ToList()), "PERSON");
                Write(chunk.Id, new ObservationPeriodDataReader(chunk.ObservationPeriods.ToList()), "OBSERVATION_PERIOD");
                Write(chunk.Id, new PayerPlanPeriodDataReader(chunk.PayerPlanPeriods.ToList(), chunk.KeyMasterOffset), "PAYER_PLAN_PERIOD");
                Write(chunk.Id, new ConditionOccurrenceDataReader(chunk.ConditionOccurrences.ToList(), chunk.KeyMasterOffset), "CONDITION_OCCURRENCE");
                Write(chunk.Id, new DeathDataReader(chunk.Deaths.ToList()), "DEATH");
                Write(chunk.Id, new DrugExposureDataReader(chunk.DrugExposures.ToList(), chunk.KeyMasterOffset), "DRUG_EXPOSURE");
                Write(chunk.Id, new DrugCostDataReader(chunk.DrugCost.ToList(), chunk.KeyMasterOffset), "DRUG_COST");
                Write(chunk.Id, new ObservationDataReader(chunk.Observations.ToList(), chunk.KeyMasterOffset), "OBSERVATION");
                Write(chunk.Id, new VisitOccurrenceDataReader(chunk.VisitOccurrences.ToList(), chunk.KeyMasterOffset), "VISIT_OCCURRENCE");
                Write(chunk.Id, new ProcedureOccurrenceDataReader(chunk.ProcedureOccurrences.ToList(), chunk.KeyMasterOffset), "PROCEDURE_OCCURRENCE");
                Write(chunk.Id, new ProcedureCostDataReader(chunk.ProcedureCost.ToList(), chunk.KeyMasterOffset), "PROCEDURE_COST");
                Write(chunk.Id, new DrugEraDataReader(chunk.DrugEra.ToList()), "DRUG_ERA");
                Write(chunk.Id, new ConditionEraDataReader(chunk.ConditionEra.ToList()), "CONDITION_ERA");
                Write(chunk.Id, new CohortDataReader(chunk.Cohort.ToList()), "COHORT");

                Commit();
                var dbChunk = new DbChunk(Settings.Current.Building.BuilderConnectionString);
                dbChunk.ChunkComplete(chunk.Id);
            }
            catch (Exception e)
            {
                Logger.WriteError(chunk.Id, e);
                Rollback();
                Logger.Write(chunk.Id, LogMessageTypes.Debug, "Rollback - Complete");
            }

            timer.Stop();
        }
コード例 #36
0
ファイル: Chunk.cs プロジェクト: LatexBotox/SPACE
	public ChunkData GetChunkData() {
		if (flaggedAsteroids.Count > 0) {
			UpdateAsteroidData ();

			ChunkData cd = new ChunkData();
			cd.asteroidData = new AsteroidData[flaggedAsteroids.Count];

			flaggedAsteroids.Values.CopyTo (cd.asteroidData, 0);
			cd.chunkx = chunkx;
			cd.chunky = chunky;
			return cd;
		}
		return null;
	}
コード例 #37
0
ファイル: WDT.cs プロジェクト: aeo24/WoWMap
 public WDT(string filename)
 {
     Data = new ChunkData(filename);
     Read();
     ReadGlobalModel();
 }
コード例 #38
0
ファイル: PlayerData.cs プロジェクト: kaldrick/VoxelTerrain
    void checkChunk(ChunkData chunk)
    {
        for(int i = 0; i <= uncoverArea; i++)
        {
            //N
            if(!GameObject.Find ("Voxel Mesh " + (chunk.m_pos.x+(i*8)).ToString() + " " + (chunk.m_pos.y).ToString() + " " + (chunk.m_pos.z).ToString()))
            {
                PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
                Vector3 pos = new Vector3(chunk.m_pos.x+8*i+1, chunk.m_pos.y+1, chunk.m_pos.z+1);
                m_voxelChunktemp = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                m_voxelChunktemp.CreateVoxels (m_surfacePerlin);
                m_voxelChunktemp.CreateMesh (terrain.m_material);
                //chunk.bOnce = true;
            }
            //NW
            if(!GameObject.Find ("Voxel Mesh " + (chunk.m_pos.x+8*i).ToString() + " " + (chunk.m_pos.y).ToString() + " " + (chunk.m_pos.z + 8*i).ToString()))
            {
                PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
                Vector3 pos = new Vector3(chunk.m_pos.x+8*i+1, chunk.m_pos.y+1, chunk.m_pos.z+8*i+1);
                m_voxelChunktemp = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                m_voxelChunktemp.CreateVoxels (m_surfacePerlin);
                m_voxelChunktemp.CreateMesh (terrain.m_material);
                //chunk.bOnce = true;
            }
            //NE
            if(!GameObject.Find ("Voxel Mesh " + (chunk.m_pos.x+8*i).ToString() + " " + (chunk.m_pos.y).ToString() + " " + (chunk.m_pos.z - 8*i).ToString()))
            {
                PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
                Vector3 pos = new Vector3(chunk.m_pos.x+8*i+1, chunk.m_pos.y+1, chunk.m_pos.z-8*i+1);
                m_voxelChunktemp = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                m_voxelChunktemp.CreateVoxels (m_surfacePerlin);
                m_voxelChunktemp.CreateMesh (terrain.m_material);
                //chunk.bOnce = true;
            }
            //S
            if(!GameObject.Find ("Voxel Mesh " + (chunk.m_pos.x-8*i).ToString() + " " + (chunk.m_pos.y).ToString() + " " + (chunk.m_pos.z).ToString()))
            {
                PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
                Vector3 pos = new Vector3(chunk.m_pos.x-8*i+1, chunk.m_pos.y+1, chunk.m_pos.z+1);
                m_voxelChunktemp = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                m_voxelChunktemp.CreateVoxels (m_surfacePerlin);
                m_voxelChunktemp.CreateMesh (terrain.m_material);
                //chunk.bOnce = true;
            }
            //SW
            if(!GameObject.Find ("Voxel Mesh " + (chunk.m_pos.x-8*i).ToString() + " " + (chunk.m_pos.y).ToString() + " " + (chunk.m_pos.z + 8*i).ToString()))
            {
                PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
                Vector3 pos = new Vector3(chunk.m_pos.x-8*i+1, chunk.m_pos.y+1, chunk.m_pos.z+8*i+1);
                m_voxelChunktemp = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                m_voxelChunktemp.CreateVoxels (m_surfacePerlin);
                m_voxelChunktemp.CreateMesh (terrain.m_material);
                //chunk.bOnce = true;
            }
            //SE
            if(!GameObject.Find ("Voxel Mesh " + (chunk.m_pos.x-8*i).ToString() + " " + (chunk.m_pos.y).ToString() + " " + (chunk.m_pos.z - 8*i).ToString()))
            {
                PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
                Vector3 pos = new Vector3(chunk.m_pos.x-8*i+1, chunk.m_pos.y+1, chunk.m_pos.z-8*i+1);
                m_voxelChunktemp = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                m_voxelChunktemp.CreateVoxels (m_surfacePerlin);
                m_voxelChunktemp.CreateMesh (terrain.m_material);
                //chunk.bOnce = true;
            }
            //W
            if(!GameObject.Find ("Voxel Mesh " + (chunk.m_pos.x).ToString() + " " + (chunk.m_pos.y).ToString() + " " + (chunk.m_pos.z + 8*i).ToString()))
            {
                PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
                Vector3 pos = new Vector3(chunk.m_pos.x+1, chunk.m_pos.y+1, chunk.m_pos.z+8*i+1);
                m_voxelChunktemp = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                m_voxelChunktemp.CreateVoxels (m_surfacePerlin);
                m_voxelChunktemp.CreateMesh (terrain.m_material);
                //chunk.bOnce = true;
            }
            //E
            if(!GameObject.Find ("Voxel Mesh " + (chunk.m_pos.x).ToString() + " " + (chunk.m_pos.y).ToString() + " " + (chunk.m_pos.z - 8*i).ToString()))
            {
                PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
                Vector3 pos = new Vector3(chunk.m_pos.x+1, chunk.m_pos.y+1, chunk.m_pos.z-8*i+1);
                m_voxelChunktemp = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                m_voxelChunktemp.CreateVoxels (m_surfacePerlin);
                m_voxelChunktemp.CreateMesh (terrain.m_material);
                //chunk.bOnce = true;
            }
        }
        //Debug.Log ("Difference: " + (chunk.m_pos - centerChunkPos) + " Chunk name: " + chunk.name + " Current Dir: " + currentDir);
        /*if((((chunk.m_pos.z - centerChunkPos.z == -8 || chunk.m_pos.z - centerChunkPos.z == 8)  && chunk.m_pos.x - centerChunkPos.x == 0) || (chunk.m_pos.x - centerChunkPos.x == 0 && chunk.m_pos.z - centerChunkPos.z == 0)) && currentDir == Dir.North)
        {
            if(!GameObject.Find ("Voxel Mesh " + (chunk.m_pos.x+8).ToString() + " " + (chunk.m_pos.y).ToString() + " " + (chunk.m_pos.z).ToString()))
            {
                PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
                Vector3 pos = new Vector3(chunk.m_pos.x+9, chunk.m_pos.y+1, chunk.m_pos.z+1);
                m_voxelChunktemp = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                m_voxelChunktemp.CreateVoxels (m_surfacePerlin);
                m_voxelChunktemp.CreateMesh (terrain.m_material);
                Debug.Log ("Voxel Mesh "  + (chunk.m_pos.x+8).ToString() + " " + (chunk.m_pos.y).ToString() + " " + (chunk.m_pos.z).ToString());
                //chunk.bOnce = true;
            }
        }*/
        /*if(((chunk.m_pos.x - centerChunkPos.x == -8 || chunk.m_pos.x - centerChunkPos.x == 8) && (chunk.m_pos.z - centerChunkPos.z == 0)) || (chunk.m_pos - centerChunkPos) == new Vector3(0,0,0))
        {
            Debug.Log ("CurrentDir (wersja 1)" + currentDir);
            PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
        //	m_voxelChunktemp = new VoxelChunk[1, 2, 1];
        //	for(int x = 0; x<1; x++)
        //	{
        //		for (int y = 0; y<2; y++)
        //		{
        //			for(int z = 0; z< 1; z++)
        //			{

                        Vector3 pos = new Vector3(chunk.m_pos.x+9, chunk.m_pos.y, chunk.m_pos.z + 9);
                        m_voxelChunktemp = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                        m_voxelChunktemp.CreateVoxels (m_surfacePerlin);
                        m_voxelChunktemp.CreateMesh (terrain.m_material);

        //			}
        //		}
        //	}
            i++;
            Debug.Log ("Stworzylem : " + i + " obiektow " + pos);
        }*/

        /*	if(((chunk.m_pos.z - centerChunkPos.z == -8 || chunk.m_pos.z - centerChunkPos.z == 8) && (chunk.m_pos.x - centerChunkPos.x == 0)) || (chunk.m_pos - centerChunkPos) == new Vector3(0,0,0))
        {
            Debug.Log ("CurrentDir (wersja 2)" + currentDir);
            PerlinNoise m_surfacePerlin = new PerlinNoise(terrain.m_surfaceSeed);
            m_voxelChunktemp = new VoxelChunk[1, 2, 1];
            for(int x = 0; x<1; x++)
            {
                for (int y = 0; y<2; y++)
                {
                    for(int z = 0; z< 1; z++)
                    {
                        Vector3 pos = new Vector3(chunk.m_pos.x+9, chunk.m_pos.y, chunk.m_pos.z + 1);
                        m_voxelChunktemp[x, y, z] = new VoxelChunk(pos, terrain.m_voxelWidth, terrain.m_voxelHeight, terrain.m_voxelLength, terrain.m_surfaceLevel);
                        m_voxelChunktemp[x, y, z].CreateVoxels (m_surfacePerlin);
                        m_voxelChunktemp[x, y, z].CreateMesh (terrain.m_material);

                    }
                }
            }
        }*/
        //return chunk;
        chunk.bUsed = true;
        chunks.Remove (chunk);
    }