mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Make CustomParticle_Render slightly faster
This commit is contained in:
parent
a5c3e296e9
commit
68639f9772
@ -322,9 +322,8 @@ static void CustomParticle_Render(struct CustomParticle* p, float t, VertexP3fT2
|
||||
TextureRec rec = e->rec;
|
||||
int x, y, z;
|
||||
|
||||
float frame_time = p->totalLifespan / e->frameCount;
|
||||
float inverted_lifetime = Math_AbsF(p->base.lifetime - p->totalLifespan);
|
||||
int curFrame = Math_Floor(inverted_lifetime / frame_time);
|
||||
float time_lived = p->totalLifespan - p->base.lifetime;
|
||||
int curFrame = Math_Floor(e->frameCount * (time_lived / p->totalLifespan));
|
||||
float shiftU = curFrame * (rec.U2 - rec.U1);
|
||||
|
||||
rec.U1 += shiftU;// * 0.0078125f;
|
||||
|
@ -26,10 +26,10 @@ struct CustomParticleEffect {
|
||||
cc_bool fullBright;
|
||||
float size;
|
||||
float sizeVariation;
|
||||
float spread; //how far from the spawnpoint their location can vary
|
||||
float speed; //how fast they move away/towards the origin
|
||||
float spread; /* how far from the spawnpoint their location can vary */
|
||||
float speed; /* how fast they move away/towards the origin */
|
||||
float gravity;
|
||||
float baseLifetime; //how long (in seconds) the particle lives for
|
||||
float baseLifetime; /* how long (in seconds) the particle lives for */
|
||||
float lifetimeVariation;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user