| 539 | } |
| 540 | |
| 541 | template <typename T> T* b2ParticleSystem::RequestBuffer(T* buffer) |
| 542 | { |
| 543 | if (!buffer) |
| 544 | { |
| 545 | if (m_internalAllocatedCapacity == 0) |
| 546 | { |
| 547 | ReallocateInternalAllocatedBuffers( |
| 548 | b2_minParticleSystemBufferCapacity); |
| 549 | } |
| 550 | buffer = (T*) (m_world->m_blockAllocator.Allocate( |
| 551 | sizeof(T) * m_internalAllocatedCapacity)); |
| 552 | b2Assert(buffer); |
| 553 | memset(buffer, 0, sizeof(T) * m_internalAllocatedCapacity); |
| 554 | } |
| 555 | return buffer; |
| 556 | } |
| 557 | |
| 558 | b2ParticleColor* b2ParticleSystem::GetColorBuffer() |
| 559 | { |