diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-09-23 14:59:06 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-29 06:12:49 +0200 |
commit | 097d2df377b17413fe271ad722b0bf9df4867339 (patch) | |
tree | 960e93f7d978c6ccf55dc082b1d6e28b5fc3f60b /src/declarative/particles/qsgcustomparticle.cpp | |
parent | 0c3c27790cc6cdcfc287d293703a1f19e7a1fc47 (diff) |
Fix QSGCustomParticle initialization
commit was failing because nodes weren't stored yet, which could lead to
an apparent loss of particles.
Change-Id: Ibde6aa75f6c43e2d485c163820e65e0c6ff8e952
Reviewed-on: http://codereview.qt-project.org/5437
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/declarative/particles/qsgcustomparticle.cpp')
-rw-r--r-- | src/declarative/particles/qsgcustomparticle.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/declarative/particles/qsgcustomparticle.cpp b/src/declarative/particles/qsgcustomparticle.cpp index 5d1c605122..707f680db8 100644 --- a/src/declarative/particles/qsgcustomparticle.cpp +++ b/src/declarative/particles/qsgcustomparticle.cpp @@ -480,11 +480,19 @@ QSGShaderEffectNode* QSGCustomParticle::buildCustomNodes() foreach (const QString &str, m_groups){ int gIdx = m_system->m_groupIds[str]; int count = m_system->m_groupData[gIdx]->size(); + + QSGShaderEffectNode* node = new QSGShaderEffectNode(); + m_nodes.insert(gIdx, node); + + node->setMaterial(m_material); + node->markDirty(QSGNode::DirtyMaterial); + //Create Particle Geometry int vCount = count * 4; int iCount = count * 6; QSGGeometry *g = new QSGGeometry(PlainParticle_AttributeSet, vCount, iCount); g->setDrawingMode(GL_TRIANGLES); + node->setGeometry(g); PlainVertex *vertices = (PlainVertex *) g->vertexData(); for (int p=0; p < count; ++p) { commit(gIdx, p); @@ -512,14 +520,6 @@ QSGShaderEffectNode* QSGCustomParticle::buildCustomNodes() indices[5] = o + 2; indices += 6; } - - QSGShaderEffectNode* node = new QSGShaderEffectNode(); - - node->setGeometry(g); - node->setMaterial(m_material); - node->markDirty(QSGNode::DirtyMaterial); - - m_nodes.insert(gIdx, node); } foreach (QSGShaderEffectNode* node, m_nodes){ if (node == *(m_nodes.begin())) |