Esempio n. 1
0
	void Group::setModel(Model* newmodel)
	{
		if(!newmodel) newmodel = &getDefaultModel();
		if(model == newmodel) return;

		// empty and change model
		empty();

		decrementChildReference(model);
		incrementChildReference(newmodel);
		model = newmodel;

		// recreate data
		delete[] particleData;
		delete[] particleCurrentParams;
		delete[] particleExtendedParams;

		particleData = new Particle::ParticleData[pool.getNbReserved()];
		particleCurrentParams = new float[pool.getNbReserved() * model->getSizeOfParticleCurrentArray()];
		particleExtendedParams = new float[pool.getNbReserved() * model->getSizeOfParticleExtendedArray()];

		pool.clear();

		// Destroys all the buffers
		destroyAllBuffers();
	}
void NormalEmitter::setNormalZone(Zone* zone)
{
	decrementChildReference(normalZone);
	incrementChildReference(zone);

	normalZone = zone;
}
Esempio n. 3
0
void ModifierGroup::clear()
{
    for (std::vector<Modifier*>::iterator it = modifiers.begin(); it != modifiers.end(); ++it)
        decrementChildReference(*it);

    modifiers.clear();
}
Esempio n. 4
0
	void Modifier::setZone(Zone* zone,bool full)
	{
		decrementChildReference(this->zone);
		incrementChildReference(zone);

		this->zone = zone;
		this->full = full;
	}
Esempio n. 5
0
	void Group::removeEmitter(Emitter* emitter)
	{
		std::vector<Emitter*>::iterator it = std::find(emitters.begin(),emitters.end(),emitter);
		if (it != emitters.end())
		{
			decrementChildReference(emitter);
			emitters.erase(it);
		}
	}
Esempio n. 6
0
	void System::removeGroup(Group* group)
	{
		std::vector<Group*>::iterator it = std::find(groups.begin(),groups.end(),group);
		if (it != groups.end())
		{
			decrementChildReference(group);
			groups.erase(it);
		}
	}
Esempio n. 7
0
void Group::removeEmitter(Emitter* emitter)
{
	int FoundIdx = emitters.indexOf(emitter);
	if( FoundIdx != -1 )
	{
		decrementChildReference(emitter);
		emitters.remove(FoundIdx);
	}
}
Esempio n. 8
0
	void Emitter::setZone(Zone* zone,bool full)
	{
		decrementChildReference(this->zone);
		incrementChildReference(zone);

		if (zone == NULL)
			zone = &getDefaultZone();

		this->zone = zone;
		this->full = full;
	}
Esempio n. 9
0
bool ModifierGroup::removeModifier(const Modifier* modifier)
{
    std::vector<Modifier*>::iterator it = std::find<std::vector<Modifier*>::iterator,const Modifier*>(modifiers.begin(),modifiers.end(),modifier);
    if (it != modifiers.end())
    {
        decrementChildReference(*it);
        modifiers.erase(it);
        return true;
    }

    return false;
}
Esempio n. 10
0
	void Group::removeModifier(Modifier* modifier)
	{
		std::vector<Modifier*>::iterator it = std::find(modifiers.begin(),modifiers.end(),modifier);
		if (it != modifiers.end())
		{
			decrementChildReference(modifier);

			if (bufferManagement)
				(*it)->createBuffers(*this);

			modifiers.erase(it);
		}
	}
Esempio n. 11
0
	void Group::setRenderer(Renderer* renderer)
	{
		decrementChildReference(this->renderer);
		incrementChildReference(renderer);

		if ((bufferManagement)&&(renderer != this->renderer))
		{
			if (this->renderer != NULL) this->renderer->destroyBuffers(*this);
			if (renderer != NULL) renderer->createBuffers(*this);
		}

		this->renderer = renderer;
	}
Esempio n. 12
0
void Group::removeModifier(Modifier* modifier)
{
	int FoundIdx = modifiers.indexOf(modifier);
	if( FoundIdx != -1 )
	{
		decrementChildReference(modifier);

		if(bufferManagement)
			modifier->destroyBuffers(*this);

		modifiers.remove(FoundIdx);
	}
}
Esempio n. 13
0
	void ZoneUnion::removeZone(Zone* zone)
	{
		bool found = false;
		for (size_t t = 0; t < Zones.size();)
		{
			if(Zones[t] == zone)
			{
				Zones.erase(Zones.begin()+t);
				found = true;
			}
			else
				t++;
		}
		if(found) decrementChildReference(zone);
	}