I'm rendering billboards using map:
<LPDIRECT3DTEXTURE9, vector<DWORD>*> mapTexture;
I'm iterating through the map to render billboards with the same texture so I can draw multiple billboard using the same texture with one draw call.
When the emitter die, I set m_Dead to true in the emitter class, now I want to remove the dead emitters from the particles manager.
So I use:
void ParticleManager::RemoveEmitter(DWORD EMITTER_ID)
{
if (emitters.size() > EMITTER_ID)
{
vector<DWORD> *CurrentIDS = mapTexture[emitters[EMITTER_ID]->texture];
if (CurrentIDS != NULL)
{
CurrentIDS->erase(std::remove(CurrentIDS->begin(), CurrentIDS->end(), EMITTER_ID), CurrentIDS->end());
mapTexture[emitters[EMITTER_ID]->texture] = CurrentIDS;
}
emitters.erase(emitters.begin() + EMITTER_ID);
}
}
I'm getting out of range exception.