From 2663e5a87603ab9852aa76b59e5ea658389ef8c7 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Mon, 15 Jun 2015 14:43:13 -0700 Subject: [PATCH] correct particle count for systems without textures --- .../src/RenderableParticleEffectEntityItem.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp index 465306c2f0..9f46da4944 100644 --- a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp @@ -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];