< Summary

Class:DCL.Skybox.SkyboxEditorUtils
Assembly:SkyboxEditorAssembly
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/ProceduralSkybox/ToolProceduralSkybox/Scripts/Editor/Procedural Skybox/SkyboxEditorUtils.cs
Covered lines:0
Uncovered lines:15
Coverable lines:15
Total lines:71
Line coverage:0% (0 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetNormalizedLayerCurrentTime(...)0%12300%
GetDayTimeForLayerNormalizedTime(...)0%12300%
ClampToDayTime(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/ProceduralSkybox/ToolProceduralSkybox/Scripts/Editor/Procedural Skybox/SkyboxEditorUtils.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5namespace 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        {
 039            float editedEndTime = endTime;
 040            float editedDayTime = timeOfTheDay;
 041            if (endTime < startTime)
 42            {
 043                editedEndTime = SkyboxUtils.CYCLE_TIME + endTime;
 044                if (timeOfTheDay < startTime)
 45                {
 046                    editedDayTime = SkyboxUtils.CYCLE_TIME + timeOfTheDay;
 47                }
 48            }
 049            return Mathf.InverseLerp(startTime, editedEndTime, editedDayTime);
 50        }
 51
 52        public static float GetDayTimeForLayerNormalizedTime(float startTime, float endTime, float normalizeTime)
 53        {
 054            float editedEndTime = endTime;
 055            if (endTime < startTime)
 56            {
 057                editedEndTime = SkyboxUtils.CYCLE_TIME + endTime;
 58            }
 059            float time = Mathf.Lerp(startTime, editedEndTime, normalizeTime);
 60
 061            if (time > SkyboxUtils.CYCLE_TIME)
 62            {
 063                time -= SkyboxUtils.CYCLE_TIME;
 64            }
 65
 066            return time;
 67        }
 68
 069        public static void ClampToDayTime(ref float value) { value = Mathf.Clamp(value, 0, SkyboxUtils.CYCLE_TIME); }
 70    }
 71}