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

Function Particle_DoRender

src/Particle.c:28–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26typedef cc_bool (*CanPassThroughFunc)(BlockID b);
27
28void Particle_DoRender(const Vec2* size, const Vec3* pos, const TextureRec* rec, PackedCol col, struct VertexTextured* v) {
29 struct Matrix* view;
30 float sX, sY;
31 Vec3 centre;
32 float aX, aY, aZ, bX, bY, bZ;
33
34 sX = size->x * 0.5f; sY = size->y * 0.5f;
35 centre = *pos; centre.y += sY;
36 view = &Gfx.View;
37
38 aX = view->row1.x * sX; aY = view->row2.x * sX; aZ = view->row3.x * sX; /* right * size.x * 0.5f */
39 bX = view->row1.y * sY; bY = view->row2.y * sY; bZ = view->row3.y * sY; /* up * size.y * 0.5f */
40
41 v->x = centre.x - aX - bX; v->y = centre.y - aY - bY; v->z = centre.z - aZ - bZ; v->Col = col; v->U = rec->u1; v->V = rec->v2; v++;
42 v->x = centre.x - aX + bX; v->y = centre.y - aY + bY; v->z = centre.z - aZ + bZ; v->Col = col; v->U = rec->u1; v->V = rec->v1; v++;
43 v->x = centre.x + aX + bX; v->y = centre.y + aY + bY; v->z = centre.z + aZ + bZ; v->Col = col; v->U = rec->u2; v->V = rec->v1; v++;
44 v->x = centre.x + aX - bX; v->y = centre.y + aY - bY; v->z = centre.z + aZ - bZ; v->Col = col; v->U = rec->u2; v->V = rec->v2; v++;
45}
46
47static cc_bool CollidesHor(Vec3* nextPos, BlockID block) {
48 Vec3 horPos = Vec3_Create3((float)Math_Floor(nextPos->x), 0.0f, (float)Math_Floor(nextPos->z));

Callers 4

RainParticle_RenderFunction · 0.85
TerrainParticle_RenderFunction · 0.85
CustomParticle_RenderFunction · 0.85
DrawNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected