void CACHEDCONTAINER::SetItem( VERTEXITEM* aItem ) { assert( aItem != nullptr );…
Jump to turn (6)
- 1void CACHEDCONTAINER::SetItem( VERTEXITEM aItem ) { assert( aItem != nullptr );
- 2mchunkSize可能得意思是啥
- 3上述中,调用setItem函数后,再调用FinishItem,itemSize 必定等于mchunkSize吧
- 4/ Set the item for the further actions. @param aItem is the item or NULL in case
- 5/ Set an item to start its modifications. After calling the function it is possi
- 6glCopyBufferSubData 解释下这个函数
- User
void CACHED_CONTAINER::SetItem( VERTEX_ITEM* aItem ) { assert( aItem != nullptr );
codeunsigned int itemSize = aItem->GetSize(); m_item = aItem; m_chunkSize = itemSize; // Get the previously set offset if the item was stored previously m_chunkOffset = itemSize > 0 ? aItem->GetOffset() : -1;}
void CACHED_CONTAINER::FinishItem() { assert( m_item != nullptr );
codeunsigned int itemSize = m_item->GetSize(); // Finishing the previously edited item if( itemSize < m_chunkSize ) { // There is some not used but reserved memory left, so we should return it to the pool int itemOffset = m_item->GetOffset(); // Add the not used memory back to the pool addFreeChunk( itemOffset + itemSize, m_chunkSize - itemSize ); // mergeFreeChunks(); // veery slow and buggy m_maxIndex = std::max( itemOffset + itemSize, m_maxIndex ); } if( itemSize > 0 ) m_items.insert( m_item ); m_item = nullptr; m_chunkSize = 0; m_chunkOffset = 0;