| 309 | } |
| 310 | |
| 311 | void ParticleSystemQuad::updateParticleQuads() |
| 312 | { |
| 313 | if (_particleCount <= 0) |
| 314 | { |
| 315 | return; |
| 316 | } |
| 317 | |
| 318 | Vec2 currentPosition; |
| 319 | if (_positionType == PositionType::FREE) |
| 320 | { |
| 321 | currentPosition = this->convertToWorldSpace(Vec2::ZERO); |
| 322 | } |
| 323 | else if (_positionType == PositionType::RELATIVE) |
| 324 | { |
| 325 | currentPosition = _position; |
| 326 | } |
| 327 | |
| 328 | V3F_C4B_T2F_Quad* startQuad; |
| 329 | Vec2 pos = Vec2::ZERO; |
| 330 | if (_batchNode) |
| 331 | { |
| 332 | V3F_C4B_T2F_Quad* batchQuads = _batchNode->getTextureAtlas()->getQuads(); |
| 333 | startQuad = &(batchQuads[_atlasIndex]); |
| 334 | pos = _position; |
| 335 | } |
| 336 | else |
| 337 | { |
| 338 | startQuad = &(_quads[0]); |
| 339 | } |
| 340 | |
| 341 | if (_positionType == PositionType::FREE) |
| 342 | { |
| 343 | Vec3 p1(currentPosition.x, currentPosition.y, 0); |
| 344 | Mat4 worldToNodeTM = getWorldToNodeTransform(); |
| 345 | worldToNodeTM.transformPoint(&p1); |
| 346 | Vec3 p2; |
| 347 | Vec2 newPos; |
| 348 | float* startX = _particleData.startPosX; |
| 349 | float* startY = _particleData.startPosY; |
| 350 | float* x = _particleData.posx; |
| 351 | float* y = _particleData.posy; |
| 352 | float* s = _particleData.size; |
| 353 | float* r = _particleData.rotation; |
| 354 | float* sr = _particleData.staticRotation; |
| 355 | float* sid = _particleData.scaleInDelta; |
| 356 | float* sil = _particleData.scaleInLength; |
| 357 | V3F_C4B_T2F_Quad* quadStart = startQuad; |
| 358 | if (_isScaleInAllocated) |
| 359 | { |
| 360 | for (int i = 0; i < _particleCount; |
| 361 | ++i, ++startX, ++startY, ++x, ++y, ++quadStart, ++s, ++r, ++sr, ++sid, ++sil) |
| 362 | { |
| 363 | p2.set(*startX, *startY, 0); |
| 364 | worldToNodeTM.transformPoint(&p2); |
| 365 | newPos.set(*x, *y); |
| 366 | p2 = p1 - p2; |
| 367 | newPos.x -= p2.x - pos.x; |
| 368 | newPos.y -= p2.y - pos.y; |
nothing calls this directly
no test coverage detected