/// <summary> /// Updates the manager (collects shadows/cookies/data and packs them) /// </summary> public void Update() { if (HasCandidateLights) { _shadowmapsCollector.Generate(); _shadowDataCollector.Generate(); _cookieMapsCollector.Generate(); for (int i = 0; i < _lights.Count; ++i) { _lights[i].SetShadowMapIndex(_shadowmapsCollector.GetTextureIndex(_lights[i].shadowMapRenderTexture)); _lights[i].SetCookieMapIndex(_cookieMapsCollector.GetTextureIndex(_lights[i].cookieMapRenderTexture)); _parameters[i] = _lights[i].GetDirectionnalParameters(); } DataBuffer.SetData(_parameters); } if (OnCascadesCountChanged != null && _previousCascadesCount != QualitySettings.shadowCascades) { _shadowmapsCollector.Resize(DirectionalLightsManager.ShadowMapSize.x, DirectionalLightsManager.ShadowMapSize.y); _previousCascadesCount = QualitySettings.shadowCascades; OnCascadesCountChanged(); } }
/// <summary> /// Updates the manager (collects shadows/cookies/data and packs them) /// </summary> public void Update() { _culler.Update(); SetupBuffers(); if (_culler.HasVisibleObjects) { _shadowmapsCollector.Generate(); _cookieMapsCollector.Generate(); AuraLight[] visibleLights = _culler.GetVisibleObjects(); for (int i = 0; i < _culler.VisibleObjectsCount; ++i) { visibleLights[i].SetShadowMapIndex(_shadowmapsCollector.GetTextureIndex(visibleLights[i].shadowMapRenderTexture)); visibleLights[i].SetCookieMapIndex(_cookieMapsCollector.GetTextureIndex(visibleLights[i].cookieMapRenderTexture)); _visibleSpotLightParametersArray[i] = visibleLights[i].GetSpotParameters(); } DataBuffer.SetData(_visibleSpotLightParametersArray); } }