// Scatters the initial light throughout the map. public static void Scatter(int worldX, int worldZ, Queue <Vector3i> sunNodes, Queue <Vector3i> lightNodes) { for (int x = worldX; x < worldX + Chunk.Size; x++) { for (int z = worldZ; z < worldZ + Chunk.Size; z++) { int ray = MapLight.GetRay(x, z); int maxY = ComputeMaxY(x, z, ray); for (int y = ray; y <= maxY; y++) { if (y >= Map.Height) { continue; } sunNodes.Enqueue(new Vector3i(x, y, z)); byte light = Map.GetBlock(x, y, z).LightEmitted(); if (light > LightUtils.MinLight) { MapLight.SetLight(x, y, z, light); lightNodes.Enqueue(new Vector3i(x, y, z)); } } } } ScatterNodes(sunNodes, true); BlockLightEngine.ScatterNodes(lightNodes, true); }
public static void RecomputeLighting(int x, int y, int z) { SunlightEngine.Recompute(new Vector3i(x, y, z), sunNodes); BlockLightEngine.Recompute(new Vector3i(x, y, z), lightNodes); }