#include <windows.h>#include <math.h>#include <assert.h>#include "genesis.h"#include "ErrorLog.h"#include "Electric.h"#include "..\\Procedurals\\gebmutil.h"Go to the source code of this file.
|
|
Definition at line 375 of file Genesis3d/src/FX/electric.c. Referenced by _Electric_BoltEffectRender(), and Electric_BoltEffectRender(). |
|
|
Definition at line 644 of file Genesis3d/src/FX/electric.c. Referenced by Electric_Frame(). |
|
|
Definition at line 205 of file Genesis3d/src/FX/electric.c. |
|
|
|
|
|
|
|
||||||||||||||||
|
Definition at line 253 of file Genesis3d/src/FX/electric.c. References Electric_BoltEffect::beBaseColors, Electric_BoltEffect::beCenterPoints, Electric_BoltEffect::beCurrentColors, Electric_BoltEffect::beDecayRate, Electric_BoltEffect::beDominantColor, Electric_BoltEffect::beEnd, Electric_BoltEffect::beInitialized, Electric_BoltEffect::beNumPoints, Electric_BoltEffect::beStart, genLightning(), and max. Referenced by Electric_Frame().
00257 {
00258 int dominant;
00259 int nonDominant1;
00260 int nonDominant2;
00261 geVec3d SubdivideStart;
00262 geVec3d SubdivideEnd;
00263 int LowIndex;
00264 int HighIndex;
00265
00266 Effect->beStart = *start;
00267 Effect->beEnd = *end;
00268
00269 dominant = Effect->beDominantColor;
00270 nonDominant1 = (dominant + 1) % 3;
00271 nonDominant2 = (dominant + 2) % 3;
00272 if (Effect->beBaseColors[nonDominant1] == Effect->beCurrentColors[nonDominant1])
00273 {
00274 int DecayRate;
00275 int Spike;
00276
00277 DecayRate = rand() % (int)(Effect->beBaseColors[dominant] - Effect->beBaseColors[nonDominant1]);
00278 DecayRate = max(DecayRate, 5);
00279 Effect->beDecayRate = DecayRate;
00280 if (Effect->beBaseColors[nonDominant1] >= 1.0f)
00281 Spike = rand() % (int)(Effect->beBaseColors[nonDominant1]);
00282 else
00283 Spike = 0;
00284 Effect->beCurrentColors[nonDominant1] -= Spike;
00285 Effect->beCurrentColors[nonDominant2] -= Spike;
00286 }
00287 else
00288 {
00289 Effect->beCurrentColors[nonDominant1] += Effect->beDecayRate;
00290 Effect->beCurrentColors[nonDominant2] += Effect->beDecayRate;
00291 if (Effect->beCurrentColors[nonDominant1] > Effect->beBaseColors[nonDominant1])
00292 {
00293 Effect->beCurrentColors[nonDominant1] = Effect->beBaseColors[nonDominant1];
00294 Effect->beCurrentColors[nonDominant2] = Effect->beBaseColors[nonDominant2];
00295 }
00296 }
00297
00298 if (Effect->beInitialized && Effect->beNumPoints > 16)
00299 {
00300 int P1;
00301 int P2;
00302 int P3;
00303 int P4;
00304
00305 switch (rand() % 7)
00306 {
00307 case 0:
00308 genLightning(Effect, 0, Effect->beNumPoints, start, end);
00309 return;
00310
00311 case 1:
00312 case 2:
00313 case 3:
00314 P1 = 0;
00315 P2 = Effect->beNumPoints / 2;
00316 P3 = P2 + Effect->beNumPoints / 4;
00317 P4 = Effect->beNumPoints;
00318 break;
00319
00320 case 4:
00321 case 5:
00322 case 6:
00323 P1 = 0;
00324 P3 = Effect->beNumPoints / 2;
00325 P2 = P3 - Effect->beNumPoints / 4;
00326 P4 = Effect->beNumPoints;
00327 break;
00328 }
00329 SubdivideStart = Effect->beCenterPoints[P1];
00330 SubdivideEnd = Effect->beCenterPoints[P2];
00331 genLightning(Effect, P1, P2, &SubdivideStart, &SubdivideEnd);
00332 SubdivideStart = Effect->beCenterPoints[P2];
00333 SubdivideEnd = Effect->beCenterPoints[P3];
00334 genLightning(Effect, P2, P3, &SubdivideStart, &SubdivideEnd);
00335 SubdivideStart = Effect->beCenterPoints[P3];
00336 SubdivideEnd = Effect->beCenterPoints[P4];
00337 genLightning(Effect, P3, P4, &SubdivideStart, &SubdivideEnd);
00338 }
00339 else
00340 {
00341 Effect->beInitialized = 1;
00342 LowIndex = 0;
00343 HighIndex = Effect->beNumPoints;
00344 SubdivideStart = *start;
00345 SubdivideEnd = *end;
00346
00347 genLightning(Effect, LowIndex, HighIndex, &SubdivideStart, &SubdivideEnd);
00348 }
00349 }
|
|
||||||||||||||||||||||||
|
Definition at line 108 of file Genesis3d/src/FX/electric.c. References GE_RGBA::b, Electric_BoltEffect::beBitmap, Electric_BoltEffect::beCenterPoints, Electric_BoltEffect::beNumPoints, Electric_BoltEffect::beWidth, Electric_BoltEffect::beWildness, Bitmap, ELECTRIC_BOLT_BLUEDOMINANT, Electric_BoltEffectSetColorInfo(), GE_RGBA::g, logBase2(), NULL, and GE_RGBA::r. Referenced by Electric_SetWorld().
00114 {
00115 Electric_BoltEffect * be;
00116 GE_RGBA color;
00117
00118 assert(Wildness >= 0.0f && Wildness <= 1.0f);
00119
00120 /* Asserts power of 2 */
00121 logBase2(NumPolys);
00122
00123 be = (Electric_BoltEffect *)malloc(sizeof(*be));
00124 if (!be)
00125 return be;
00126
00127 memset(be, 0, sizeof(*be));
00128
00129 be->beCenterPoints = (geVec3d *)malloc(sizeof(*be->beCenterPoints) * (NumPolys + 1));
00130 if (!be->beCenterPoints)
00131 goto fail;
00132
00133 be->beBitmap = Bitmap;
00134 // be->beBitmap2 = Bitmap2;
00135 be->beNumPoints = NumPolys;
00136 be->beWildness = Wildness;
00137 be->beWidth = Width;
00138
00139 // color.r = 255.0f;
00140 // color.g = 60.0f;
00141 // color.b = 60.0f;
00142 // Electric_BoltEffectSetColorInfo(be, &color, ELECTRIC_BOLT_REDDOMINANT);
00143
00144 // color.r = 60.0f;
00145 // color.g = 255.0f;
00146 // color.b = 60.0f;
00147 // Electric_BoltEffectSetColorInfo(be, &color, ELECTRIC_BOLT_GREENDOMINANT);
00148
00149 color.r = 160.0f;
00150 color.g = 160.0f;
00151 color.b = 255.0f;
00152 Electric_BoltEffectSetColorInfo(be, &color, ELECTRIC_BOLT_BLUEDOMINANT);
00153
00154 return be;
00155
00156 fail:
00157 if (be->beCenterPoints)
00158 free(be->beCenterPoints);
00159
00160 return NULL;
00161 }
|
|
|
Definition at line 163 of file Genesis3d/src/FX/electric.c. References Electric_BoltEffect::beCenterPoints.
00164 {
00165 free(Effect->beCenterPoints);
00166 free(Effect);
00167 }
|
|
||||||||||||||||
|
Definition at line 377 of file Genesis3d/src/FX/electric.c. References GE_LVertex::a, GE_LVertex::b, Electric_BoltEffect::beBitmap, Electric_BoltEffect::beCenterPoints, Electric_BoltEffect::beCurrentColors, Electric_BoltEffect::beEnd, Electric_BoltEffect::beNumPoints, Electric_BoltEffect::beStart, Electric_BoltEffect::beWidth, GE_LVertex::g, GE_RENDER_DO_NOT_OCCLUDE_OTHERS, GE_TEXTURED_POLY, geVec3d_Add(), geVec3d_CrossProduct(), geVec3d_Normalize(), geVec3d_Scale(), geVec3d_Subtract(), geWorld_AddPolyOnce(), geXForm3d_GetIn(), LIGHTNINGALPHA, GE_LVertex::r, GE_LVertex::u, GE_LVertex::v, geVec3d::X, GE_LVertex::X, geVec3d::Y, GE_LVertex::Y, geVec3d::Z, and GE_LVertex::Z. Referenced by Electric_Frame().
00381 {
00382 geVec3d perp;
00383 geVec3d temp;
00384 geVec3d in;
00385 GE_LVertex verts[4];
00386 int i;
00387
00388 geVec3d_Subtract(&be->beStart, &be->beEnd, &temp);
00389 geXForm3d_GetIn(XForm, &in);
00390
00391 geVec3d_CrossProduct(&in, &temp, &perp);
00392 geVec3d_Normalize(&perp);
00393
00394 geVec3d_Scale(&perp, be->beWidth / 2.0f, &perp);
00395
00396 /*
00397 We've got the perpendicular to the camera in the
00398 rough direction of the electric bolt center. Walk
00399 the left and right sides, constructing verts, then
00400 do the drawing.
00401 */
00402 for (i = 0; i < be->beNumPoints - 1; i++)
00403 {
00404 geVec3d temp;
00405
00406 geVec3d_Subtract(&be->beCenterPoints[i], &perp, &temp);
00407 verts[0].X = temp.X;
00408 verts[0].Y = temp.Y;
00409 verts[0].Z = temp.Z;
00410 verts[0].u = 0.0f;
00411 verts[0].v = 0.0f;
00412 verts[0].r = be->beCurrentColors[0];
00413 verts[0].g = be->beCurrentColors[1];
00414 verts[0].b = be->beCurrentColors[2];
00415 verts[0].a = LIGHTNINGALPHA;
00416
00417 geVec3d_Subtract(&be->beCenterPoints[i + 1], &perp, &temp);
00418 verts[1].X = temp.X;
00419 verts[1].Y = temp.Y;
00420 verts[1].Z = temp.Z;
00421 verts[1].u = 0.0f;
00422 verts[1].v = 1.0f;
00423 verts[1].r = be->beCurrentColors[0];
00424 verts[1].g = be->beCurrentColors[1];
00425 verts[1].b = be->beCurrentColors[2];
00426 verts[1].a = LIGHTNINGALPHA;
00427
00428 geVec3d_Add(&be->beCenterPoints[i + 1], &perp, &temp);
00429 verts[2].X = temp.X;
00430 verts[2].Y = temp.Y;
00431 verts[2].Z = temp.Z;
00432 verts[2].u = 1.0f;
00433 verts[2].v = 1.0f;
00434 verts[2].r = be->beCurrentColors[0];
00435 verts[2].g = be->beCurrentColors[1];
00436 verts[2].b = be->beCurrentColors[2];
00437 verts[2].a = LIGHTNINGALPHA;
00438
00439 geVec3d_Add(&be->beCenterPoints[i], &perp, &temp);
00440 verts[3].X = temp.X;
00441 verts[3].Y = temp.Y;
00442 verts[3].Z = temp.Z;
00443 verts[3].u = 1.0f;
00444 verts[3].v = 0.0f;
00445 verts[3].r = be->beCurrentColors[0];
00446 verts[3].g = be->beCurrentColors[1];
00447 verts[3].b = be->beCurrentColors[2];
00448 verts[3].a = LIGHTNINGALPHA;
00449
00450 geWorld_AddPolyOnce(World,
00451 verts,
00452 4,
00453 be->beBitmap,
00454 GE_TEXTURED_POLY,
00455 GE_RENDER_DO_NOT_OCCLUDE_OTHERS,
00456 1.0f);
00457
00458 // DrawPoint(World, &be->beCenterPoints[i], be->beTexture, 255, 0, 0);
00459 }
00460 }
|
|
||||||||||||||||
|
Definition at line 239 of file Genesis3d/src/FX/electric.c. References GE_RGBA::b, Electric_BoltEffect::beBaseColors, Electric_BoltEffect::beCurrentColors, Electric_BoltEffect::beDominantColor, GE_RGBA::g, and GE_RGBA::r. Referenced by Electric_BoltEffectCreate(), and Electric_SetWorld().
00243 {
00244 Effect->beBaseColors[0] = BaseColor->r;
00245 Effect->beBaseColors[1] = BaseColor->g;
00246 Effect->beBaseColors[2] = BaseColor->b;
00247 Effect->beCurrentColors[0] = BaseColor->r;
00248 Effect->beCurrentColors[1] = BaseColor->g;
00249 Effect->beCurrentColors[2] = BaseColor->b;
00250 Effect->beDominantColor = DominantColor;
00251 }
|
|
||||||||||||||||
|
Definition at line 646 of file Genesis3d/src/FX/electric.c. References ElectricBolt::Bolt, Electric_BoltEffectAnimate(), Electric_BoltEffectRender(), frand(), GE_FALSE, GE_TRUE, geBoolean, geEntity_EntitySetGetNextEntity(), geEntity_GetUserData(), geFloat, geSound3D_GetConfig(), geSound_ModifySound(), geSound_PlaySoundDef(), geVec3d_AddScaled(), geVec3d_Subtract(), geWorld_GetEntitySet(), geWorld_GetLeaf(), geWorld_MightSeeLeaf(), int32, ElectricBolt::Intermittent, ElectricBolt::LastBoltTime, ElectricBolt::LastTime, LIGHTNINGSTROKEDURATION, ElectricBolt::LoopingSound, ElectricBolt::MaxFrequency, ElectricBolt::MinFrequency, NULL, ElectricBoltTerminus::origin, ElectricBolt::origin, SingleDef, SoundSys, and ElectricBolt::Terminus. Referenced by RenderWorld().
00647 {
00648 geEntity_EntitySet * Set;
00649 geEntity * Entity;
00650
00651 if (!World)
00652 return GE_TRUE;
00653
00654 Set = geWorld_GetEntitySet(World, "ElectricBolt");
00655 if (Set == NULL)
00656 return GE_TRUE;
00657
00658 Entity = geEntity_EntitySetGetNextEntity(Set, NULL);
00659 while (Entity)
00660 {
00661 ElectricBolt * Bolt;
00662 geFloat Volume;
00663 geFloat Pan;
00664 geFloat Frequency;
00665 geVec3d MidPoint;
00666 int32 Leaf;
00667
00668 Bolt = geEntity_GetUserData(Entity);
00669
00670 geVec3d_Subtract(&Bolt->Terminus->origin, &Bolt->origin, &MidPoint);
00671 geVec3d_AddScaled(&Bolt->origin, &MidPoint, 0.5f, &MidPoint);
00672
00673 geWorld_GetLeaf(World, &MidPoint, &Leaf);
00674
00675 if (geWorld_MightSeeLeaf(World, Leaf))
00676 {
00677 geSound3D_GetConfig(World,
00678 XForm,
00679 &MidPoint,
00680 600.0f,
00681 2.0f,
00682 &Volume,
00683 &Pan,
00684 &Frequency);
00685
00686 Bolt->LastTime += DeltaTime;
00687
00688 if (!Bolt->Intermittent ||
00689 (Bolt->LastTime - Bolt->LastBoltTime > frand(Bolt->MaxFrequency, Bolt->MinFrequency)))
00690 {
00691 Electric_BoltEffectAnimate(Bolt->Bolt,
00692 &Bolt->origin,
00693 &Bolt->Terminus->origin);
00694
00695 if (Bolt->Intermittent && SoundSys)
00696 geSound_PlaySoundDef(SoundSys, SingleDef, Volume, Pan, Frequency, GE_FALSE);
00697
00698 Bolt->LastBoltTime = Bolt->LastTime;
00699 }
00700
00701 if (!Bolt->Intermittent && SoundSys)
00702 geSound_ModifySound(SoundSys, Bolt->LoopingSound, Volume, Pan, Frequency);
00703
00704 if (Bolt->LastTime - Bolt->LastBoltTime <= LIGHTNINGSTROKEDURATION)
00705 Electric_BoltEffectRender(World, Bolt->Bolt, XForm);
00706 }
00707
00708 Entity = geEntity_EntitySetGetNextEntity(Set, Entity);
00709 }
00710
00711 return GE_TRUE;
00712 }
|
|
||||||||||||||||||||
|
Definition at line 462 of file Genesis3d/src/FX/electric.c. References Electric_SetWorld(), Engine, GE_FALSE, GE_TRUE, GE_VFILE_OPEN_READONLY, geBoolean, geSound_LoadSoundDef(), geVFile_Close(), geVFile_Open(), LoopingDef, MainFS, SingleDef, and SoundSys. Referenced by GameMgr_SetWorld().
00463 {
00464 Engine;
00465
00466 if (SoundSystem)
00467 {
00468 geVFile * File;
00469
00470 SoundSys = SoundSystem;
00471 assert(SoundSys);
00472 File = geVFile_Open(MainFS, "wav\\loopbzzt.wav", GE_VFILE_OPEN_READONLY);
00473 if (!File)
00474 return GE_FALSE;
00475 LoopingDef = geSound_LoadSoundDef(SoundSys, File);
00476 geVFile_Close(File);
00477 File = geVFile_Open(MainFS, "wav\\onebzzt.wav", GE_VFILE_OPEN_READONLY);
00478 if (!File)
00479 return GE_FALSE;
00480
00481 SingleDef = geSound_LoadSoundDef(SoundSys, File);
00482
00483 geVFile_Close(File);
00484 if (!LoopingDef || !SingleDef)
00485 return GE_FALSE;
00486 }
00487
00488 if (!Electric_SetWorld(World, MainFS))
00489 {
00490 // FIXME: Free more stuff
00491 return GE_FALSE;
00492 }
00493
00494 return GE_TRUE;
00495 }
|
|
|
Definition at line 497 of file Genesis3d/src/FX/electric.c. References GE_TRUE, geBoolean, geEntity_EntitySetGetNextEntity(), geEntity_GetUserData(), geWorld_GetEntitySet(), ElectricBolt::LastBoltTime, ElectricBolt::LastTime, and NULL.
00498 {
00499 geEntity_EntitySet * Set;
00500 geEntity * Entity;
00501
00502 if (!World)
00503 return GE_TRUE;
00504
00505 Set = geWorld_GetEntitySet(World, "ElectricBolt");
00506 if (Set == NULL)
00507 return GE_TRUE;
00508
00509 Entity = geEntity_EntitySetGetNextEntity(Set, NULL);
00510 while (Entity)
00511 {
00512 ElectricBolt * Bolt;
00513
00514 Bolt = geEntity_GetUserData(Entity);
00515 Bolt->LastTime = 0.0f;
00516 Bolt->LastBoltTime = 0.0f;
00517
00518 Entity = geEntity_EntitySetGetNextEntity(Set, Entity);
00519 }
00520
00521 return GE_TRUE;
00522 }
|
|
||||||||||||
|
Definition at line 524 of file Genesis3d/src/FX/electric.c. References Bitmap, ElectricBolt::Bolt, ElectricBolt::Color, ElectricBolt::DominantColor, Electric_BoltEffectCreate(), Electric_BoltEffectSetColorInfo(), GE_FALSE, GE_TRUE, geBitmap_Destroy(), geBitmapUtil_CreateFromFileAndAlphaNames(), geBoolean, geEntity_EntitySetGetNextEntity(), geEntity_GetName(), geEntity_GetUserData(), geErrorLog_AddString, geSound_PlaySoundDef(), geWorld_AddBitmap(), geWorld_GetEntitySet(), geWorld_RemoveBitmap(), ElectricBolt::Intermittent, LoopingDef, ElectricBolt::LoopingSound, MainFS, NULL, ElectricBolt::NumPoints, ElectricBolt::origin, s, SoundSys, ElectricBolt::Terminus, ElectricBolt::Width, ElectricBolt::Wildness, geVec3d::X, geVec3d::Y, and geVec3d::Z. Referenced by Electric_Init().
00525 {
00526 geEntity_EntitySet * Set;
00527 geEntity * Entity;
00528
00529 assert(World);
00530 assert(MainFS);
00531
00532 assert(Bitmap == NULL);
00533
00534 Set = geWorld_GetEntitySet(World, "ElectricBolt");
00535
00536 if (Set == NULL)
00537 return GE_TRUE;
00538
00539 Bitmap = geBitmapUtil_CreateFromFileAndAlphaNames(MainFS, "Bmp\\Bolt.Bmp", "Bmp\\Bolt.Bmp");
00540
00541 if (!Bitmap)
00542 {
00543 geErrorLog_AddString(-1, "Electric_SetWorld: geBitmapUtil_CreateFromFileAndAlphaNames failed:", "Bmp\\Bolt.Bmp, Bmp\\Bolt.Bmp");
00544 return GE_FALSE;
00545 }
00546
00547 if (!geWorld_AddBitmap(World, Bitmap))
00548 {
00549 geBitmap_Destroy(&Bitmap);
00550 return GE_FALSE;
00551 }
00552
00553 Entity = geEntity_EntitySetGetNextEntity(Set, NULL);
00554 while (Entity)
00555 {
00556 ElectricBolt * Bolt;
00557
00558 Bolt = geEntity_GetUserData(Entity);
00559 if (Bolt->Terminus == NULL)
00560 {
00561 #define MAX_NAME 100
00562 char EntityName[MAX_NAME];
00563 char s[MAX_NAME + 200];
00564 geEntity_GetName(Entity, EntityName, MAX_NAME-1);
00565 EntityName[MAX_NAME-1]=0;
00566 sprintf(s,"Name='%s' Origin=%f,%f,%f",EntityName,Bolt->origin.X,Bolt->origin.Y,Bolt->origin.Z);
00567 geErrorLog_AddString(-1,"Electric_SetWorld: ElectricBolt entity has no terminius. ",s);
00568 geWorld_RemoveBitmap(World, Bitmap);
00569 geBitmap_Destroy(&Bitmap);
00570 return GE_FALSE;
00571 }
00572 Bolt->Bolt = Electric_BoltEffectCreate(Bitmap,
00573 NULL,
00574 Bolt->NumPoints,
00575 Bolt->Width,
00576 Bolt->Wildness);
00577
00578 Electric_BoltEffectSetColorInfo(Bolt->Bolt, &Bolt->Color, Bolt->DominantColor);
00579
00580 if (Bolt->Bolt == NULL)
00581 {
00582 geWorld_RemoveBitmap(World, Bitmap);
00583 geBitmap_Destroy(&Bitmap);
00584 return GE_FALSE;
00585 }
00586
00587 if (!Bolt->Intermittent && SoundSys)
00588 {
00589 Bolt->LoopingSound = geSound_PlaySoundDef(SoundSys,
00590 LoopingDef,
00591 0.0f,
00592 0.0f,
00593 0.0f,
00594 GE_TRUE);
00595 if (!Bolt->LoopingSound)
00596 {
00597 geWorld_RemoveBitmap(World, Bitmap);
00598 geBitmap_Destroy(&Bitmap);
00599 return GE_FALSE;
00600 }
00601 }
00602
00603 Entity = geEntity_EntitySetGetNextEntity(Set, Entity);
00604 }
00605
00606 return GE_TRUE;
00607 }
|
|
|
Definition at line 609 of file Genesis3d/src/FX/electric.c. References Bitmap, GE_TRUE, geBitmap_Destroy(), geBoolean, geSound_FreeSoundDef(), LoopingDef, NULL, SingleDef, and SoundSys. Referenced by GameMgr_FreeWorld().
00610 {
00611 if (LoopingDef)
00612 {
00613 geSound_FreeSoundDef(SoundSys, LoopingDef);
00614 LoopingDef = NULL;
00615 }
00616
00617 if (SingleDef)
00618 {
00619 geSound_FreeSoundDef(SoundSys, SingleDef);
00620 SingleDef = NULL;
00621 }
00622
00623 if (Bitmap)
00624 {
00625 //geWorld_RemoveBitmap(World, Bitmap);
00626 geBitmap_Destroy(&Bitmap);
00627 Bitmap = NULL;
00628 }
00629
00630 return GE_TRUE;
00631 }
|
|
||||||||||||
|
Definition at line 633 of file Genesis3d/src/FX/electric.c. References geFloat. Referenced by Electric_Frame().
|
|
|
Definition at line 169 of file Genesis3d/src/FX/electric.c. Referenced by subdivide().
|
|
||||||||||||||||||||||||
|
Definition at line 207 of file Genesis3d/src/FX/electric.c. References Electric_BoltEffect::beCenterPoints, Electric_BoltEffect::beCurrentPoint, Electric_BoltEffect::beWildness, geFloat, IsPowerOf2(), logBase2(), subdivide(), geVec3d::X, geVec3d::Y, and geVec3d::Z.
00213 {
00214 geFloat length;
00215 int seed;
00216
00217 assert(be);
00218 assert(start);
00219 assert(end);
00220 assert(RangeHigh > RangeLow);
00221 assert(IsPowerOf2(RangeHigh - RangeLow));
00222
00223 /* Manhattan length is good enough for this */
00224 length = (geFloat)(fabs(start->X - end->X) +
00225 fabs(start->Y - end->Y) +
00226 fabs(start->Z - end->Z));
00227
00228 seed = rand();
00229
00230 srand(seed);
00231 be->beCurrentPoint = be->beCenterPoints + RangeLow;
00232 be->beCenterPoints[RangeLow] = *start;
00233 be->beCenterPoints[RangeHigh] = *end;
00234 // be->beCenterPoints[be->beNumPoints] = *end;
00235 // subdivide(be, start, end, length * be->beWildness, logBase2(be->beNumPoints));
00236 subdivide(be, start, end, length * be->beWildness, logBase2(RangeHigh - RangeLow));
00237 }
|
|
|
Definition at line 94 of file Genesis3d/src/FX/electric.c. References GE_FALSE, GE_TRUE, and geBoolean.
|
|
|
Definition at line 77 of file Genesis3d/src/FX/electric.c. Referenced by genLightning().
00078 {
00079 int i = 0;
00080
00081 assert(n != 0);
00082
00083 while (!(n & 1))
00084 {
00085 n = n >> 1;
00086 i++;
00087 }
00088
00089 assert((n & ~1) == 0);
00090
00091 return i;
00092 }
|
|
||||||||||||||||||||||||
|
Definition at line 182 of file Genesis3d/src/FX/electric.c. References Electric_BoltEffect::beCurrentPoint, GaussRand(), s, subdivide(), geVec3d::X, geVec3d::Y, and geVec3d::Z.
00188 {
00189 geVec3d tmp;
00190
00191 if (n == 0)
00192 {
00193 be->beCurrentPoint++;
00194 *be->beCurrentPoint = *end;
00195 return;
00196 }
00197
00198 tmp.X = (end->X + start->X) / 2 + s * GaussRand();
00199 tmp.Y = (end->Y + start->Y) / 2 + s * GaussRand();
00200 tmp.Z = (end->Z + start->Z) / 2 + s * GaussRand();
00201 subdivide(be, start, &tmp, s / 2, n - 1);
00202 subdivide(be, &tmp, end, s / 2, n - 1);
00203 }
|
|
|
Definition at line 20 of file Genesis3d/src/FX/electric.c. Referenced by Electric_BoltEffectCreate(), Electric_SetWorld(), and Electric_Shutdown(). |
|
|
Definition at line 18 of file Genesis3d/src/FX/electric.c. |
|
|
Definition at line 21 of file Genesis3d/src/FX/electric.c. Referenced by Electric_Init(), Electric_SetWorld(), and Electric_Shutdown(). |
|
|
Definition at line 22 of file Genesis3d/src/FX/electric.c. Referenced by Electric_Frame(), Electric_Init(), and Electric_Shutdown(). |
|
|
Definition at line 23 of file Genesis3d/src/FX/electric.c. Referenced by Electric_Frame(), Electric_Init(), Electric_SetWorld(), and Electric_Shutdown(). |
1.3.2