/// <summary> /// Releases the point lights render textures collectors /// </summary> private void ReleasePointRenderTexturesCollectors() { if (_pointLightsShadowMapsCollector != null) { _pointLightsShadowMapsCollector.Release(); _pointLightsShadowMapsCollector = null; } if (_pointLightsCookieMapsCollector != null) { _pointLightsCookieMapsCollector.Release(); _pointLightsCookieMapsCollector = null; } }
/// <summary> /// Releases all the managed members /// </summary> internal void Dispose() { if (_volumesTexture2DMasksArray != null) { _volumesTexture2DMasksArray.Release(); _volumesTexture2DMasksArray = null; } if (_volumesTexture3DMasksAtlas != null) { _volumesTexture3DMasksAtlas.Release(); _volumesTexture3DMasksAtlas = null; } }
/// <summary> /// Releases the directional lights render textures collectors /// </summary> private void ReleaseDirectionalRenderTexturesCollectors() { if (_directionalLightsShadowMapsCollector != null) { _directionalLightsShadowMapsCollector.Release(); _directionalLightsShadowMapsCollector = null; } if (_directionalLightsShadowDataCollector != null) { _directionalLightsShadowDataCollector.Release(); _directionalLightsShadowDataCollector = null; } if (_directionalLightsCookieMapsCollector != null) { _directionalLightsCookieMapsCollector.Release(); _directionalLightsCookieMapsCollector = null; } }
/// <summary> /// Registers the Aura light to the global manager /// </summary> /// <param name="auraLight">The Aura Light to register</param> public void RegisterLight(AuraLight auraLight) { switch (auraLight.Type) { case LightType.Directional: { if (!RegisteredDirectionalLightsList.Contains(auraLight)) { RegisteredDirectionalLightsList.Add(auraLight); if (auraLight.CastsShadows) { if (_directionalLightsShadowMapsCollector == null) { _directionalLightsShadowMapsCollector = new ShadowmapsCollector(DirectionalLightsManager.ShadowMapSize.x, DirectionalLightsManager.ShadowMapSize.y); } _directionalLightsShadowMapsCollector.AddTexture(auraLight.shadowMapRenderTexture); SetDirectionalShadowMapsId(); if (_directionalLightsShadowDataCollector == null) { _directionalLightsShadowDataCollector = new DirectionalShadowDataCollector(); } _directionalLightsShadowDataCollector.AddTexture(auraLight.shadowDataRenderTexture); } if (auraLight.CastsCookie) { if (_directionalLightsCookieMapsCollector == null) { _directionalLightsCookieMapsCollector = new Texture2DArrayComposer(DirectionalLightsManager.cookieMapSize.x, DirectionalLightsManager.cookieMapSize.y, TextureFormat.R8, true); } _directionalLightsCookieMapsCollector.AddTexture(auraLight.cookieMapRenderTexture); SetDirectionalCookieMapsId(); } } } break; case LightType.Spot: { if (!RegisteredSpotLightsList.Contains(auraLight)) { RegisteredSpotLightsList.Add(auraLight); if (auraLight.CastsShadows) { if (_spotLightsShadowMapsCollector == null) { _spotLightsShadowMapsCollector = new ShadowmapsCollector(SpotLightsManager.shadowMapSize.x, SpotLightsManager.shadowMapSize.y); } _spotLightsShadowMapsCollector.AddTexture(auraLight.shadowMapRenderTexture); SetSpotShadowMapsId(); } if (auraLight.CastsCookie) { if (_spotLightsCookieMapsCollector == null) { _spotLightsCookieMapsCollector = new Texture2DArrayComposer(SpotLightsManager.cookieMapSize.x, SpotLightsManager.cookieMapSize.y, TextureFormat.R8, true); } _spotLightsCookieMapsCollector.AddTexture(auraLight.cookieMapRenderTexture); SetSpotCookieMapsId(); } if (OnRegisterSpotLight != null) { OnRegisterSpotLight(auraLight); } } } break; case LightType.Point: { if (!RegisteredPointLightsList.Contains(auraLight)) { RegisteredPointLightsList.Add(auraLight); if (auraLight.CastsShadows) { if (_pointLightsShadowMapsCollector == null) { _pointLightsShadowMapsCollector = new ShadowmapsCollector(PointLightsManager.shadowMapSize.x, PointLightsManager.shadowMapSize.y); } _pointLightsShadowMapsCollector.AddTexture(auraLight.shadowMapRenderTexture); SetPointShadowMapsId(); } if (auraLight.CastsCookie) { if (_pointLightsCookieMapsCollector == null) { _pointLightsCookieMapsCollector = new Texture2DArrayComposer(PointLightsManager.cookieMapSize.x, PointLightsManager.cookieMapSize.y, TextureFormat.R8, true); _pointLightsCookieMapsCollector.alwaysGenerateOnUpdate = true; } _pointLightsCookieMapsCollector.AddTexture(auraLight.cookieMapRenderTexture); SetPointCookieMapsId(); } if (OnRegisterPointLight != null) { OnRegisterPointLight(auraLight); } } } break; } auraLight.OnUninitialize += AuraLight_OnUninitialize; }