< Summary

Class:DCL.Skybox.SkyboxShaderUtils
Assembly:ProceduralSkybox
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/ProceduralSkybox/ToolProceduralSkybox/Scripts/SkyboxShaderUtils.cs
Covered lines:0
Uncovered lines:40
Coverable lines:40
Total lines:78
Line coverage:0% (0 of 40)
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/SkyboxShaderUtils.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5namespace DCL.Skybox
 6{
 7    public static class SkyboxShaderUtils
 8    {
 9        public static Dictionary<string, int> shaderLayersProperties;
 010        public static readonly int LightTint = Shader.PropertyToID("_lightTint");
 011        public static readonly int LightDirection = Shader.PropertyToID("_lightDirection");
 012        public static readonly int SkyColor = Shader.PropertyToID("_skyColor");
 013        public static readonly int GroundColor = Shader.PropertyToID("_groundColor");
 014        public static readonly int HorizonColor = Shader.PropertyToID("_horizonColor");
 015        public static readonly int HorizonHeight = Shader.PropertyToID("_horizonHeight");
 016        public static readonly int HorizonWidth = Shader.PropertyToID("_horizonWidth");
 017        public static readonly int HorizonMask = Shader.PropertyToID("_horizonMask");
 018        public static readonly int HorizonMaskValues = Shader.PropertyToID("_horizonMaskValues");
 019        public static readonly int HorizonPlaneColor = Shader.PropertyToID("_HorizonPlaneColor");
 020        public static readonly int HorizonPlaneHeight = Shader.PropertyToID("_horizonPlaneHeight");
 21
 022        static SkyboxShaderUtils() { CacheShaderProperties(); }
 23
 24        static void CacheShaderProperties()
 25        {
 026            shaderLayersProperties = new Dictionary<string, int>();
 027            for (int i = 0; i < 5; i++)
 28            {
 029                shaderLayersProperties.Add("_layerType_" + i, Shader.PropertyToID("_layerType_" + i));
 030                shaderLayersProperties.Add("_fadeTime_" + i, Shader.PropertyToID("_fadeTime_" + i));
 31
 032                shaderLayersProperties.Add("_RenderDistance_" + i, Shader.PropertyToID("_RenderDistance_" + i));
 033                shaderLayersProperties.Add("_tex_" + i, Shader.PropertyToID("_tex_" + i));
 034                shaderLayersProperties.Add("_cubemap_" + i, Shader.PropertyToID("_cubemap_" + i));
 035                shaderLayersProperties.Add("_normals_" + i, Shader.PropertyToID("_normals_" + i));
 036                shaderLayersProperties.Add("_color_" + i, Shader.PropertyToID("_color_" + i));
 037                shaderLayersProperties.Add("_timeFrame_" + i, Shader.PropertyToID("_timeFrame_" + i));
 038                shaderLayersProperties.Add("_rowAndCollumns_" + i, Shader.PropertyToID("_rowAndCollumns_" + i));
 39
 040                shaderLayersProperties.Add("_lightIntensity_" + i, Shader.PropertyToID("_lightIntensity_" + i));
 041                shaderLayersProperties.Add("_normalIntensity_" + i, Shader.PropertyToID("_normalIntensity_" + i));
 42
 043                shaderLayersProperties.Add("_distortIntAndSize_" + i, Shader.PropertyToID("_distortIntAndSize_" + i));
 044                shaderLayersProperties.Add("_distortSpeedAndSharp_" + i, Shader.PropertyToID("_distortSpeedAndSharp_" + 
 45
 46
 047                shaderLayersProperties.Add("_particlesMainParameters_" + i, Shader.PropertyToID("_particlesMainParameter
 048                shaderLayersProperties.Add("_particlesSecondaryParameters_" + i, Shader.PropertyToID("_particlesSecondar
 49
 050                shaderLayersProperties.Add("_tilingAndOffset_" + i, Shader.PropertyToID("_tilingAndOffset_" + i));
 051                shaderLayersProperties.Add("_speedAndRotation_" + i, Shader.PropertyToID("_speedAndRotation_" + i));
 52            }
 53
 054        }
 55
 56        public static int GetLayerProperty(string name)
 57        {
 58            int propertyInt;
 059            if (shaderLayersProperties == null || shaderLayersProperties.Count <= 0)
 60            {
 061                CacheShaderProperties();
 62            }
 63
 064            if (!shaderLayersProperties.ContainsKey(name))
 65            {
 066                propertyInt = Shader.PropertyToID(name);
 067                shaderLayersProperties.Add(name, propertyInt);
 068            }
 69            else
 70            {
 071                propertyInt = shaderLayersProperties[name];
 72            }
 73
 074            return propertyInt;
 75        }
 76
 77    }
 78}