Esempio n. 1
0
        protected IChunkGroupRoot CreateChunkGroupAtCoordinate(Vector3Int coord)
        {
            IChunkGroupRoot chunkGroup = new ChunkGroupRoot(new int[] { coord.x, coord.y, coord.z });

            chunkGroups.Add(coord, chunkGroup);
            return(chunkGroup);
        }
Esempio n. 2
0
        protected CompressedMarchingCubeChunk GetChunkObjectAt(CompressedMarchingCubeChunk chunk, Vector3Int position, int lodPower, int chunkSizePower, bool allowOverride)
        {
            ///Pot racecondition
            ChunkGroupRoot chunkGroupRoot = chunkGroup.GetOrCreateGroupAtGlobalPosition(VectorExtension.ToArray(position));

            chunk.ChunkHandler   = this;
            chunk.ChunkSizePower = chunkSizePower;
            chunk.ChunkUpdater   = worldUpdater;
            chunk.Material       = chunkMaterial;
            chunk.LODPower       = lodPower;

            chunkGroupRoot.SetLeafAtPosition(new int[] { position.x, position.y, position.z }, chunk, allowOverride);

            return(chunk);
        }
Esempio n. 3
0
        public void BuildEmptyChunkAt(Vector3Int pos)
        {
            int[]          posArray       = VectorExtension.ToArray(pos);
            ChunkGroupRoot chunkGroupRoot = chunkGroup.GetOrCreateGroupAtGlobalPosition(posArray);

            if (!chunkGroupRoot.HasLeafAtGlobalPosition(posArray))
            {
                CompressedMarchingCubeChunk chunk = new CompressedMarchingCubeChunk();
                chunk.ChunkHandler   = this;
                chunk.ChunkSizePower = CHUNK_GROUP_SIZE_POWER;
                chunk.ChunkUpdater   = worldUpdater;
                chunk.LODPower       = MAX_CHUNK_LOD_POWER + 1;

                chunk.IsSpawner = true;

                chunkGroupRoot.SetLeafAtPosition(new int[] { pos.x, pos.y, pos.z }, chunk, false);

                simpleChunkColliderPool.GetItemFromPoolFor(chunk);
            }
        }