< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SkyboxShaderUtils()0%2100%
CacheShaderProperties()0%6200%
GetLayerProperty(...)0%20400%

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        {
 17            float tTime = timeOfTheDay / SkyboxUtils.CYCLE_TIME;
 18            tTime = Mathf.Clamp(tTime, 0, 1);
 19            return tTime;
 20        }
 21
 22        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;
 028        public static readonly int LightTint = Shader.PropertyToID("_lightTint");
 029        public static readonly int LightDirection = Shader.PropertyToID("_lightDirection");
 030        public static readonly int SkyColor = Shader.PropertyToID("_skyColor");
 031        public static readonly int GroundColor = Shader.PropertyToID("_groundColor");
 032        public static readonly int HorizonColor = Shader.PropertyToID("_horizonColor");
 033        public static readonly int HorizonHeight = Shader.PropertyToID("_horizonHeight");
 034        public static readonly int HorizonWidth = Shader.PropertyToID("_horizonWidth");
 035        public static readonly int HorizonMask = Shader.PropertyToID("_horizonMask");
 036        public static readonly int HorizonMaskValues = Shader.PropertyToID("_horizonMaskValues");
 037        public static readonly int HorizonPlane = Shader.PropertyToID("_horizonPlane");
 038        public static readonly int HorizonPlaneValues = Shader.PropertyToID("_horizonPlaneValues");
 039        public static readonly int HorizonPlaneColor = Shader.PropertyToID("_horizonPlaneColor");
 040        public static readonly int HorizonPlaneHeight = Shader.PropertyToID("_horizonPlaneHeight");
 041        public static readonly int PlaneSmoothRange = Shader.PropertyToID("_smoothRange");
 042        public static readonly int HorizonLightIntensity = Shader.PropertyToID("_horizonLigthIntesity");
 043        public static readonly int FogIntensity = Shader.PropertyToID("_fogIntesity");
 044        public static readonly int Opacity = Shader.PropertyToID("_Opacity");
 45
 046        static SkyboxShaderUtils() { CacheShaderProperties(); }
 47
 48        static void CacheShaderProperties()
 49        {
 050            shaderLayersProperties = new Dictionary<string, int>();
 051            for (int i = 0; i < 5; i++)
 52            {
 053                shaderLayersProperties.Add("_layerType_" + i, Shader.PropertyToID("_layerType_" + i));
 054                shaderLayersProperties.Add("_fadeTime_" + i, Shader.PropertyToID("_fadeTime_" + i));
 55
 056                shaderLayersProperties.Add("_RenderDistance_" + i, Shader.PropertyToID("_RenderDistance_" + i));
 057                shaderLayersProperties.Add("_tex_" + i, Shader.PropertyToID("_tex_" + i));
 058                shaderLayersProperties.Add("_cubemap_" + i, Shader.PropertyToID("_cubemap_" + i));
 059                shaderLayersProperties.Add("_normals_" + i, Shader.PropertyToID("_normals_" + i));
 060                shaderLayersProperties.Add("_color_" + i, Shader.PropertyToID("_color_" + i));
 061                shaderLayersProperties.Add("_timeFrame_" + i, Shader.PropertyToID("_timeFrame_" + i));
 062                shaderLayersProperties.Add("_rowAndCollumns_" + i, Shader.PropertyToID("_rowAndCollumns_" + i));
 63
 064                shaderLayersProperties.Add("_lightIntensity_" + i, Shader.PropertyToID("_lightIntensity_" + i));
 065                shaderLayersProperties.Add("_normalIntensity_" + i, Shader.PropertyToID("_normalIntensity_" + i));
 66
 067                shaderLayersProperties.Add("_distortIntAndSize_" + i, Shader.PropertyToID("_distortIntAndSize_" + i));
 068                shaderLayersProperties.Add("_distortSpeedAndSharp_" + i, Shader.PropertyToID("_distortSpeedAndSharp_" + 
 69
 70
 071                shaderLayersProperties.Add("_particlesMainParameters_" + i, Shader.PropertyToID("_particlesMainParameter
 072                shaderLayersProperties.Add("_particlesSecondaryParameters_" + i, Shader.PropertyToID("_particlesSecondar
 73
 074                shaderLayersProperties.Add("_tilingAndOffset_" + i, Shader.PropertyToID("_tilingAndOffset_" + i));
 075                shaderLayersProperties.Add("_speedAndRotation_" + i, Shader.PropertyToID("_speedAndRotation_" + i));
 76            }
 77
 078        }
 79
 80        public static int GetLayerProperty(string name)
 81        {
 82            int propertyInt;
 083            if (shaderLayersProperties == null || shaderLayersProperties.Count <= 0)
 84            {
 085                CacheShaderProperties();
 86            }
 87
 088            if (!shaderLayersProperties.ContainsKey(name))
 89            {
 090                propertyInt = Shader.PropertyToID(name);
 091                shaderLayersProperties.Add(name, propertyInt);
 92            }
 93            else
 94            {
 095                propertyInt = shaderLayersProperties[name];
 96            }
 97
 098            return propertyInt;
 99        }
 100
 101    }
 102}