< Summary

Class:MaterialModel
Assembly:DCL.Components.MaterialModel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Materials/Data/MaterialModel.cs
Covered lines:35
Uncovered lines:2
Coverable lines:37
Total lines:83
Line coverage:94.5% (35 of 37)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
MaterialModel()0%110100%
GetHashCode()0%990100%
Equals(...)0%16160100%
Equals(...)0%4.374071.43%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Materials/Data/MaterialModel.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using DCL.Helpers;
 5using UnityEngine;
 6
 7[System.Serializable]
 8public class MaterialModel
 9{
 10    public enum TransparencyMode
 11    {
 12        OPAQUE,
 13        ALPHA_TEST,
 14        ALPHA_BLEND,
 15        ALPHA_TEST_AND_BLEND,
 16        AUTO
 17    }
 18
 19    [Range(0f, 1f)]
 1720    public float alphaTest = 0.5f;
 21
 1722    public Color albedoColor = Color.white;
 23
 1724    public float metallic = 0.5f;
 1725    public float roughness = 0.5f;
 1726    public float microSurface = 1f; // Glossiness
 1727    public float specularIntensity = 1f;
 28
 1729    public Color emissiveColor = Color.black;
 1730    public float emissiveIntensity = 2f;
 1731    public Color reflectivityColor = Color.white;
 1732    public float directIntensity = 1f;
 33
 1734    public bool castShadows = true;
 35
 36    [Range(0, 4)]
 1737    public int transparencyMode = 4; // 0: OPAQUE; 1: ALPHATEST; 2: ALPHBLEND; 3: ALPHATESTANDBLEND; 4: AUTO (Engine dec
 38
 39    public TextureModel albedoTexture;
 40    public TextureModel alphaTexture;
 41    public TextureModel emissiveTexture;
 42    public TextureModel bumpTexture;
 43
 44    public override int GetHashCode()
 45    {
 46        unchecked
 47        {
 21648            int hashCode = alphaTest.GetHashCode();
 21649            hashCode = (hashCode * 397) ^ albedoColor.GetHashCode();
 21650            hashCode = (hashCode * 397) ^ metallic.GetHashCode();
 21651            hashCode = (hashCode * 397) ^ roughness.GetHashCode();
 21652            hashCode = (hashCode * 397) ^ microSurface.GetHashCode();
 21653            hashCode = (hashCode * 397) ^ specularIntensity.GetHashCode();
 21654            hashCode = (hashCode * 397) ^ emissiveColor.GetHashCode();
 21655            hashCode = (hashCode * 397) ^ emissiveIntensity.GetHashCode();
 21656            hashCode = (hashCode * 397) ^ reflectivityColor.GetHashCode();
 21657            hashCode = (hashCode * 397) ^ directIntensity.GetHashCode();
 21658            hashCode = (hashCode * 397) ^ castShadows.GetHashCode();
 21659            hashCode = (hashCode * 397) ^ transparencyMode;
 21660            hashCode = (hashCode * 397) ^ (albedoTexture != null ? albedoTexture.GetHashCode() : 0);
 21661            hashCode = (hashCode * 397) ^ (alphaTexture != null ? alphaTexture.GetHashCode() : 0);
 21662            hashCode = (hashCode * 397) ^ (emissiveTexture != null ? emissiveTexture.GetHashCode() : 0);
 21663            hashCode = (hashCode * 397) ^ (bumpTexture != null ? bumpTexture.GetHashCode() : 0);
 21664            return hashCode;
 65        }
 66    }
 67
 68    protected bool Equals(MaterialModel other)
 69    {
 4470        return alphaTest.Equals(other.alphaTest) && albedoColor.Equals(other.albedoColor) && metallic.Equals(other.metal
 71    }
 72
 73    public override bool Equals(object obj)
 74    {
 11375        if (ReferenceEquals(null, obj))
 076            return false;
 11377        if (ReferenceEquals(this, obj))
 6978            return true;
 4479        if (obj.GetType() != this.GetType())
 080            return false;
 4481        return Equals((MaterialModel) obj);
 82    }
 83}