| 670 | } |
| 671 | |
| 672 | bool ParticleSystem::initWithTotalParticles(int numberOfParticles) |
| 673 | { |
| 674 | _totalParticles = numberOfParticles; |
| 675 | |
| 676 | _particleData.release(); |
| 677 | |
| 678 | if (!_particleData.init(_totalParticles)) |
| 679 | { |
| 680 | AXLOGW("Particle system: not enough memory"); |
| 681 | this->release(); |
| 682 | return false; |
| 683 | } |
| 684 | _allocatedParticles = numberOfParticles; |
| 685 | |
| 686 | if (_batchNode) |
| 687 | { |
| 688 | for (int i = 0; i < _totalParticles; i++) |
| 689 | { |
| 690 | _particleData.atlasIndex[i] = i; |
| 691 | } |
| 692 | } |
| 693 | // default, active |
| 694 | _isActive = true; |
| 695 | |
| 696 | // default blend function |
| 697 | _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED; |
| 698 | |
| 699 | // default movement type; |
| 700 | _positionType = PositionType::FREE; |
| 701 | |
| 702 | // by default be in mode A: |
| 703 | _emitterMode = Mode::GRAVITY; |
| 704 | |
| 705 | // default: modulate |
| 706 | // FIXME:: not used |
| 707 | // colorModulate = YES; |
| 708 | |
| 709 | _isAutoRemoveOnFinish = false; |
| 710 | |
| 711 | // Optimization: compile updateParticle method |
| 712 | // updateParticleSel = @selector(updateQuadWithParticle:newPosition:); |
| 713 | // updateParticleImp = (AX_UPDATE_PARTICLE_IMP) [self methodForSelector:updateParticleSel]; |
| 714 | // for batchNode |
| 715 | _transformSystemDirty = false; |
| 716 | |
| 717 | return true; |
| 718 | } |
| 719 | |
| 720 | ParticleSystem::~ParticleSystem() |
| 721 | { |
no test coverage detected