137 GLfloat ex_emissive[4];
146 .timeframe = [UNIVERSE getTime],
147 .orientation = shipQrotation,
158 GLfloat flare_factor = fmaxf(
speed,1.0) * ex_emissive[3] * hyper_fade;
160 GLfloat green_factor =
speed * ex_emissive[1] * hyper_fade;
174 HPVector currentPos = ship->
position;
177 vfwd = vector_multiply_scalar(vfwd, spd);
187 GLfloat speedScale = fminf(1.0f,
speed * 5.0f);
190 GLfloat i01 = -0.00f * hyper_fade;
191 GLfloat i03 = -0.12f * exhaust_factor;
192 GLfloat i06 = -0.25f * exhaust_factor;
193 GLfloat i08 = -0.32f * exhaust_factor;
194 GLfloat i10 = -0.40f * exhaust_factor;
195 GLfloat q01 = i01/i10;
196 GLfloat q03 = i03/i10;
197 GLfloat q06 = i06/i10;
198 GLfloat q08 = i08/i10;
199 GLfloat r01 = 1.0f - q01;
200 GLfloat r03 = 1.0f - q03;
201 GLfloat r06 = 1.0f - q06;
202 GLfloat r08 = 1.0f - q08;
204 Vector b01 = make_vector(r01 * i01 * vfwd.x, r01 * i01 * vfwd.y, r01 * i01 * vfwd.z);
206 Vector b03 = make_vector(r03 * i03 * vfwd.x, r03 * i03 * vfwd.y, r03 * i03 * vfwd.z);
208 Vector b06 = make_vector(r06 * i06 * vfwd.x, r06 * i06 * vfwd.y, r06 * i06 * vfwd.z);
210 Vector b08 = make_vector(r08 * i08 * vfwd.x, r08 * i08 * vfwd.y, r08 * i08 * vfwd.z);
222 ex_emissive[1] = green_factor;
223 ex_emissive[0] = red_factor;
224 vertex = HPvector_add(f01.
position, vectorToHPVector(b01));
236 Vector j1 = cross_product(master_i, k1);
237 Vector i1 = vector_multiply_scalar(cross_product(j1, k1),
_exhaustScale.x * speedScale);
238 j1 = vector_multiply_scalar(j1,
_exhaustScale.y * speedScale);
240 for (i = 0; i < 8; i++)
243 vectorToHPVector(vector_add(b01,
244 vector_add(vector_multiply_scalar(i1,s1[i]),
245 vector_multiply_scalar(j1,c1[i])))));
246 length = HPmagnitude(HPvector_subtract(vertex, currentPos));
267 for (i = 0; i < 8; i++)
271 vectorToHPVector(vector_add(b03,
272 vector_add(vector_multiply_scalar(i1,s1[i]),
273 vector_add(vector_multiply_scalar(j1,c1[i]),
274 vector_multiply_scalar(k1,r1))))));
275 length = HPmagnitude(HPvector_subtract(vertex, currentPos));
296 for (i = 0; i < 8; i++)
300 vectorToHPVector(vector_add(b06,
301 vector_add(vector_multiply_scalar(i1,s1[i]),
302 vector_add(vector_multiply_scalar(j1,c1[i]),
303 vector_multiply_scalar(k1,r1))))));
304 length = HPmagnitude(HPvector_subtract(vertex, currentPos));
324 for (i = 0; i < 8; i++)
328 vectorToHPVector(vector_add(b08,
329 vector_add(vector_multiply_scalar(i1,s1[i]),
330 vector_add(vector_multiply_scalar(j1,c1[i]),
331 vector_multiply_scalar(k1,r1))))));
332 length = HPmagnitude(HPvector_subtract(vertex, currentPos));
346 ex_emissive[3] = 0.0;
347 ex_emissive[1] = 0.0;
348 ex_emissive[0] = 0.0;
349 length = HPmagnitude(HPvector_subtract(vertex, currentPos));
383- (void) drawSubEntityImmediate:(
bool)immediate translucent:(
bool)translucent
385 if (!translucent)
return;
388 if ([ship speedFactor] <= 0.001f)
return;
396 HPVector cam = [PLAYER viewpointPosition];
397 for (
unsigned n=0;n<34*3;n++)
413 OOGL(glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT));
415 OOGL(glDisable(GL_LIGHTING));
416 OOGL(glEnable(GL_BLEND));
417 OOGL(glDepthMask(GL_FALSE));
418 OOGL(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
419 OOGL(glEnable(GL_TEXTURE_2D));
423 OOGL(glShadeModel(GL_SMOOTH));
425 OOGL(glEnableClientState(GL_COLOR_ARRAY));
429 double intpart, dphase = 1.0-modf((
double)[
UNIVERSE getTime]*2.5,&intpart);
430 GLfloat phase = (GLfloat)dphase;
432 GLfloat texCoords[68] = {
435 0.1, phase+
pA[1], 0.1, phase+
pA[1],
436 0.1, phase+
pA[1], 0.1, phase+
pA[1],
437 0.9, phase+
pA[1], 0.9, phase+
pA[1],
438 0.9, phase+
pA[1], 0.9, phase+
pA[1],
440 0.1, phase+
pA[2], 0.1, phase+
pA[2],
441 0.1, phase+
pA[2], 0.1, phase+
pA[2],
442 0.9, phase+
pA[2], 0.9, phase+
pA[2],
443 0.9, phase+
pA[2], 0.9, phase+
pA[2],
445 0.1, phase+
pA[3], 0.1, phase+
pA[3],
446 0.1, phase+
pA[3], 0.1, phase+
pA[3],
447 0.9, phase+
pA[3], 0.9, phase+
pA[3],
448 0.9, phase+
pA[3], 0.9, phase+
pA[3],
450 0.1, phase+
pA[4], 0.1, phase+
pA[4],
451 0.1, phase+
pA[4], 0.1, phase+
pA[4],
452 0.9, phase+
pA[4], 0.9, phase+
pA[4],
453 0.9, phase+
pA[4], 0.9, phase+
pA[4],
457 OOGL(glTexCoordPointer(2, GL_FLOAT, 0, texCoords));
462 OOGL(glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT,
afttstr1));
463 OOGL(glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT,
afttstr2));
464 OOGL(glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT,
afttstr3));
465 OOGL(glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT,
afttstr4));
469 OOGL(glDrawElements(GL_TRIANGLE_STRIP, 9, GL_UNSIGNED_INT,
tstr1));
470 OOGL(glDrawElements(GL_TRIANGLE_STRIP, 9, GL_UNSIGNED_INT,
tstr2));
471 OOGL(glDrawElements(GL_TRIANGLE_STRIP, 9, GL_UNSIGNED_INT,
tstr3));
472 OOGL(glDrawElements(GL_TRIANGLE_STRIP, 9, GL_UNSIGNED_INT,
tstr4));
476 GLfloat fanTextures[18] = {
487 OOGL(glTexCoordPointer(2, GL_FLOAT, 0, fanTextures));
489 GLfloat fanColors[36];
495 fanColors[
i++] = 1.0;
501 fanColors[
i++] = 0.5;
503 OOGL(glColorPointer(4, GL_FLOAT, 0, fanColors));
505 OOGL(glDrawElements(GL_TRIANGLE_FAN, 10, GL_UNSIGNED_INT,
tfan1));
507 OOGL(glDisableClientState(GL_TEXTURE_COORD_ARRAY));
508 OOGL(glDisable(GL_TEXTURE_2D));
510 OOGL(glDisableClientState(GL_COLOR_ARRAY));
540- (
Frame) frameAtTime:(
double)t_frame fromFrame:(
Frame) frame_zero
542 if (t_frame >= 0.0)
return frame_zero;
546 int t1 =
PREV(_nextFrame);
547 double moment_in_time = frame_zero.
timeframe + t_frame;
550 if (moment_in_time > _trackTime)
552 frame_one = _track[
t1];
553 period = (moment_in_time - t_frame) - _trackTime;
554 f0 = 1.0 + t_frame/period;
556 else if (moment_in_time < _track[_nextFrame].timeframe)
562 while (moment_in_time < _track[t1].timeframe)
568 frame_zero = _track[
t0];
569 frame_one = _track[
t1];
571 f0 = (moment_in_time - _track[
t1].timeframe)/period;
575 double f1 = 1.0 - f0;
id textureWithName:inFolder:options:anisotropy:lodBias:(NSString *name,[inFolder] NSString *directory,[options] OOTextureFlags options,[anisotropy] GLfloat anisotropy,[lodBias] GLfloat lodBias)