correct particle count for systems without textures

This commit is contained in:
ericrius1 2015-06-15 14:43:13 -07:00
parent 27c6190665
commit 2663e5a876

View file

@ -75,22 +75,24 @@ void RenderableParticleEffectEntityItem::updateQuads(RenderArgs* args, bool text
vertices.reserve(getLivingParticleCount() * VERTS_PER_PARTICLE);
if (textured) {
positions.reserve(getLivingParticleCount());
textureCoords.reserve(getLivingParticleCount() * VERTS_PER_PARTICLE);
for (quint32 i = _particleHeadIndex; i != _particleTailIndex; i = (i + 1) % _maxParticles) {
positions.append(_particlePositions[i]);
textureCoords.reserve(getLivingParticleCount() * VERTS_PER_PARTICLE);
}
positions.reserve(getLivingParticleCount());
for (quint32 i = _particleHeadIndex; i != _particleTailIndex; i = (i + 1) % _maxParticles) {
positions.append(_particlePositions[i]);
if (textured) {
textureCoords.append(glm::vec2(0, 1));
textureCoords.append(glm::vec2(1, 1));
textureCoords.append(glm::vec2(1, 0));
textureCoords.append(glm::vec2(0, 0));
}
}
// sort particles back to front
::zSortAxis = args->_viewFrustum->getDirection();
qSort(positions.begin(), positions.end(), zSort);
}
for (int i = 0; i < positions.size(); i++) {
glm::vec3 pos = (textured) ? positions[i] : _particlePositions[i];