58 :(
Entity *)entity
size:(float)
size andSettings:(NSDictionary *)settings
59{
60 unsigned i;
64
65 if (settings ==
nil) {
66 _settings = [[NSDictionary dictionary] retain];
67 } else {
68 _settings = [settings retain];
69 }
70
71 unsigned count = [_settings oo_unsignedIntForKey:kExplosionCount defaultValue:25];
72 if (
count > maxCount) {
74 }
75
77 size = [entity
collisionRadius]*[_settings oo_floatForKey:kExplosionSize defaultValue:kExplosionDefaultSize];
78 }
79
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];
85
86 GLfloat spread = [_settings oo_floatForKey:kExplosionSpread defaultValue:1.0];
87
88 NSString *textureFile = [_settings oo_stringForKey:kExplosionTexture defaultValue:@"oolite-particle-cloud2.png"];
89
92 options:kOOTextureMinFilterMipMap | kOOTextureMagFilterLinear | kOOTextureAlphaMask
96 {
97 [self release];
99 }
100
101 GLfloat
baseColor[4] = {1.0,1.0,1.0,1.0};
102
103 if (magnitude2(vel) > 1000000)
104 {
105
106 vel = vector_multiply_scalar(vector_normal(vel),1000);
107 }
108
110 {
111 NSString *color_order = [_settings oo_stringForKey:kExplosionColors defaultValue:@"rgb"];
112
113 for (i=0;i<
count;i++)
114 {
115 if ([color_order isEqualToString:@"white"]) {
116
117 _particleColor[i][0] = _particleColor[i][1] = _particleColor[i][2] =
randf();
118 } else {
122 if (c2 > c1) {
123 c2 = c1;
124 }
125 if (c3 > c2) {
126 c3 = c2;
127 }
128 if ([color_order isEqualToString:@"rgb"])
129 {
130 _particleColor[i][0] = c1;
131 _particleColor[i][1] = c2;
132 _particleColor[i][2] = c3;
133 }
134 else if ([color_order isEqualToString:@"rbg"])
135 {
136 _particleColor[i][0] = c1;
137 _particleColor[i][1] = c3;
138 _particleColor[i][2] = c2;
139 }
140 else if ([color_order isEqualToString:@"grb"])
141 {
142 _particleColor[i][0] = c2;
143 _particleColor[i][1] = c1;
144 _particleColor[i][2] = c3;
145 }
146 else if ([color_order isEqualToString:@"gbr"])
147 {
148 _particleColor[i][0] = c3;
149 _particleColor[i][1] = c1;
150 _particleColor[i][2] = c2;
151 }
152 else if ([color_order isEqualToString:@"brg"])
153 {
154 _particleColor[i][0] = c2;
155 _particleColor[i][1] = c3;
156 _particleColor[i][2] = c1;
157 }
158 else if ([color_order isEqualToString:@"bgr"])
159 {
160 _particleColor[i][0] = c3;
161 _particleColor[i][1] = c2;
162 _particleColor[i][2] = c1;
163 }
164
165 }
166
167 _particleColor[i][0] *= _brightnessMult;
168 _particleColor[i][1] *= _brightnessMult;
169 _particleColor[i][2] *= _brightnessMult;
170 _particleColor[i][3] = _alpha;
171 }
172 }
173 return self;
174}
GLfloat collisionRadius()
id textureWithName:inFolder:options:anisotropy:lodBias:(NSString *name,[inFolder] NSString *directory,[options] OOTextureFlags options,[anisotropy] GLfloat anisotropy,[lodBias] GLfloat lodBias)