< Summary

Class:DCL.Skybox.SkyboxUtils
Assembly:ProceduralSkybox
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/ProceduralSkybox/ToolProceduralSkybox/Scripts/SkyboxUtils.cs
Covered lines:0
Uncovered lines:4
Coverable lines:4
Total lines:102
Line coverage:0% (0 of 4)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetNormalizedDayTime(...)0%2100%
Vector4ToQuaternion(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/ProceduralSkybox/ToolProceduralSkybox/Scripts/SkyboxUtils.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5namespace DCL.Skybox
 6{
 7    public static class SkyboxUtils
 8    {
 9        /// <summary>
 10        /// Time for one complete circle. In Hours. default 24
 11        /// </summary>
 12        public const float CYCLE_TIME = 24;
 13        public const float DOME_DEFAULT_SIZE = 50;
 14
 15        public static float GetNormalizedDayTime(float timeOfTheDay)
 16        {
 017            float tTime = timeOfTheDay / SkyboxUtils.CYCLE_TIME;
 018            tTime = Mathf.Clamp(tTime, 0, 1);
 019            return tTime;
 20        }
 21
 022        public static Quaternion Vector4ToQuaternion(Vector4 val) { return new Quaternion(val.x, val.y, val.z, val.w); }
 23    }
 24
 25    public static class SkyboxShaderUtils
 26    {
 27        public static Dictionary<string, int> shaderLayersProperties;
 28        public static readonly int LightTint = Shader.PropertyToID("_lightTint");
 29        public static readonly int LightDirection = Shader.PropertyToID("_lightDirection");
 30        public static readonly int SkyColor = Shader.PropertyToID("_skyColor");
 31        public static readonly int GroundColor = Shader.PropertyToID("_groundColor");
 32        public static readonly int HorizonColor = Shader.PropertyToID("_horizonColor");
 33        public static readonly int HorizonHeight = Shader.PropertyToID("_horizonHeight");
 34        public static readonly int HorizonWidth = Shader.PropertyToID("_horizonWidth");
 35        public static readonly int HorizonMask = Shader.PropertyToID("_horizonMask");
 36        public static readonly int HorizonMaskValues = Shader.PropertyToID("_horizonMaskValues");
 37        public static readonly int HorizonPlane = Shader.PropertyToID("_horizonPlane");
 38        public static readonly int HorizonPlaneValues = Shader.PropertyToID("_horizonPlaneValues");
 39        public static readonly int HorizonPlaneColor = Shader.PropertyToID("_horizonPlaneColor");
 40        public static readonly int HorizonPlaneHeight = Shader.PropertyToID("_horizonPlaneHeight");
 41        public static readonly int PlaneSmoothRange = Shader.PropertyToID("_smoothRange");
 42        public static readonly int HorizonLightIntensity = Shader.PropertyToID("_horizonLigthIntesity");
 43        public static readonly int FogIntensity = Shader.PropertyToID("_fogIntesity");
 44        public static readonly int Opacity = Shader.PropertyToID("_Opacity");
 45
 46        static SkyboxShaderUtils() { CacheShaderProperties(); }
 47
 48        static void CacheShaderProperties()
 49        {
 50            shaderLayersProperties = new Dictionary<string, int>();
 51            for (int i = 0; i < 5; i++)
 52            {
 53                shaderLayersProperties.Add("_layerType_" + i, Shader.PropertyToID("_layerType_" + i));
 54                shaderLayersProperties.Add("_fadeTime_" + i, Shader.PropertyToID("_fadeTime_" + i));
 55
 56                shaderLayersProperties.Add("_RenderDistance_" + i, Shader.PropertyToID("_RenderDistance_" + i));
 57                shaderLayersProperties.Add("_tex_" + i, Shader.PropertyToID("_tex_" + i));
 58                shaderLayersProperties.Add("_cubemap_" + i, Shader.PropertyToID("_cubemap_" + i));
 59                shaderLayersProperties.Add("_normals_" + i, Shader.PropertyToID("_normals_" + i));
 60                shaderLayersProperties.Add("_color_" + i, Shader.PropertyToID("_color_" + i));
 61                shaderLayersProperties.Add("_timeFrame_" + i, Shader.PropertyToID("_timeFrame_" + i));
 62                shaderLayersProperties.Add("_rowAndCollumns_" + i, Shader.PropertyToID("_rowAndCollumns_" + i));
 63
 64                shaderLayersProperties.Add("_lightIntensity_" + i, Shader.PropertyToID("_lightIntensity_" + i));
 65                shaderLayersProperties.Add("_normalIntensity_" + i, Shader.PropertyToID("_normalIntensity_" + i));
 66
 67                shaderLayersProperties.Add("_distortIntAndSize_" + i, Shader.PropertyToID("_distortIntAndSize_" + i));
 68                shaderLayersProperties.Add("_distortSpeedAndSharp_" + i, Shader.PropertyToID("_distortSpeedAndSharp_" + 
 69
 70
 71                shaderLayersProperties.Add("_particlesMainParameters_" + i, Shader.PropertyToID("_particlesMainParameter
 72                shaderLayersProperties.Add("_particlesSecondaryParameters_" + i, Shader.PropertyToID("_particlesSecondar
 73
 74                shaderLayersProperties.Add("_tilingAndOffset_" + i, Shader.PropertyToID("_tilingAndOffset_" + i));
 75                shaderLayersProperties.Add("_speedAndRotation_" + i, Shader.PropertyToID("_speedAndRotation_" + i));
 76            }
 77
 78        }
 79
 80        public static int GetLayerProperty(string name)
 81        {
 82            int propertyInt;
 83            if (shaderLayersProperties == null || shaderLayersProperties.Count <= 0)
 84            {
 85                CacheShaderProperties();
 86            }
 87
 88            if (!shaderLayersProperties.ContainsKey(name))
 89            {
 90                propertyInt = Shader.PropertyToID(name);
 91                shaderLayersProperties.Add(name, propertyInt);
 92            }
 93            else
 94            {
 95                propertyInt = shaderLayersProperties[name];
 96            }
 97
 98            return propertyInt;
 99        }
 100
 101    }
 102}