Exemple #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
            }
        }
Exemple #2
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);
        }