示例#1
0
        CullHiddenEdgeVoxelsJob SetupCullHidden(NeighborChunkGenData neis, Allocator _alloc = Allocator.TempJob, int lodIndex = 0)
        {
            CullHiddenEdgeVoxelsJob job = new CullHiddenEdgeVoxelsJob();

            job.displayVoxels = new NativeArray <VoxelGeomDataMirror>(neis.centerChunkData.displays[lodIndex], _alloc);


            job.center = new NativeArray <VoxelGenDataMirror>(neis.centerChunkData.lods[lodIndex], _alloc);

            // TODO: neibs always get the full chunk data
            // have to rewrite some of parts of the get voxel at function
            // when lod gr than 0. have to search multiple nei cubes (we think)

            job.right   = new NativeArray <VoxelGenDataMirror>(neis.Get(NeighborDirection.Right).lods[lodIndex], _alloc);
            job.left    = new NativeArray <VoxelGenDataMirror>(neis.Get(NeighborDirection.Left).lods[lodIndex], _alloc);
            job.up      = new NativeArray <VoxelGenDataMirror>(neis.Get(NeighborDirection.Up).lods[lodIndex], _alloc);
            job.down    = new NativeArray <VoxelGenDataMirror>(neis.Get(NeighborDirection.Down).lods[lodIndex], _alloc);
            job.forward = new NativeArray <VoxelGenDataMirror>(neis.Get(NeighborDirection.Forward).lods[lodIndex], _alloc);
            job.back    = new NativeArray <VoxelGenDataMirror>(neis.Get(NeighborDirection.Back).lods[lodIndex], _alloc);

            job.chunkSize        = vGenConfig.ChunkSize;
            job.voxelsPerMapData = VGenConfig.VoxelsPerMapData;
            job.EmptyVoxel       = vGenConfig.EmptyVoxel;
            job.lodIndex         = lodIndex;

            return(job);
        }
        void SetExistsMap(NeighborChunkGenData nei)
        {
            int sizeOfExistMap = vGenConfig.SizeOfExistsMap;
            var bounds         = nei.neighbors.bounds;

            foreach (var pos in bounds.IteratorXYZ)
            {
                var rel   = bounds.RelativeOrigin(pos);
                int start = rel.ToFlatZXYIndex(new IntVector3(3));

                ExistsMap27.SetData(nei.Get(pos).ExistsMap, 0, start * sizeOfExistMap, sizeOfExistMap);
            }
        }
示例#3
0
        private void SetUp(NeighborChunkGenData nei, VertexLocalLightJob job, int lodIndex, Allocator allo)
        {
            job.locks          = new object[nei.centerChunkData.displays.getLengths()[lodIndex]];
            job.display        = new NativeArray <VoxelGeomDataMirror>(nei.centerChunkData.displays[lodIndex], allo);
            job.chunkSize      = vGenConfig.ChunkSize;
            job.SizeOfHLSLUInt = VGenConfig.SizeOfHLSLInt;

            var cubeOfExists27 = new  NativeNeighbors27 <NativeArray <uint> >(nei.center, allo);

            foreach (var pos in Cube27.NeighborsOfIncludingCenter(nei.center))
            {
                cubeOfExists27.Set(pos, new NativeArray <uint>(nei.Get(pos).ExistsMap, allo));
            }

            job.cubeOfExists = cubeOfExists27;
        }