52@interface OOExplosionCloudEntity (OOPrivate)
53- (id) initExplosionCloudWithEntity:(
Entity *)entity size:(
float)size andSettings:(NSDictionary *)settings;
58- (id) initExplosionCloudWithEntity:(
Entity *)entity size:(
float)size andSettings:(NSDictionary *)settings
65 if (settings ==
nil) {
66 _settings = [[NSDictionary dictionary] retain];
68 _settings = [settings retain];
71 unsigned count = [_settings oo_unsignedIntForKey:kExplosionCount defaultValue:25];
72 if (
count > maxCount) {
77 size = [entity
collisionRadius]*[_settings oo_floatForKey:kExplosionSize defaultValue:kExplosionDefaultSize];
80 _growthRate = [_settings oo_floatForKey:kExplosionGrowth defaultValue:kGrowthRateFactor] *
size;
81 _alpha = [_settings oo_floatForKey:kExplosionAlpha defaultValue:kExplosionCloudAlpha];
82 _brightnessMult = [_settings oo_floatForKey:kExplosionBrightness defaultValue:kExplosionBrightnessMult];
83 if (_brightnessMult < 1.0f) _brightnessMult = 1.0f;
84 _cloudDuration = [_settings oo_doubleForKey:kExplosionDuration defaultValue:kExplosionCloudDuration];
86 GLfloat spread = [_settings oo_floatForKey:kExplosionSpread defaultValue:1.0];
88 NSString *textureFile = [_settings oo_stringForKey:kExplosionTexture defaultValue:@"oolite-particle-cloud2.png"];
92 options:kOOTextureMinFilterMipMap | kOOTextureMagFilterLinear | kOOTextureAlphaMask
101 GLfloat
baseColor[4] = {1.0,1.0,1.0,1.0};
103 if (magnitude2(vel) > 1000000)
106 vel = vector_multiply_scalar(vector_normal(vel),1000);
111 NSString *color_order = [_settings oo_stringForKey:kExplosionColors defaultValue:@"rgb"];
113 for (i=0;i<
count;i++)
115 if ([color_order isEqualToString:
@"white"]) {
117 _particleColor[i][0] = _particleColor[i][1] = _particleColor[i][2] =
randf();
128 if ([color_order isEqualToString:
@"rgb"])
130 _particleColor[i][0] = c1;
131 _particleColor[i][1] = c2;
132 _particleColor[i][2] = c3;
134 else if ([color_order isEqualToString:
@"rbg"])
136 _particleColor[i][0] = c1;
137 _particleColor[i][1] = c3;
138 _particleColor[i][2] = c2;
140 else if ([color_order isEqualToString:
@"grb"])
142 _particleColor[i][0] = c2;
143 _particleColor[i][1] = c1;
144 _particleColor[i][2] = c3;
146 else if ([color_order isEqualToString:
@"gbr"])
148 _particleColor[i][0] = c3;
149 _particleColor[i][1] = c1;
150 _particleColor[i][2] = c2;
152 else if ([color_order isEqualToString:
@"brg"])
154 _particleColor[i][0] = c2;
155 _particleColor[i][1] = c3;
156 _particleColor[i][2] = c1;
158 else if ([color_order isEqualToString:
@"bgr"])
160 _particleColor[i][0] = c3;
161 _particleColor[i][1] = c2;
162 _particleColor[i][2] = c1;
167 _particleColor[i][0] *= _brightnessMult;
168 _particleColor[i][1] *= _brightnessMult;
169 _particleColor[i][2] *= _brightnessMult;
170 _particleColor[i][3] = _alpha;
id textureWithName:inFolder:options:anisotropy:lodBias:(NSString *name,[inFolder] NSString *directory,[options] OOTextureFlags options,[anisotropy] GLfloat anisotropy,[lodBias] GLfloat lodBias)