Beispiel #1
0
        /// <summary>
        /// Registers an AuraLight onto the correct manager
        /// </summary>
        /// <param name="light">The candidate light</param>
        public void Register(AuraLight light, bool castShadows, bool castCookie)
        {
            switch (light.Type)
            {
            case LightType.Directional:
            {
                DirectionalLightsManager.Register(light, castShadows, castCookie);
            }
            break;

            case LightType.Spot:
            {
                SpotLightsManager.Register(light, castShadows, castCookie);
            }
            break;

            case LightType.Point:
            {
                PointLightsManager.Register(light, castShadows, castCookie);
            }
            break;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Unregisters an AuraLight from the correct manager
        /// </summary>
        /// <param name="light">The candidate light</param>
        public void Unregister(AuraLight light)
        {
            switch (light.Type)
            {
            case LightType.Directional:
            {
                DirectionalLightsManager.Unregister(light);
            }
            break;

            case LightType.Spot:
            {
                SpotLightsManager.Unregister(light);
            }
            break;

            case LightType.Point:
            {
                PointLightsManager.Unregister(light);
            }
            break;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Unregisters an AuraLights
        /// </summary>
        /// <param name="light">The candidate light</param>
        /// <returns>True if unregistration went well, false otherwise</returns>
        public bool Unregister(AuraLight light)
        {
            if (_lights.Contains(light))
            {
                if (light.cookieMapRenderTexture != null)
                {
                    _cookieMapsCollector.RemoveTexture(light.cookieMapRenderTexture);
                }

                if (light.shadowMapRenderTexture != null)
                {
                    _shadowmapsCollector.RemoveTexture(light.shadowMapRenderTexture);
                    _shadowDataCollector.RemoveTexture(light.shadowDataRenderTexture);
                }

                _lights.Remove(light);
                SetupBuffers();

                return(true);
            }

            return(false);
        }
Beispiel #4
0
        /// <summary>
        /// Register an AuraLights to be taken into account
        /// </summary>
        /// <param name="light">The candidate light</param>
        /// <returns>True if registration went well, false otherwise</returns>
        public bool Register(AuraLight light, bool castShadows, bool castCookie)
        {
            if (light.Type == LightType.Directional && !_lights.Contains(light))
            {
                _lights.Add(light);
                SetupBuffers();

                if (castShadows)
                {
                    _shadowmapsCollector.AddTexture(light.shadowMapRenderTexture);
                    _shadowDataCollector.AddTexture(light.shadowDataRenderTexture);
                }

                if (castCookie)
                {
                    _cookieMapsCollector.AddTexture(light.cookieMapRenderTexture);
                }

                return(true);
            }

            return(false);
        }
Beispiel #5
0
        /// <summary>
        /// Unregisters an AuraLights
        /// </summary>
        /// <param name="light">The candidate light</param>
        /// <returns>True if unregistration went well, false otherwise</returns>
        public bool Unregister(AuraLight light) // TODO : HANDLE SHADOW/COOKIE UNREGISTRATION AUTOMATICALLY
        {
            if (_lights.Contains(light))
            {
                if (light.cookieMapRenderTexture != null)
                {
                    _cookieMapsCollector.RemoveTexture(light.cookieMapRenderTexture);
                }

                if (light.shadowMapRenderTexture != null)
                {
                    _shadowmapsCollector.RemoveTexture(light.shadowMapRenderTexture);
                }

                _culler.Unregister(light);

                _lights.Remove(light);

                return(true);
            }

            return(false);
        }
Beispiel #6
0
        /// <summary>
        /// Register an AuraLights to be taken into account
        /// </summary>
        /// <param name="light">The candidate light</param>
        /// <returns>True if registration went well, false otherwise</returns>
        public bool Register(AuraLight light, bool castShadows, bool castCookie)
        {
            if (light.Type == LightType.Spot && !_lights.Contains(light))
            {
                _culler.Register(light);

                _lights.Add(light);

                if (castShadows)
                {
                    _shadowmapsCollector.AddTexture(light.shadowMapRenderTexture);
                }

                if (castCookie)
                {
                    _cookieMapsCollector.AddTexture(light.cookieMapRenderTexture);
                }

                return(true);
            }

            return(false);
        }