| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace DCL.Skybox |
| | 6 | | { |
| | 7 | | public enum SkyboxEditorToolsParts |
| | 8 | | { |
| | 9 | | Timeline_Tags, |
| | 10 | | BG_Layer, |
| | 11 | | Horizon_Plane, |
| | 12 | | Ambient_Layer, |
| | 13 | | Avatar_Layer, |
| | 14 | | Fog_Layer, |
| | 15 | | Directional_Light_Layer, |
| | 16 | | Base_Skybox, |
| | 17 | | Elements3D_Dome, |
| | 18 | | Elements3D_Satellite, |
| | 19 | | Elements3D_Planar |
| | 20 | | } |
| | 21 | |
|
| | 22 | | public class RightPanelPins |
| | 23 | | { |
| | 24 | | public string name; |
| | 25 | | public SkyboxEditorToolsParts part; |
| | 26 | | public TextureLayer baseSkyboxTargetLayer = null; |
| | 27 | | public Config3DDome targetDomeElement; |
| | 28 | | public Config3DSatellite targetSatelliteElement; |
| | 29 | | public Config3DPlanar targetPlanarElement; |
| | 30 | | public bool pinned; |
| | 31 | | public Vector2 scroll; |
| | 32 | | } |
| | 33 | |
|
| | 34 | | public static class SkyboxEditorUtils |
| | 35 | | { |
| | 36 | |
|
| | 37 | | public static float GetNormalizedLayerCurrentTime(float timeOfTheDay, float startTime, float endTime) |
| | 38 | | { |
| 0 | 39 | | float editedEndTime = endTime; |
| 0 | 40 | | float editedDayTime = timeOfTheDay; |
| 0 | 41 | | if (endTime < startTime) |
| | 42 | | { |
| 0 | 43 | | editedEndTime = SkyboxUtils.CYCLE_TIME + endTime; |
| 0 | 44 | | if (timeOfTheDay < startTime) |
| | 45 | | { |
| 0 | 46 | | editedDayTime = SkyboxUtils.CYCLE_TIME + timeOfTheDay; |
| | 47 | | } |
| | 48 | | } |
| 0 | 49 | | return Mathf.InverseLerp(startTime, editedEndTime, editedDayTime); |
| | 50 | | } |
| | 51 | |
|
| | 52 | | public static float GetDayTimeForLayerNormalizedTime(float startTime, float endTime, float normalizeTime) |
| | 53 | | { |
| 0 | 54 | | float editedEndTime = endTime; |
| 0 | 55 | | if (endTime < startTime) |
| | 56 | | { |
| 0 | 57 | | editedEndTime = SkyboxUtils.CYCLE_TIME + endTime; |
| | 58 | | } |
| 0 | 59 | | float time = Mathf.Lerp(startTime, editedEndTime, normalizeTime); |
| | 60 | |
|
| 0 | 61 | | if (time > SkyboxUtils.CYCLE_TIME) |
| | 62 | | { |
| 0 | 63 | | time -= SkyboxUtils.CYCLE_TIME; |
| | 64 | | } |
| | 65 | |
|
| 0 | 66 | | return time; |
| | 67 | | } |
| | 68 | |
|
| 0 | 69 | | public static void ClampToDayTime(ref float value) { value = Mathf.Clamp(value, 0, SkyboxUtils.CYCLE_TIME); } |
| | 70 | | } |
| | 71 | | } |