MaterialsOptimizer.Material.Layer.TrySwapping C# (CSharp) Method

TrySwapping() public method

public TrySwapping ( Texture &_a, Texture &_b, TextureFileInfo _expectedUsageForA, TextureFileInfo _expectedUsageForB, int &_swappedSlotsCount ) : void
_a Texture
_b Texture
_expectedUsageForA TextureFileInfo
_expectedUsageForB TextureFileInfo
_swappedSlotsCount int
return void
            void TrySwapping( ref Texture _a, ref Texture _b, TextureFileInfo.USAGE _expectedUsageForA, TextureFileInfo.USAGE _expectedUsageForB, ref int _swappedSlotsCount )
            {
                if ( _a == null || _a.m_textureFileInfo == null )
                    return;
                if ( _b == null || _b.m_textureFileInfo == null )
                    return;

                if ( _a.m_textureFileInfo.m_usage == _expectedUsageForB && _b.m_textureFileInfo.m_usage == _expectedUsageForA ) {
                    // Switch!
                    Texture	temp = _a;
                    _a = _b;
                    _b = temp;
                    _swappedSlotsCount++;
                }
            }