Пример #1
0
        public void Initialize()
        {
            ClearWorld();
            octree = new Octree(CHUNK_SIZE, new Vector3());
            mc     = new MarchingCube();
            chunks = new ChunkManager(transform, chunkPrefab, mc);


            Debug.Log(CHUNK_SIZE);
            Debug.Log(octree.GetRoot().level);
            int a, b;

            ThreadPool.GetMaxThreads(out a, out b);
            Debug.Log(a + " " + b);
            Debug.Log(Environment.ProcessorCount);
        }
Пример #2
0
        public ChunkManager(Transform parent, GameObject chunkPrefab, MarchingCube mc)
        {
            calculatedChunkQueue = new Queue <Chunk>();
            displayedChunks      = new Dictionary <Chunk, GameObject>();
            pool           = new GameObjectPool();
            toBeRemoved    = new List <Chunk>();
            this.mc        = mc;
            meshCache      = new Dictionary <Chunk, Mesh[]>();
            PP_meshCache   = new Dictionary <Chunk, Mesh>();
            meshCacheQueue = new Queue <Chunk>();

            for (int i = 0; i < poolSize; i++)
            {
                pool.AddToPool(GameObject.Instantiate(chunkPrefab, parent));
            }
        }