Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="chunk"></param>
        /// <param name="coords"></param>
        /// <returns></returns>
        protected static int GetLight(IChunk chunk, Coordinates3D coords)
        {
            // Handle icon renderer.
            if (chunk == null)
            {
                return(15);
            }

            // Handle top (and bottom) of the world.
            if (coords.Y < 0)
            {
                return(0);
            }
            if (coords.Y >= Chunk.Height)
            {
                return(15);
            }

            // Handle coordinates outside the chunk.
            if ((coords.X < 0) || (coords.X >= Chunk.Width) ||
                (coords.Z < 0) || (coords.Z >= Chunk.Depth))
            {
                return(15);
            }

            return(Math.Min(chunk.GetBlockLight(coords) + chunk.GetSkyLight(coords), 15));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="chunk"></param>
        /// <param name="coords"></param>
        /// <returns></returns>
        protected static int GetLight(IChunk chunk, Coordinates3D coords)
        {
            // Handle icon renderer.
            if (chunk == null)
                return 15;

            // Handle top (and bottom) of the world.
            if (coords.Y < 0)
                return 0;
            if (coords.Y >= Chunk.Height)
                return 15;

            // Handle coordinates outside the chunk.
            if ((coords.X < 0) || (coords.X >= Chunk.Width) ||
                (coords.Z < 0) || (coords.Z >= Chunk.Depth))
            {
                // TODO: Handle chunk boundaries properly.
                return 0;
            }

            return Math.Min(chunk.GetBlockLight(coords) + chunk.GetSkyLight(coords), 15);
        }