private void Update() { // ditch out if we already have our first stamp if ((stampCount > 0 && singleStampOnly)) { return; } // check the cache to see if our current orientation would benefit from a new stamp if (captureCamera.IsReady && !captureCamera.IsRequestingImage) { if (!map.IsCached(cameraOrientation.position, cameraOrientation.forward)) { captureCamera.RequestImage(OnReceivedImage); } } // If we have a target light rotation to get to, start lerping! if (lightStartTime > 0) { float t = Mathf.Clamp01((Time.time - lightStartTime) / lightTargetDuration); if (t >= 1) { lightStartTime = 0; } // This is a cheap cubic in/out easing function, so we aren't doing this linear (ew) t = t < .5f ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; directionalLight.transform.localRotation = Quaternion.Lerp(lightStartDir, lightTargetDir, t); } }
protected virtual void Update() { // ditch out if we already have our first stamp if ((stampCount > 0 && singleStampOnly)) { return; } // check the cache to see if our current orientation would benefit from a new stamp if (map != null && cameraCapture.IsReady && !cameraCapture.IsRequestingImage) { if (!map.IsCached(cameraOrientation.position, cameraOrientation.forward)) { // Take stamp, but do not await. Let it run blindly so we don't block the // rest of our Update loop var t = TakeStampAsync(); } } // If we have a target light rotation to get to, start lerping! if (lightStartTime > 0) { float t = Mathf.Clamp01((Time.time - lightStartTime) / lightTargetDuration); if (t >= 1) { lightStartTime = 0; } // This is a cheap cubic in/out easing function, so we aren't doing this linear (ew) t = t < .5f ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; directionalLight.transform.localRotation = Quaternion.Lerp(lightStartDir, lightTargetDir, t); } }