Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Makes directional light togglable at runtime #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Assets/MixedRealityToolkit.LightingTools/LightCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class LightCapture : MonoBehaviour

[Header("Directional Lighting")]
[Tooltip("Should the system calculate information for a directional light? This will scrape the lower mips of the Cubemap to find the direction and color of the brightest values, and apply it to the scene's light.")]
[SerializeField] private bool useDirectionalLight = true;
[SerializeField] public bool useDirectionalLight = true;
[Tooltip("When finding the primary light color, it will average the brightest 20% of the pixels, and use that color for the light. This sets the cap for the saturation of that color.")]
[SerializeField, Range(0,1)] private float maxLightColorSaturation = 0.3f;
[Tooltip("The light eases into its new location when the information is updated. This is the speed at which it eases to its new destination, measured in degrees per second.")]
Expand Down Expand Up @@ -182,7 +182,11 @@ private void OnEnable()
startLightColor = directionalLight.color;
startLightRot = directionalLight.transform.rotation;
startLightBrightness = directionalLight.intensity;
UpdateDirectionalLight();

if (useDirectionalLight)
{
UpdateDirectionalLight();
}
}

probe.mode = UnityEngine.Rendering.ReflectionProbeMode.Custom;
Expand Down Expand Up @@ -338,6 +342,7 @@ public void Clear()
{
map.Clear();
stampCount = 0;
lightStartTime = -1;
}
#endregion
}
Expand Down