Exemplo n.º 1
0
        //CONSIDER: we will want to define this class's relationship to Chunk at some point

        public void Init(IntVector3 chunkPos, uint[] voxels)
        {
            int depth = vGenConfig.hilbertBits;

            Vector3 center = vGenConfig.ChunkPosToPos(chunkPos) + vGenConfig.ChunkSize / 2f;
            var     bounds = new Bounds(center, vGenConfig.ChunkSize);

            tree = new VoxelOctree <uint>(depth, bounds);

            foreach (uint vox in voxels)
            {
                IntVector3 pos = IntVector3.FromUint256(vox);
                tree.Set(vox, pos.ToVector3());
            }

            // instantiate or just set up raycast display
            rayDisplay = Instantiate(raycastDisplayPrefab);
            rayDisplay.transform.SetParent(transform);
            rayDisplay.transform.localPosition = vGenConfig.ChunkPosToPos(chunkPos);

            //ComputeBuffer b = BufferUtil.CreateWith(voxels);

            rayDisplay.initialize(null);
            //ResetBufferData(voxels); //test


            StartCoroutine(Scan()); //want
        }
Exemplo n.º 2
0
 public void setMapOffset(IntVector3 mapoffset)
 {
     perlinGen.SetVector("MapOffset", (Vector3)vGenConfig.ChunkPosToPos(mapoffset));
 }