public IBorrowedCustomTexture BorrowCustom(string debugName, int width, int height, int samplesCount = 1, int samplesQuality = 0) { MyBorrowedTextureKey key = new MyBorrowedTextureKey { Width = width, Height = height, Format = Format.Unknown, SamplesCount = samplesCount, SamplesQuality = samplesQuality, }; if (!m_dictionaryCustomTextures.ContainsKey(key)) { m_dictionaryCustomTextures.Add(key, new List <MyBorrowedCustomTexture>()); } foreach (var texIt in m_dictionaryCustomTextures[key]) { if (!texIt.IsBorrowed) { texIt.SetBorrowed(debugName, m_currentFrameNum); return(texIt); } } MyBorrowedCustomTexture createdTex = CreateCustom(debugName, key); createdTex.SetBorrowed(debugName, m_currentFrameNum); return(createdTex); }
void DisposeTexture(MyBorrowedCustomTexture custom) { ICustomTexture customTexture = custom.CustomTexture; MyManagers.CustomTextures.DisposeTex(ref customTexture); MyBorrowedTextureKey key = custom.Key; m_dictionaryCustomTextures[key].Remove(custom); m_objectPoolCustom.Deallocate(custom); }