Esempio n. 1
0
        public void Add(VoxelData voxel, int x, int y, int z)
        {
            switch (voxel.shape)
            {
            case VoxelShape.BLOCK:
                RenderQueue r = getQueue(voxel.id, voxel.shape);
                r.voxels[x + parent.chunkSize * (y + parent.chunkSize * z)] = true;
                break;

            case VoxelShape.NONE:
            default:     // Don't render if not implemented
                return;
            }
        }
Esempio n. 2
0
        private RenderQueue getQueue(short id, VoxelShape shape)
        {
            Predicate <RenderQueue> idFinder = (RenderQueue q) => { return(q.id == id); };
            bool exists = queues.Exists(idFinder);

            if (exists)
            {
                return(queues.Find(idFinder));
            }
            else
            {
                RenderQueue q = new RenderQueue();
                q.id     = id;
                q.shape  = shape;
                q.voxels = new BitArray(parent.chunkSize * parent.chunkSize * parent.chunkSize);
                queues.Add(q);
                return(q);
            }
        }