Ejemplo n.º 1
0
        public static LightValue GetLightValue(int3 pos, NativeArray <LightValue> lights, int3 dimensions, NeighbourData neighbourData)
        {
            neighbourData.AdjustLocalPos(ref pos, out var InChunk, out var DirectionOfNeighbour, dimensions);
            if (InChunk)
            {
                return(lights[Utils.Helpers.MultiIndexToFlat(pos.x, pos.y, pos.z, dimensions)]);
            }
            else
            {
                var localIndexInNeighbour = neighbourData.IndicesInNeighbour(DirectionOfNeighbour, pos);
                var neighbourDimensions   = neighbourData.IndicesInNeighbour(DirectionOfNeighbour, dimensions);

                var flattenedIndex = Utils.Helpers.MultiIndexToFlat(localIndexInNeighbour.x, localIndexInNeighbour.y, neighbourDimensions);

                var neighbourLightData = neighbourData.GetLightValues(DirectionOfNeighbour);
                return(neighbourLightData[flattenedIndex]);
            }
        }