Пример #1
0
            public int CompareTo(BatchKey other)
            {
                if (Object.ReferenceEquals(other, null))
                {
                    return(1);
                }

                // Draw transparent objects later.
                if (_transparency && !other._transparency)
                {
                    return(1);
                }
                if (!_transparency && other._transparency)
                {
                    return(-1);
                }

                if (_shader != other._shader)
                {
                    return(_shader.GetType().Name.CompareTo(other._shader.GetType().Name));
                }

                if (_texture != other._texture)
                {
                    if (_texture == null && other._texture != null)
                    {
                        return(1);
                    }
                    if (_texture != null && other._texture == null)
                    {
                        return(-1);
                    }

                    return(_texture.Index.CompareTo(other._texture.Index));
                }

                if (_index == -1 || other._index == -1)
                {
                    return(0);
                }

                return(_index.CompareTo(other._index));
            }