Example #1
0
        /// <summary>
        /// Light probe runtime data is auto-computed when lightprobes are added/removed.  If you move them at runtime, please call this method.
        /// </summary>
        /// <remarks>
        /// This will also update coefficients.
        /// </remarks>
        public void UpdateLightProbePositions()
        {
            RuntimeData        = null;
            needPositionUpdate = false;

            // Initial load
            try
            {
                // Collect LightProbes
                var lightProbes = new FastList <LightProbeComponent>();

                foreach (var lightProbe in ComponentDatas)
                {
                    lightProbes.Add(lightProbe.Key);
                }

                // Need at least 4 light probes to form a tetrahedron
                if (lightProbes.Count < 4)
                {
                    return;
                }

                RuntimeData = LightProbeGenerator.GenerateRuntimeData(lightProbes);
            }
            catch
            {
                // Allow failures
                // TODO: Log
            }
        }
Example #2
0
        /// <summary>
        /// Light probe runtime data is auto-computed when lightprobes are added/removed.  If you move them at runtime, please call this method.
        /// </summary>
        /// <remarks>
        /// This will also update coefficients.
        /// </remarks>
        public void UpdateLightProbePositions()
        {
            VisibilityGroup.Tags.Set(LightProbeRenderer.CurrentLightProbes, null);
            needPositionUpdate = false;

            // Initial load
            try
            {
                // Collect LightProbes
                var lightProbes = new FastList <LightProbeComponent>();

                foreach (var lightProbe in ComponentDatas)
                {
                    lightProbes.Add(lightProbe.Key);
                }

                // Need at least 4 light probes to form a tetrahedron
                if (lightProbes.Count < 4)
                {
                    return;
                }

                VisibilityGroup.Tags.Set(LightProbeRenderer.CurrentLightProbes, LightProbeGenerator.GenerateRuntimeData(lightProbes));
            }
            catch
            {
                // Allow failures
                // TODO: Log
            }
        }
Example #3
0
        /// <summary>
        /// Updates only the coefficients of the light probes (from <see cref="LightProbeComponent.Coefficients"/> to <see cref="LightProbeRuntimeData.Coefficients"/>).
        /// </summary>
        public void UpdateLightProbeCoefficients()
        {
            if (RuntimeData == null)
            {
                return;
            }

            LightProbeGenerator.UpdateCoefficients(RuntimeData);
        }
Example #4
0
        /// <summary>
        /// Updates only the coefficients of the light probes (from <see cref="LightProbeComponent.Coefficients"/> to <see cref="LightProbeRuntimeData.Coefficients"/>).
        /// </summary>
        public void UpdateLightProbeCoefficients()
        {
            var runtimeData = VisibilityGroup.Tags.Get(LightProbeRenderer.CurrentLightProbes);

            if (runtimeData == null)
            {
                return;
            }

            LightProbeGenerator.UpdateCoefficients(runtimeData);
        }