Exemple #1
0
        public static bool AreEqualByContent(ChannelBuilder a, ChannelBuilder b)
        {
            #pragma warning disable IDE0041 // Use 'is null' check
            if (Object.ReferenceEquals(a, b))
            {
                return(true);
            }
            if (Object.ReferenceEquals(a, null))
            {
                return(false);
            }
            if (Object.ReferenceEquals(b, null))
            {
                return(false);
            }
            #pragma warning restore IDE0041 // Use 'is null' check

            if (a._Key != b._Key)
            {
                return(false);
            }

            if (a.Parameter != b.Parameter)
            {
                return(false);
            }

            if (!TextureBuilder.AreEqualByContent(a.Texture, b.Texture))
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        public static bool AreEqual(TextureBuilder a, TextureBuilder b)
        {
            #pragma warning disable IDE0041 // Use 'is null' check
            if (Object.ReferenceEquals(a, b))
            {
                return(true);
            }
            if (Object.ReferenceEquals(a, null))
            {
                return(false);
            }
            if (Object.ReferenceEquals(b, null))
            {
                return(false);
            }
            #pragma warning restore IDE0041 // Use 'is null' check

            if (!Object.ReferenceEquals(a._Parent, b._Parent))
            {
                return(false);
            }

            if (a.CoordinateSet != b.CoordinateSet)
            {
                return(false);
            }

            if (a.MinFilter != b.MinFilter)
            {
                return(false);
            }
            if (a.MagFilter != b.MagFilter)
            {
                return(false);
            }
            if (a.WrapS != b.WrapS)
            {
                return(false);
            }
            if (a.WrapT != b.WrapT)
            {
                return(false);
            }

            if (!_AreArraysContentEqual(a._PrimaryImageContent, b._PrimaryImageContent))
            {
                return(false);
            }
            if (!_AreArraysContentEqual(a._FallbackImageContent, b._FallbackImageContent))
            {
                return(false);
            }

            if (TextureTransformBuilder.AreEqual(a._Transform, b._Transform))
            {
                return(false);
            }

            return(true);
        }
Exemple #3
0
 public TextureBuilder UseTexture()
 {
     if (Texture == null)
     {
         Texture = new TextureBuilder(this);
     }
     return(Texture);
 }
Exemple #4
0
        public static bool AreEqualByContent(TextureBuilder x, TextureBuilder y)
        {
            if (x == null || y == null)
            {
                return(true);
            }

            if ((x, y).AreSameReference(out bool areTheSame))
            {
                return(areTheSame);
            }

            if (!BaseBuilder.AreEqualByContent(x, y))
            {
                return(false);
            }

            if (x.CoordinateSet != y.CoordinateSet)
            {
                return(false);
            }

            if (x.MinFilter != y.MinFilter)
            {
                return(false);
            }
            if (x.MagFilter != y.MagFilter)
            {
                return(false);
            }
            if (x.WrapS != y.WrapS)
            {
                return(false);
            }
            if (x.WrapT != y.WrapT)
            {
                return(false);
            }

            if (!ImageBuilder.AreEqualByContent(x._PrimaryImageContent, y._PrimaryImageContent))
            {
                return(false);
            }
            if (!ImageBuilder.AreEqualByContent(x._FallbackImageContent, y._FallbackImageContent))
            {
                return(false);
            }

            if (!TextureTransformBuilder.AreEqualByContent(x._Transform, y._Transform))
            {
                return(false);
            }

            return(true);
        }
Exemple #5
0
        public static int GetContentHashCode(ChannelBuilder x)
        {
            if (x == null)
            {
                return(0);
            }

            var h = x._Key.GetHashCode();

            h ^= x.Parameter.GetHashCode();

            h ^= TextureBuilder.GetContentHashCode(x.Texture);

            return(h);
        }
Exemple #6
0
        public static int GetContentHashCode(TextureBuilder x)
        {
            if (x == null)
            {
                return(0);
            }

            var h = x.CoordinateSet.GetHashCode();

            h ^= x.MinFilter.GetHashCode();
            h ^= x.MagFilter.GetHashCode();
            h ^= x.WrapS.GetHashCode();
            h ^= x.WrapT.GetHashCode();

            h ^= x._PrimaryImageContent.GetContentHashCode(16);
            h ^= x._FallbackImageContent.GetContentHashCode(16);

            return(h);
        }
Exemple #7
0
        public static bool AreEqualByContent(ChannelBuilder x, ChannelBuilder y)
        {
            if ((x, y).AreSameReference(out bool areTheSame))
            {
                return(areTheSame);
            }

            if (x._Key != y._Key)
            {
                return(false);
            }

            if (!MaterialValue.Collection.AreEqual(x._Parameters, y._Parameters))
            {
                return(false);
            }

            if (!TextureBuilder.AreEqualByContent(x.Texture, y.Texture))
            {
                return(false);
            }

            return(true);
        }
Exemple #8
0
        public static bool AreEqualByContent(ChannelBuilder x, ChannelBuilder y)
        {
            if ((x, y).AreSameReference(out bool areTheSame))
            {
                return(areTheSame);
            }

            if (x._Key != y._Key)
            {
                return(false);
            }

            if (x.Parameter != y.Parameter)
            {
                return(false);
            }

            if (!TextureBuilder.AreEqualByContent(x.Texture, y.Texture))
            {
                return(false);
            }

            return(true);
        }
Exemple #9
0
 public void RemoveTexture()
 {
     Texture = null;
 }