Line data Source code
1 0 : /* 2 : 3 : OOParticleSystem.h 4 : 5 : 6 : Oolite 7 : Copyright (C) 2004-2013 Giles C Williams and contributors 8 : 9 : This program is free software; you can redistribute it and/or 10 : modify it under the terms of the GNU General Public License 11 : as published by the Free Software Foundation; either version 2 12 : of the License, or (at your option) any later version. 13 : 14 : This program is distributed in the hope that it will be useful, 15 : but WITHOUT ANY WARRANTY; without even the implied warranty of 16 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 : GNU General Public License for more details. 18 : 19 : You should have received a copy of the GNU General Public License 20 : along with this program; if not, write to the Free Software 21 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 : MA 02110-1301, USA. 23 : 24 : */ 25 : 26 : #import "Entity.h" 27 : 28 : #import "OOTypes.h" 29 : #import "OOMaths.h" 30 : 31 : @class OOTexture, OOColor; 32 : 33 : 34 0 : enum 35 : { 36 : kFragmentBurstMaxParticles = 64, 37 : kBigFragmentBurstMaxParticles = 16 38 : }; 39 : 40 : 41 0 : @interface OOParticleSystem: Entity 42 : { 43 : @protected 44 0 : Vector _particlePosition[kFragmentBurstMaxParticles]; 45 0 : Vector _particleVelocity[kFragmentBurstMaxParticles]; 46 0 : GLfloat _particleColor[kFragmentBurstMaxParticles][4]; 47 0 : GLfloat _particleSize[kFragmentBurstMaxParticles]; 48 0 : unsigned _count; 49 : 50 0 : unsigned _particleType; 51 : 52 0 : OOTimeDelta _timePassed, _duration; 53 0 : double _maxSpeed; 54 : } 55 : 56 : /* Initialize particle effect with particles flying out randomly. 57 : Initiali _particleSize[] is equal to speed. 58 : */ 59 0 : - (id) initWithPosition:(HPVector)position 60 : velocity:(Vector)velocity 61 : count:(unsigned)count 62 : minSpeed:(float)minSpeed 63 : maxSpeed:(float)maxSpeed 64 : duration:(OOTimeDelta)duration 65 : baseColor:(GLfloat[4])baseColor; 66 : 67 0 : - (OOTexture *) texture; 68 : 69 : @end 70 : 71 : 72 0 : @interface OOSmallFragmentBurstEntity: OOParticleSystem 73 : 74 0 : + (id) fragmentBurstFromEntity:(Entity *)entity; 75 : 76 : @end 77 : 78 : 79 0 : @interface OOBigFragmentBurstEntity: OOParticleSystem 80 : { 81 : @private 82 0 : GLfloat _baseSize; 83 : } 84 : 85 0 : + (id) fragmentBurstFromEntity:(Entity *)entity; 86 : 87 : @end