mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -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;
|
TextureRec rec = e->rec;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
|
|
||||||
float frame_time = p->totalLifespan / e->frameCount;
|
float time_lived = p->totalLifespan - p->base.lifetime;
|
||||||
float inverted_lifetime = Math_AbsF(p->base.lifetime - p->totalLifespan);
|
int curFrame = Math_Floor(e->frameCount * (time_lived / p->totalLifespan));
|
||||||
int curFrame = Math_Floor(inverted_lifetime / frame_time);
|
|
||||||
float shiftU = curFrame * (rec.U2 - rec.U1);
|
float shiftU = curFrame * (rec.U2 - rec.U1);
|
||||||
|
|
||||||
rec.U1 += shiftU;// * 0.0078125f;
|
rec.U1 += shiftU;// * 0.0078125f;
|
||||||
|
@ -26,10 +26,10 @@ struct CustomParticleEffect {
|
|||||||
cc_bool fullBright;
|
cc_bool fullBright;
|
||||||
float size;
|
float size;
|
||||||
float sizeVariation;
|
float sizeVariation;
|
||||||
float spread; //how far from the spawnpoint their location can vary
|
float spread; /* how far from the spawnpoint their location can vary */
|
||||||
float speed; //how fast they move away/towards the origin
|
float speed; /* how fast they move away/towards the origin */
|
||||||
float gravity;
|
float gravity;
|
||||||
float baseLifetime; //how long (in seconds) the particle lives for
|
float baseLifetime; /* how long (in seconds) the particle lives for */
|
||||||
float lifetimeVariation;
|
float lifetimeVariation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user