private static void PrepareLights() { m_renderProfiler.StartProfilingBlock("Prepare lights"); // Select small lights and do frustum check if (MyRender.CurrentRenderSetup.EnableSmallLights.Value) { List <MyLight> usedLights = null; if (CurrentRenderSetup.LightsToUse == null) { var frustum = MyCamera.GetBoundingFrustum(); MyLights.UpdateSortedLights(ref frustum); usedLights = MyLights.GetSortedLights(); } else { usedLights = CurrentRenderSetup.LightsToUse; } m_pointLights.Clear(); m_hemiLights.Clear(); m_spotLightRenderElements.Clear(); m_spotLightsPool.DeallocateAll(); foreach (var light in usedLights) { if (light.LightOn) // Light is on { if ((light.LightType & MyLight.LightTypeEnum.PointLight) != 0 && (light.LightType & MyLight.LightTypeEnum.Hemisphere) == 0) // Light is point { if (light.IsPointLightInFrustum()) { m_pointLights.Add(light); } } if ((light.LightType & MyLight.LightTypeEnum.Hemisphere) != 0) // Light is hemi { if (light.IsPointLightInFrustum()) { m_hemiLights.Add(light); } } if ((light.LightType & MyLight.LightTypeEnum.Spotlight) != 0 && light.ReflectorOn) // Light is spot { if (light.IsSpotLightInFrustum()) { AddSpotLightRenderElement(light); } } } } } m_renderProfiler.EndProfilingBlock(); }