Exemple #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);
        }
Exemple #2
0
        void updateChunkCenterDisplay(CullHiddenEdgeVoxelsJob cullJob, ChunkGenData data, int lod = 0)
        {
            var  display    = new List <VoxelGeomDataMirror>(data.displays.lodArrays[lod].Length);
            uint emptyVoxel = vGenConfig.EmptyVoxel;

            for (int i = 0; i < cullJob.displayVoxels.Length; ++i)
            {
                if (cullJob.displayVoxels[i].voxel != emptyVoxel)
                {
                    display.Add(cullJob.displayVoxels[i]);
                }
            }
            data.displays.lodArrays[lod] = display.ToArray();
        }