Ejemplo n.º 1
0
        private FaceDescriptor maskData(int3 position, Direction direction, int3 lightPosition)
        {
            var flatIndex = MultiIndexToFlat(position.x, position.y, position.z, data.dimensions.x, dxdy);
            var typeId    = data.voxels[flatIndex];
            var lv        = JobUtils.GetLightValue(lightPosition, data.lights, data.dimensions, data.neighbourData);

            if (rotatedVoxelsMap.TryGetValue(flatIndex, out var rotation))
            {
                return(makeFaceDescriptor(typeId, direction, lv, rotation));
            }
            return(makeFaceDescriptor(typeId, direction, lv));
        }
Ejemplo n.º 2
0
        private FaceDescriptor GetFaceInNeighbour(int3 position, Direction neighbourDirection, Direction faceDirection, int primaryAxis, int3 lightPosition)
        {
            var localIndexOfAdjacentVoxelInNeighbour = data.neighbourData.IndicesInNeighbour(primaryAxis, position);

            var neighbourChunkData = data.neighbourData.GetVoxels(neighbourDirection);

            var neighbourDimensions = data.neighbourData.IndicesInNeighbour(primaryAxis, data.dimensions);

            var flattenedIndex = MultiIndexToFlat(localIndexOfAdjacentVoxelInNeighbour.x, localIndexOfAdjacentVoxelInNeighbour.y, neighbourDimensions);

            var id = neighbourChunkData[flattenedIndex];

            var lv = JobUtils.GetLightValue(lightPosition, data.lights, data.dimensions, data.neighbourData);

            //NOTE currently the rotation data is not fetched for neighbours, so this can't be incorporated.
            return(makeFaceDescriptor(id, faceDirection, lv));
        }