Example #1
0
 public Octree GetRoot()
 {
     if (parent != null)
     {
         return(parent.GetRoot());
     }
     else
     {
         return(this);
     }
 }
Example #2
0
        void Culling()
        {
            queries.Clear();


            //currScanPosition = player.position;

            //if (currScanPosition != prevScanPosition) {
            chunks.MarkAllFlush();

            //Profiler.BeginSample("SCAN");
            ScanNodes(currScanPosition, ranges);
            //Profiler.EndSample();

            frustumPlanes = GeometryUtility.CalculateFrustumPlanes(Camera.main);
            LODQuery(octree.GetRoot(), ranges.Length - 1, ranges);

            //prevScanPosition = currScanPosition;
            chunks.Flush();
            //}

            //for (int x = -2; x < 2; x++) {
            //    for (int y = -2; y < 2; y++) {
            //        for (int z = -2; z < 2; z++) {
            //            Vector3 pos = new Vector3(x, y, z);
            //            pos = pos * 64;
            //            //alcAndDisplayChunk(octree.GetRoot().GetNodeAt(pos, 2), false);
            //            CalcAndDisplayChunk(octree.GetRoot().GetNodeAt(pos, 1), true);

            //        }
            //    }
            //}

            //Vector3 pos = new Vector3(-128, -128, -128);
            //CalcAndDisplayChunk(octree.GetRoot().GetNodeAt(pos, 0), false);

            //Debug.Log(chunks.displayedChunks.Count);
        }
Example #3
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);
        }