MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / CustomParticle_Render

Function CustomParticle_Render

src/Particle.c:449–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449static void CustomParticle_Render(struct CustomParticle* p, float t, struct VertexTextured* vertices) {
450 struct CustomParticleEffect* e = &Particles_CustomEffects[p->effectId];
451 Vec3 pos;
452 Vec2 size;
453 PackedCol col;
454 TextureRec rec = e->rec;
455 int x, y, z;
456
457 float time_lived = p->totalLifespan - p->base.lifetime;
458 int curFrame = Math_Floor(e->frameCount * (time_lived / p->totalLifespan));
459 float shiftU = curFrame * (rec.u2 - rec.u1);
460
461 rec.u1 += shiftU;/* * 0.0078125f; */
462 rec.u2 += shiftU;/* * 0.0078125f; */
463
464 Vec3_Lerp(&pos, &p->base.lastPos, &p->base.nextPos, t);
465 size.x = p->base.size; size.y = size.x;
466
467 x = Math_Floor(pos.x); y = Math_Floor(pos.y); z = Math_Floor(pos.z);
468 col = e->fullBright ? PACKEDCOL_WHITE : Lighting.Color(x, y, z);
469 col = PackedCol_Tint(col, e->tintCol);
470
471 Particle_DoRender(&size, &pos, &rec, col, vertices);
472}
473
474static void Custom_Render(float t) {
475 struct VertexTextured* data;

Callers 1

Custom_RenderFunction · 0.85

Calls 4

Math_FloorFunction · 0.85
Vec3_LerpFunction · 0.85
PackedCol_TintFunction · 0.85
Particle_DoRenderFunction · 0.85

Tested by

no test coverage detected