MCPcopy Create free account
hub / github.com/axmolengine/axmol / updatePosWithParticle

Function updatePosWithParticle

core/2d/ParticleSystemQuad.cpp:265–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265inline void updatePosWithParticle(V3F_C4B_T2F_Quad* quad,
266 const Vec2& newPosition,
267 float size,
268 float scaleInSize,
269 float rotation,
270 float staticRotation)
271{
272 // vertices
273 float size_2 = size / 2;
274 float x1 = -size_2 * scaleInSize;
275 float y1 = -size_2 * scaleInSize;
276
277 float x2 = size_2 * scaleInSize;
278 float y2 = size_2 * scaleInSize;
279 float x = newPosition.x;
280 float y = newPosition.y;
281
282 float r = (float)-AX_DEGREES_TO_RADIANS(rotation + staticRotation);
283 float cr = cosf(r);
284 float sr = sinf(r);
285 float ax = x1 * cr - y1 * sr + x;
286 float ay = x1 * sr + y1 * cr + y;
287 float bx = x2 * cr - y1 * sr + x;
288 float by = x2 * sr + y1 * cr + y;
289 float cx = x2 * cr - y2 * sr + x;
290 float cy = x2 * sr + y2 * cr + y;
291 float dx = x1 * cr - y2 * sr + x;
292 float dy = x1 * sr + y2 * cr + y;
293
294 // bottom-left
295 quad->bl.vertices.x = ax;
296 quad->bl.vertices.y = ay;
297
298 // bottom-right vertex:
299 quad->br.vertices.x = bx;
300 quad->br.vertices.y = by;
301
302 // top-left vertex:
303 quad->tl.vertices.x = dx;
304 quad->tl.vertices.y = dy;
305
306 // top-right vertex:
307 quad->tr.vertices.x = cx;
308 quad->tr.vertices.y = cy;
309}
310
311void ParticleSystemQuad::updateParticleQuads()
312{

Callers 1

updateParticleQuadsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected