示例#1
0
	void ParticleBatch2D::addParticle(const glm::vec2& position, const glm::vec2& velocity, const ColorRGBA8& color, float width) {
		int particleIndex = findFreeParticle();
		auto& p = m_particles[particleIndex];
		p.lifeTime = 1.0f;
		p.position = position;
		p.velocity = velocity;
		p.color = color;
		p.width = width;
	}
void ParticleBatch2D::addParticle(const glm::vec2& position, const glm::vec2& velocity, const Color4& color, float width)
{
	//Linear search
	int particleIndex = findFreeParticle();

	auto& p = _particles[particleIndex];
	p._life = 1.0f;
	p._position = position;
	p._velocity = velocity;
	p._color = color;
	p._width = width;
}