ARLightEstimate.cs 949 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. namespace UnityARInterface
  3. {
  4. public class ARLightEstimate : MonoBehaviour
  5. {
  6. private Light m_Light;
  7. // Use this for initialization
  8. void Start()
  9. {
  10. m_Light = GetComponent<Light>();
  11. if (m_Light == null)
  12. enabled = false;
  13. }
  14. void Update()
  15. {
  16. var lightEstimate = ARInterface.GetInterface().GetLightEstimate();
  17. if ((lightEstimate.capabilities & ARInterface.LightEstimateCapabilities.AmbientIntensity) == ARInterface.LightEstimateCapabilities.AmbientIntensity)
  18. m_Light.intensity = lightEstimate.ambientIntensity;
  19. if ((lightEstimate.capabilities & ARInterface.LightEstimateCapabilities.AmbientColorTemperature) == ARInterface.LightEstimateCapabilities.AmbientColorTemperature)
  20. m_Light.colorTemperature = lightEstimate.ambientColorTemperature;
  21. }
  22. }
  23. }