aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickspriteengine_p.h
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2012-01-13 13:54:29 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-23 07:38:34 +0100
commit379e388568f5d5408b4be13ce6a1faba0b74be6b (patch)
tree55d6684817c566dad5939ff5e8ad652215fef7a2 /src/quick/items/qquickspriteengine_p.h
parent69920f4ddeaa5dbdee555e0a607fd21eb42e2bbc (diff)
Per-frame Sprites patch one
To allow for sprites to be advanced by the rendering framerate, two minor redesigns were needed. A) Sprite texture location is now calculated on the CPU and passed to the GPU per frame. B) Stochastic State engine now supports states that do not advance on a timer, and states can be advanced manually. This patch implements B and A for ImageParticle. A for SpriteImage will be done in a separate patch. Task-number: QTBUG-22236 Change-Id: If1c54a6a03fa48b95bb1e672283292859656457b Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'src/quick/items/qquickspriteengine_p.h')
-rw-r--r--src/quick/items/qquickspriteengine_p.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/quick/items/qquickspriteengine_p.h b/src/quick/items/qquickspriteengine_p.h
index 050e0c284e..926bb68435 100644
--- a/src/quick/items/qquickspriteengine_p.h
+++ b/src/quick/items/qquickspriteengine_p.h
@@ -102,9 +102,9 @@ public:
int variedDuration() const
{
- return m_duration
+ return qMax(qreal(0.0) , m_duration
+ (m_durationVariance * ((qreal)qrand()/RAND_MAX) * 2)
- - m_durationVariance;
+ - m_durationVariance);
}
int frames() const
@@ -212,6 +212,7 @@ public:
void setGoal(int state, int sprite=0, bool jump=false);
void start(int index=0, int state=0);
+ void advance(int index=0);//Sends state to the next chosen state, unlike goal.
void stop(int index=0);
int curState(int index=0) {return m_things[index];}
@@ -246,6 +247,7 @@ protected:
friend class QQuickParticleSystem;
void restart(int index);
void addToUpdateList(uint t, int idx);
+ int nextState(int curState, int idx=0);
int goalSeek(int curState, int idx, int dist=-1);
QList<QQuickStochasticState*> m_states;
//### Consider struct or class for the four data variables?