1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the Declarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #include <private/qsgcontext_p.h>
43 #include <private/qsgadaptationlayer_p.h>
45 #include <qsgtexturematerial.h>
46 #include <qsgtexture.h>
48 #include "qsgimageparticle_p.h"
49 #include "qsgparticleemitter_p.h"
50 #include "qsgsprite_p.h"
51 #include "qsgspriteengine_p.h"
52 #include <QGLFunctions>
53 #include <qsgengine.h>
57 const float CONV = 0.017453292519943295;
58 class UltraMaterial : public QSGMaterial
61 UltraMaterial(bool withSprites=false)
65 , usesSprites(withSprites)
67 setFlag(Blending, true);
78 virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; }
79 virtual QSGMaterialShader *createShader() const;
80 virtual int compare(const QSGMaterial *other) const
82 return this - static_cast<const UltraMaterial *>(other);
86 QSGTexture *colortable;
87 QSGTexture *sizetable;
88 QSGTexture *opacitytable;
95 class UltraMaterialData : public QSGMaterialShader
98 UltraMaterialData(const char *vertexFile = 0, const char *fragmentFile = 0)
100 QFile vf(vertexFile ? vertexFile : ":defaultshaders/ultravertex.shader");
101 vf.open(QFile::ReadOnly);
102 m_vertex_code = vf.readAll();
104 QFile ff(fragmentFile ? fragmentFile : ":defaultshaders/ultrafragment.shader");
105 ff.open(QFile::ReadOnly);
106 m_fragment_code = ff.readAll();
108 Q_ASSERT(!m_vertex_code.isNull());
109 Q_ASSERT(!m_fragment_code.isNull());
113 QSGMaterialShader::deactivate();
115 for (int i=0; i<8; ++i) {
116 program()->setAttributeArray(i, GL_FLOAT, chunkOfBytes, 1, 0);
120 virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *)
122 UltraMaterial *m = static_cast<UltraMaterial *>(newEffect);
123 state.context()->functions()->glActiveTexture(GL_TEXTURE1);
124 m->colortable->bind();
125 program()->setUniformValue(m_colortable_id, 1);
127 state.context()->functions()->glActiveTexture(GL_TEXTURE2);
128 m->sizetable->bind();
129 program()->setUniformValue(m_sizetable_id, 2);
131 state.context()->functions()->glActiveTexture(GL_TEXTURE3);
132 m->opacitytable->bind();
133 program()->setUniformValue(m_opacitytable_id, 3);
135 state.context()->functions()->glActiveTexture(GL_TEXTURE0);//Investigate why this screws up Text{} if placed before 1
138 program()->setUniformValue(m_opacity_id, state.opacity());
139 program()->setUniformValue(m_timestamp_id, (float) m->timestamp);
140 program()->setUniformValue(m_framecount_id, (float) m->framecount);
141 program()->setUniformValue(m_animcount_id, (float) m->animcount);
143 if (state.isMatrixDirty())
144 program()->setUniformValue(m_matrix_id, state.combinedMatrix());
147 virtual void initialize() {
148 m_colortable_id = program()->uniformLocation("colortable");
149 m_sizetable_id = program()->uniformLocation("sizetable");
150 m_opacitytable_id = program()->uniformLocation("opacitytable");
151 m_matrix_id = program()->uniformLocation("matrix");
152 m_opacity_id = program()->uniformLocation("opacity");
153 m_timestamp_id = program()->uniformLocation("timestamp");
154 m_framecount_id = program()->uniformLocation("framecount");
155 m_animcount_id = program()->uniformLocation("animcount");
158 virtual const char *vertexShader() const { return m_vertex_code.constData(); }
159 virtual const char *fragmentShader() const { return m_fragment_code.constData(); }
161 virtual char const *const *attributeNames() const {
162 static const char *attr[] = {
176 virtual bool isColorTable() const { return false; }
183 int m_opacitytable_id;
187 QByteArray m_vertex_code;
188 QByteArray m_fragment_code;
190 static float chunkOfBytes[1024];
192 float UltraMaterialData::chunkOfBytes[1024];
194 QSGMaterialShader *UltraMaterial::createShader() const
196 if (usesSprites)//TODO: Perhaps just swap the shaders, and don't mind the extra vector?
197 return new UltraMaterialData;
199 return new UltraMaterialData;
203 class SimpleMaterial : public UltraMaterial
205 virtual QSGMaterialShader *createShader() const;
206 virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; }
209 class SimpleMaterialData : public QSGMaterialShader
212 SimpleMaterialData(const char *vertexFile = 0, const char *fragmentFile = 0)
214 QFile vf(vertexFile ? vertexFile : ":defaultshaders/simplevertex.shader");
215 vf.open(QFile::ReadOnly);
216 m_vertex_code = vf.readAll();
218 QFile ff(fragmentFile ? fragmentFile : ":defaultshaders/simplefragment.shader");
219 ff.open(QFile::ReadOnly);
220 m_fragment_code = ff.readAll();
222 Q_ASSERT(!m_vertex_code.isNull());
223 Q_ASSERT(!m_fragment_code.isNull());
227 QSGMaterialShader::deactivate();
229 for (int i=0; i<8; ++i) {
230 program()->setAttributeArray(i, GL_FLOAT, chunkOfBytes, 1, 0);
234 virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *)
236 UltraMaterial *m = static_cast<UltraMaterial *>(newEffect);
237 state.context()->functions()->glActiveTexture(GL_TEXTURE0);
240 program()->setUniformValue(m_opacity_id, state.opacity());
241 program()->setUniformValue(m_timestamp_id, (float) m->timestamp);
243 if (state.isMatrixDirty())
244 program()->setUniformValue(m_matrix_id, state.combinedMatrix());
247 virtual void initialize() {
248 m_matrix_id = program()->uniformLocation("matrix");
249 m_opacity_id = program()->uniformLocation("opacity");
250 m_timestamp_id = program()->uniformLocation("timestamp");
253 virtual const char *vertexShader() const { return m_vertex_code.constData(); }
254 virtual const char *fragmentShader() const { return m_fragment_code.constData(); }
256 virtual char const *const *attributeNames() const {
257 static const char *attr[] = {
267 virtual bool isColorTable() const { return false; }
273 QByteArray m_vertex_code;
274 QByteArray m_fragment_code;
276 static float chunkOfBytes[1024];
278 float SimpleMaterialData::chunkOfBytes[1024];
280 QSGMaterialShader *SimpleMaterial::createShader() const {
281 return new SimpleMaterialData;
284 QSGImageParticle::QSGImageParticle(QSGItem* parent)
285 : QSGParticlePainter(parent)
287 , m_color_variation(0.0)
290 , m_alphaVariation(0.0)
292 , m_redVariation(0.0)
293 , m_greenVariation(0.0)
294 , m_blueVariation(0.0)
296 , m_autoRotation(false)
299 , m_rotationVariation(0)
301 , m_rotationSpeedVariation(0)
305 , m_lastLevel(Unknown)
307 setFlag(ItemHasContents);
310 QDeclarativeListProperty<QSGSprite> QSGImageParticle::sprites()
312 return QDeclarativeListProperty<QSGSprite>(this, &m_sprites, spriteAppend, spriteCount, spriteAt, spriteClear);
315 void QSGImageParticle::setImage(const QUrl &image)
317 if (image == m_image_name)
319 m_image_name = image;
325 void QSGImageParticle::setColortable(const QUrl &table)
327 if (table == m_colortable_name)
329 m_colortable_name = table;
330 emit colortableChanged();
334 void QSGImageParticle::setSizetable(const QUrl &table)
336 if (table == m_sizetable_name)
338 m_sizetable_name = table;
339 emit sizetableChanged();
343 void QSGImageParticle::setOpacitytable(const QUrl &table)
345 if (table == m_opacitytable_name)
347 m_opacitytable_name = table;
348 emit opacitytableChanged();
352 void QSGImageParticle::setColor(const QColor &color)
354 if (color == m_color)
358 if (perfLevel < Colored)
362 void QSGImageParticle::setColorVariation(qreal var)
364 if (var == m_color_variation)
366 m_color_variation = var;
367 emit colorVariationChanged();
368 if (perfLevel < Colored)
372 void QSGImageParticle::setAlphaVariation(qreal arg)
374 if (m_alphaVariation != arg) {
375 m_alphaVariation = arg;
376 emit alphaVariationChanged(arg);
378 if (perfLevel < Colored)
382 void QSGImageParticle::setAlpha(qreal arg)
384 if (m_alpha != arg) {
386 emit alphaChanged(arg);
388 if (perfLevel < Colored)
392 void QSGImageParticle::setRedVariation(qreal arg)
394 if (m_redVariation != arg) {
395 m_redVariation = arg;
396 emit redVariationChanged(arg);
398 if (perfLevel < Colored)
402 void QSGImageParticle::setGreenVariation(qreal arg)
404 if (m_greenVariation != arg) {
405 m_greenVariation = arg;
406 emit greenVariationChanged(arg);
408 if (perfLevel < Colored)
412 void QSGImageParticle::setBlueVariation(qreal arg)
414 if (m_blueVariation != arg) {
415 m_blueVariation = arg;
416 emit blueVariationChanged(arg);
418 if (perfLevel < Colored)
422 void QSGImageParticle::setRotation(qreal arg)
424 if (m_rotation != arg) {
426 emit rotationChanged(arg);
428 if (perfLevel < Deformable)
432 void QSGImageParticle::setRotationVariation(qreal arg)
434 if (m_rotationVariation != arg) {
435 m_rotationVariation = arg;
436 emit rotationVariationChanged(arg);
438 if (perfLevel < Deformable)
442 void QSGImageParticle::setRotationSpeed(qreal arg)
444 if (m_rotationSpeed != arg) {
445 m_rotationSpeed = arg;
446 emit rotationSpeedChanged(arg);
448 if (perfLevel < Deformable)
452 void QSGImageParticle::setRotationSpeedVariation(qreal arg)
454 if (m_rotationSpeedVariation != arg) {
455 m_rotationSpeedVariation = arg;
456 emit rotationSpeedVariationChanged(arg);
458 if (perfLevel < Deformable)
462 void QSGImageParticle::setAutoRotation(bool arg)
464 if (m_autoRotation != arg) {
465 m_autoRotation = arg;
466 emit autoRotationChanged(arg);
468 if (perfLevel < Deformable)
472 void QSGImageParticle::setXVector(QSGStochasticDirection* arg)
474 if (m_xVector != arg) {
476 emit xVectorChanged(arg);
478 if (perfLevel < Deformable)
482 void QSGImageParticle::setYVector(QSGStochasticDirection* arg)
484 if (m_yVector != arg) {
486 emit yVectorChanged(arg);
488 if (perfLevel < Deformable)
492 void QSGImageParticle::setBloat(bool arg)
494 if (m_bloat != arg) {
496 emit bloatChanged(arg);
498 if (perfLevel < 9999)
502 void QSGImageParticle::reset()
504 QSGParticlePainter::reset();
505 m_pleaseReset = true;
509 void QSGImageParticle::createEngine()
512 delete m_spriteEngine;
513 if (m_sprites.count())
514 m_spriteEngine = new QSGSpriteEngine(m_sprites, this);
520 static QSGGeometry::Attribute SimpleParticle_Attributes[] = {
521 { 0, 2, GL_FLOAT }, // Position
522 { 1, 2, GL_FLOAT }, // TexCoord
523 { 2, 4, GL_FLOAT }, // Data
524 { 3, 4, GL_FLOAT } // Vectors
527 static QSGGeometry::AttributeSet SimpleParticle_AttributeSet =
529 4, // Attribute Count
530 (2 + 2 + 4 + 4 ) * sizeof(float),
531 SimpleParticle_Attributes
534 static QSGGeometry::Attribute UltraParticle_Attributes[] = {
535 { 0, 2, GL_FLOAT }, // Position
536 { 1, 2, GL_FLOAT }, // TexCoord
537 { 2, 4, GL_FLOAT }, // Data
538 { 3, 4, GL_FLOAT }, // Vectors
539 { 4, 4, GL_UNSIGNED_BYTE }, // Colors
540 { 5, 4, GL_FLOAT }, // DeformationVectors
541 { 6, 3, GL_FLOAT }, // Rotation
542 { 7, 4, GL_FLOAT } // Anim Data
545 static QSGGeometry::AttributeSet UltraParticle_AttributeSet =
547 8, // Attribute Count
548 (2 + 2 + 4 + 4 + 4 + 4 + 3) * sizeof(float) + 4 * sizeof(uchar),
549 UltraParticle_Attributes
552 QSGGeometryNode* QSGImageParticle::buildSimpleParticleNodes()
554 perfLevel = Simple;//TODO: Intermediate levels
555 QImage image = QImage(m_image_name.toLocalFile());
556 if (image.isNull()) {
557 printf("UltraParticle: loading image failed... '%s'\n", qPrintable(m_image_name.toLocalFile()));
566 m_material = new SimpleMaterial();
567 m_material->texture = sceneGraphEngine()->createTextureFromImage(image);
568 m_material->texture->setFiltering(QSGTexture::Linear);
569 m_material->framecount = 1;
571 foreach (const QString &str, m_particles){
572 int gIdx = m_system->m_groupIds[str];
573 int count = m_system->m_groupData[gIdx]->size();
575 QSGGeometryNode* node = new QSGGeometryNode();
576 m_nodes.insert(gIdx, node);
577 node->setMaterial(m_material);
579 int vCount = count * 4;
580 int iCount = count * 6;
582 QSGGeometry *g = new QSGGeometry(SimpleParticle_AttributeSet, vCount, iCount);
583 node->setGeometry(g);
584 g->setDrawingMode(GL_TRIANGLES);
586 SimpleVertex *vertices = (SimpleVertex *) g->vertexData();
587 for (int p=0; p < count; ++p){
604 quint16 *indices = g->indexDataAsUShort();
605 for (int i=0; i < count; ++i) {
617 foreach (QSGGeometryNode* node, m_nodes){
618 if (node == *(m_nodes.begin()))
620 (*(m_nodes.begin()))->appendChildNode(node);
623 return *(m_nodes.begin());
626 QSGGeometryNode* QSGImageParticle::buildParticleNodes()
628 if (m_count * 4 > 0xffff) {
629 printf("UltraParticle: Too many particles... \n");//### Why is this here?
636 if (!m_sprites.count() && !m_bloat
637 && m_colortable_name.isEmpty()
638 && m_sizetable_name.isEmpty()
639 && m_opacitytable_name.isEmpty()
641 && !m_rotation && !m_rotationVariation
642 && !m_rotationSpeed && !m_rotationSpeedVariation
643 && !m_alphaVariation && m_alpha == 1.0
644 && !m_redVariation && !m_blueVariation && !m_greenVariation
645 && !m_color.isValid()
647 return buildSimpleParticleNodes();
648 perfLevel = Sprites;//TODO: intermediate levels
649 if (!m_color.isValid())//But we're in colored level (or higher)
650 m_color = QColor(Qt::white);
653 if (m_sprites.count()){
654 if (!m_spriteEngine) {
655 qWarning() << "UltraParticle: No sprite engine...";
658 image = m_spriteEngine->assembledImage();
659 if (image.isNull())//Warning is printed in engine
662 image = QImage(m_image_name.toLocalFile());
663 if (image.isNull()) {
664 printf("UltraParticle: loading image failed... '%s'\n", qPrintable(m_image_name.toLocalFile()));
674 QImage colortable(m_colortable_name.toLocalFile());
675 QImage sizetable(m_sizetable_name.toLocalFile());
676 QImage opacitytable(m_opacitytable_name.toLocalFile());
677 m_material = new UltraMaterial();
678 if (colortable.isNull())
679 colortable = QImage(":defaultshaders/identitytable.png");
680 if (sizetable.isNull())
681 sizetable = QImage(":defaultshaders/identitytable.png");
682 if (opacitytable.isNull())
683 opacitytable = QImage(":defaultshaders/defaultFadeInOut.png");
684 Q_ASSERT(!colortable.isNull());
685 Q_ASSERT(!sizetable.isNull());
686 Q_ASSERT(!opacitytable.isNull());
687 m_material->colortable = sceneGraphEngine()->createTextureFromImage(colortable);
688 m_material->sizetable = sceneGraphEngine()->createTextureFromImage(sizetable);
689 m_material->opacitytable = sceneGraphEngine()->createTextureFromImage(opacitytable);
691 m_material->texture = sceneGraphEngine()->createTextureFromImage(image);
692 m_material->texture->setFiltering(QSGTexture::Linear);
694 m_material->framecount = 1;
696 m_material->framecount = m_spriteEngine->maxFrames();
697 m_spriteEngine->setCount(m_count);
700 foreach (const QString &str, m_particles){
701 int gIdx = m_system->m_groupIds[str];
702 int count = m_system->m_groupData[gIdx]->size();
703 QSGGeometryNode* node = new QSGGeometryNode();
704 node->setMaterial(m_material);
706 m_nodes.insert(gIdx, node);
707 m_idxStarts.insert(gIdx, m_lastIdxStart);
708 m_lastIdxStart += count;
710 //Create Particle Geometry
711 int vCount = count * 4;
712 int iCount = count * 6;
714 QSGGeometry *g = new QSGGeometry(UltraParticle_AttributeSet, vCount, iCount);
715 node->setGeometry(g);
716 g->setDrawingMode(GL_TRIANGLES);
718 UltraVertex *vertices = (UltraVertex *) g->vertexData();
719 for (int p=0; p < count; ++p) {
720 commit(gIdx, p);//commit sets geometry for the node
737 quint16 *indices = g->indexDataAsUShort();
738 for (int i=0; i < count; ++i) {
751 foreach (QSGGeometryNode* node, m_nodes){
752 if (node == *(m_nodes.begin()))
754 (*(m_nodes.begin()))->appendChildNode(node);
757 return *(m_nodes.begin());
760 QSGNode *QSGImageParticle::updatePaintNode(QSGNode *, UpdatePaintNodeData *)
763 m_lastLevel = perfLevel;
765 delete m_rootNode;//Automatically deletes children
776 m_pleaseReset = false;
779 if (m_system && m_system->isRunning())
783 //### Should I be using dirty geometry too/instead?
784 foreach (QSGGeometryNode* node, m_nodes)
785 node->markDirty(QSGNode::DirtyMaterial);
791 void QSGImageParticle::prepareNextFrame()
793 if (m_rootNode == 0){//TODO: Staggered loading (as emitted)
794 m_rootNode = buildParticleNodes();
797 //qDebug() << "Feature level: " << perfLevel;
799 qint64 timeStamp = m_system->systemSync(this);
801 qreal time = timeStamp / 1000.;
802 m_material->timestamp = time;
805 if (m_spriteEngine){//perfLevel == Sprites?//TODO: use signals?
807 m_material->animcount = m_spriteEngine->spriteCount();
808 m_spriteEngine->updateSprites(timeStamp);
809 foreach (const QString &str, m_particles){
810 int gIdx = m_system->m_groupIds[str];
811 int count = m_system->m_groupData[gIdx]->size();
813 UltraVertices *particles = (UltraVertices *) m_nodes[gIdx]->geometry()->vertexData();
814 for (int i=0; i < count; i++){
815 int spriteIdx = m_idxStarts[gIdx] + i;
816 UltraVertices &p = particles[i];
817 int curIdx = m_spriteEngine->spriteState(spriteIdx);
818 if (curIdx != p.v1.animIdx){
819 p.v1.animIdx = p.v2.animIdx = p.v3.animIdx = p.v4.animIdx = curIdx;
820 p.v1.animT = p.v2.animT = p.v3.animT = p.v4.animT = m_spriteEngine->spriteStart(spriteIdx)/1000.0;
821 p.v1.frameCount = p.v2.frameCount = p.v3.frameCount = p.v4.frameCount = m_spriteEngine->spriteFrames(spriteIdx);
822 p.v1.frameDuration = p.v2.frameDuration = p.v3.frameDuration = p.v4.frameDuration = m_spriteEngine->spriteDuration(spriteIdx);
827 m_material->animcount = 1;
831 void QSGImageParticle::reloadColor(const Color4ub &c, QSGParticleData* d)
834 //TODO: get index for reload - or make function take an index
837 void QSGImageParticle::initialize(int gIdx, int pIdx)
840 QSGParticleData* datum = m_system->m_groupData[gIdx]->data[pIdx];
841 qreal redVariation = m_color_variation + m_redVariation;
842 qreal greenVariation = m_color_variation + m_greenVariation;
843 qreal blueVariation = m_color_variation + m_blueVariation;
844 int spriteIdx = m_idxStarts[gIdx] + datum->index;
845 switch (perfLevel){//Fall-through is intended on all of them
847 // Initial Sprite State
848 datum->animT = datum->t;
851 m_spriteEngine->startSprite(spriteIdx);
852 datum->frameCount = m_spriteEngine->spriteFrames(spriteIdx);
853 datum->frameDuration = m_spriteEngine->spriteDuration(spriteIdx);
855 datum->frameCount = 1;
856 datum->frameDuration = 9999;
862 const QPointF &ret = m_xVector->sample(QPointF(datum->x, datum->y));
867 const QPointF &ret = m_yVector->sample(QPointF(datum->x, datum->y));
872 (m_rotation + (m_rotationVariation - 2*((qreal)rand()/RAND_MAX)*m_rotationVariation) ) * CONV;
873 datum->rotationSpeed =
874 (m_rotationSpeed + (m_rotationSpeedVariation - 2*((qreal)rand()/RAND_MAX)*m_rotationSpeedVariation) ) * CONV;
875 datum->autoRotate = m_autoRotation?1.0:0.0;
877 //Color initialization
879 color.r = m_color.red() * (1 - redVariation) + rand() % 256 * redVariation;
880 color.g = m_color.green() * (1 - greenVariation) + rand() % 256 * greenVariation;
881 color.b = m_color.blue() * (1 - blueVariation) + rand() % 256 * blueVariation;
882 color.a = m_alpha * m_color.alpha() * (1 - m_alphaVariation) + rand() % 256 * m_alphaVariation;
883 datum->color = color;
889 void QSGImageParticle::commit(int gIdx, int pIdx)
893 QSGGeometryNode *node = m_nodes[gIdx];
896 QSGParticleData* datum = m_system->m_groupData[gIdx]->data[pIdx];
898 node->setFlag(QSGNode::OwnsGeometry, false);
899 UltraVertex *ultraVertices = (UltraVertex *) node->geometry()->vertexData();
900 SimpleVertex *simpleVertices = (SimpleVertex *) node->geometry()->vertexData();
903 ultraVertices += pIdx*4;
904 for (int i=0; i<4; i++){
905 ultraVertices[i].x = datum->x - m_systemOffset.x();
906 ultraVertices[i].y = datum->y - m_systemOffset.y();
907 ultraVertices[i].t = datum->t;
908 ultraVertices[i].lifeSpan = datum->lifeSpan;
909 ultraVertices[i].size = datum->size;
910 ultraVertices[i].endSize = datum->endSize;
911 ultraVertices[i].sx = datum->sx;
912 ultraVertices[i].sy = datum->sy;
913 ultraVertices[i].ax = datum->ax;
914 ultraVertices[i].ay = datum->ay;
915 ultraVertices[i].xx = datum->xx;
916 ultraVertices[i].xy = datum->xy;
917 ultraVertices[i].yx = datum->yx;
918 ultraVertices[i].yy = datum->yy;
919 ultraVertices[i].rotation = datum->rotation;
920 ultraVertices[i].rotationSpeed = datum->rotationSpeed;
921 ultraVertices[i].autoRotate = datum->autoRotate;
922 ultraVertices[i].animIdx = datum->animIdx;
923 ultraVertices[i].frameDuration = datum->frameDuration;
924 ultraVertices[i].frameCount = datum->frameCount;
925 ultraVertices[i].animT = datum->animT;
926 ultraVertices[i].color.r = datum->color.r;
927 ultraVertices[i].color.g = datum->color.g;
928 ultraVertices[i].color.b = datum->color.b;
929 ultraVertices[i].color.a = datum->color.a;
932 case Tabled://TODO: Us
936 simpleVertices += pIdx*4;
937 for (int i=0; i<4; i++){
938 simpleVertices[i].x = datum->x - m_systemOffset.x();
939 simpleVertices[i].y = datum->y - m_systemOffset.y();
940 simpleVertices[i].t = datum->t;
941 simpleVertices[i].lifeSpan = datum->lifeSpan;
942 simpleVertices[i].size = datum->size;
943 simpleVertices[i].endSize = datum->endSize;
944 simpleVertices[i].sx = datum->sx;
945 simpleVertices[i].sy = datum->sy;
946 simpleVertices[i].ax = datum->ax;
947 simpleVertices[i].ay = datum->ay;
954 node->setFlag(QSGNode::OwnsGeometry, true);