Esempio n. 1
0
 private void merge(VoxelStream source, VoxelStream destination)
 {
     byte[,,] sourceData = source.GetAllBlocks();
     byte[,,] destData   = destination.GetAllBlocks();
     for (int x = 0; x < sourceData.GetLength(0); x++)
     {
         for (int y = 0; y < sourceData.GetLength(1); y++)
         {
             for (int z = 0; z < sourceData.GetLength(2); z++)
             {
                 destData [x, 32 + y, z] = sourceData [x, y, z];
             }
         }
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (chunks == null)
        {
            objectGO = GameObject.Instantiate(objectToView) as GameObject;
            voxels   = objectGO.GetComponent(typeof(VoxelStream)) as VoxelStream;
            voxels.create(null);
            objectBounds = voxels.getBounds();
            chunks       = new Chunk[Mathf.FloorToInt(objectBounds.x / Chunk.chunkSize),
                                     Mathf.FloorToInt(objectBounds.y / Chunk.chunkSize),
                                     Mathf.FloorToInt(objectBounds.z / Chunk.chunkSize)];


            GenerateChunks();
        }
    }
 public void setVoxelsToRender(VoxelStream inVoxels)
 {
     voxels = inVoxels;
 }