public void Add(IRasterizationEntity entity) { // Buffers are added too often and clearing them would result in significant // impact on performance due to GC. Therefore, instead of adding and clearing, // we add and rewrite. // Given that it will be at most few tousands objects added (in extreme case) // this won't pose a problem (e.g. 10k*4B ~ 40 kiB of memory). if (m_currEntiesCnt>= m_entities.Count) m_entities.Add(entity); else m_entities[m_currEntiesCnt] = entity; ++m_currEntiesCnt; }
public void Add(IRasterizationEntity entity) { // Buffers are added too often and clearing them would result in significant // impact on performance due to GC. Therefore, instead of adding and clearing, // we add and rewrite. // Given that it will be at most few tousands objects added (in extreme case) // this won't pose a problem (e.g. 10k*4B ~ 40 kiB of memory). if (m_currEntiesCnt >= m_entities.Count) { m_entities.Add(entity); } else { m_entities[m_currEntiesCnt] = entity; } ++m_currEntiesCnt; }