#include "Genesis.h"Go to the source code of this file.
Compounds | |
| struct | _Electric_BoltEffect |
Defines | |
| #define | ELECTRIC_BOLT_REDDOMINANT 0 |
| #define | ELECTRIC_BOLT_GREENDOMINANT 1 |
| #define | ELECTRIC_BOLT_BLUEDOMINANT 2 |
Typedefs | |
| typedef _Electric_BoltEffect | _Electric_BoltEffect |
Functions | |
| _Electric_BoltEffect * | _Electric_BoltEffectCreate (int NumPolys, int Width, geFloat Wildness) |
| void | _Electric_BoltEffectDestroy (_Electric_BoltEffect *Effect) |
| void | _Electric_BoltEffectAnimate (_Electric_BoltEffect *Effect, const geVec3d *start, const geVec3d *end) |
| void | _Electric_BoltEffectRender (geWorld *World, _Electric_BoltEffect *Effect, const geXForm3d *XForm) |
| void | _Electric_BoltEffectSetColorInfo (_Electric_BoltEffect *Effect, GE_RGBA *BaseColor, int DominantColor) |
|
|
Definition at line 33 of file Genesis3D v1-6/G3D/Engine/Logo/electric.h. |
|
|
Definition at line 32 of file Genesis3D v1-6/G3D/Engine/Logo/electric.h. |
|
|
Definition at line 31 of file Genesis3D v1-6/G3D/Engine/Logo/electric.h. |
|
|
|
|
||||||||||||||||
|
Definition at line 194 of file Genesis3D v1-6/G3D/Engine/Logo/electric.c. References _Electric_BoltEffect::beBaseColors, _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 DoSplashScreen().
00198 {
00199 int dominant;
00200 int nonDominant1;
00201 int nonDominant2;
00202 geVec3d SubdivideStart;
00203 geVec3d SubdivideEnd;
00204 int LowIndex;
00205 int HighIndex;
00206
00207 Effect->beStart = *start;
00208 Effect->beEnd = *end;
00209
00210 dominant = Effect->beDominantColor;
00211 nonDominant1 = (dominant + 1) % 3;
00212 nonDominant2 = (dominant + 2) % 3;
00213 if (Effect->beBaseColors[nonDominant1] == Effect->beCurrentColors[nonDominant1])
00214 {
00215 int DecayRate;
00216 int Spike;
00217
00218 DecayRate = rand() % (int)(Effect->beBaseColors[dominant] - Effect->beBaseColors[nonDominant1]);
00219 DecayRate = max(DecayRate, 5);
00220 Effect->beDecayRate = DecayRate;
00221 if (Effect->beBaseColors[nonDominant1] >= 1.0f)
00222 Spike = rand() % (int)(Effect->beBaseColors[nonDominant1]);
00223 else
00224 Spike = 0;
00225 Effect->beCurrentColors[nonDominant1] -= Spike;
00226 Effect->beCurrentColors[nonDominant2] -= Spike;
00227 }
00228 else
00229 {
00230 Effect->beCurrentColors[nonDominant1] += Effect->beDecayRate;
00231 Effect->beCurrentColors[nonDominant2] += Effect->beDecayRate;
00232 if (Effect->beCurrentColors[nonDominant1] > Effect->beBaseColors[nonDominant1])
00233 {
00234 Effect->beCurrentColors[nonDominant1] = Effect->beBaseColors[nonDominant1];
00235 Effect->beCurrentColors[nonDominant2] = Effect->beBaseColors[nonDominant2];
00236 }
00237 }
00238
00239 Effect->beInitialized = 1;
00240 LowIndex = 0;
00241 HighIndex = Effect->beNumPoints;
00242 SubdivideStart = *start;
00243 SubdivideEnd = *end;
00244
00245 genLightning(Effect, LowIndex, HighIndex, &SubdivideStart, &SubdivideEnd);
00246 }
|
|
||||||||||||||||
|
Definition at line 63 of file Genesis3D v1-6/G3D/Engine/Logo/electric.c. References _Electric_BoltEffectSetColorInfo(), GE_RGBA::b, _Electric_BoltEffect::beCenterPoints, _Electric_BoltEffect::beNumPoints, _Electric_BoltEffect::beWidth, _Electric_BoltEffect::beWildness, ELECTRIC_BOLT_BLUEDOMINANT, GE_RGBA::g, geRam_Allocate, geRam_Free, logBase2(), NULL, and GE_RGBA::r. Referenced by DoSplashScreen().
00067 {
00068 _Electric_BoltEffect * be;
00069 GE_RGBA color;
00070
00071 assert(Wildness >= 0.0f && Wildness <= 1.0f);
00072
00073 /* Asserts power of 2 */
00074 logBase2(NumPolys);
00075
00076 be = (_Electric_BoltEffect *)geRam_Allocate(sizeof(*be));
00077 if (!be)
00078 return be;
00079
00080 memset(be, 0, sizeof(*be));
00081
00082 be->beCenterPoints = (geVec3d *)geRam_Allocate(sizeof(*be->beCenterPoints) * (NumPolys + 1));
00083 if (!be->beCenterPoints)
00084 goto fail;
00085
00086 be->beNumPoints = NumPolys;
00087 be->beWildness = Wildness;
00088 be->beWidth = Width;
00089
00090 color.r = 160.0f;
00091 color.g = 160.0f;
00092 color.b = 255.0f;
00093 _Electric_BoltEffectSetColorInfo(be, &color, ELECTRIC_BOLT_BLUEDOMINANT);
00094
00095 return be;
00096
00097 fail:
00098 if (be->beCenterPoints)
00099 geRam_Free(be->beCenterPoints);
00100 if (be)
00101 geRam_Free(be);
00102
00103 return NULL;
00104 }
|
|
|
Definition at line 106 of file Genesis3D v1-6/G3D/Engine/Logo/electric.c. References _Electric_BoltEffect::beCenterPoints, and geRam_Free. Referenced by DoSplashScreen().
00107 {
00108 geRam_Free(Effect->beCenterPoints);
00109 geRam_Free(Effect);
00110 }
|
|
||||||||||||||||
|
Definition at line 251 of file Genesis3D v1-6/G3D/Engine/Logo/electric.c. References GE_LVertex::a, GE_LVertex::b, _Electric_BoltEffect::beCenterPoints, _Electric_BoltEffect::beCurrentColors, _Electric_BoltEffect::beEnd, _Electric_BoltEffect::beNumPoints, _Electric_BoltEffect::beStart, _Electric_BoltEffect::beWidth, GE_LVertex::g, GE_GOURAUD_POLY, GE_RENDER_DO_NOT_OCCLUDE_OTHERS, geVec3d_Add(), geVec3d_CrossProduct(), geVec3d_Normalize(), geVec3d_Scale(), geVec3d_Subtract(), geWorld_AddPolyOnce(), geXForm3d_GetIn(), LIGHTNINGALPHA, NULL, 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 DoSplashScreen().
00255 {
00256 geVec3d perp;
00257 geVec3d temp;
00258 geVec3d in;
00259 GE_LVertex verts[4];
00260 int i;
00261
00262 geVec3d_Subtract(&be->beStart, &be->beEnd, &temp);
00263 geXForm3d_GetIn(XForm, &in);
00264
00265 geVec3d_CrossProduct(&in, &temp, &perp);
00266 geVec3d_Normalize(&perp);
00267
00268 geVec3d_Scale(&perp, be->beWidth / 2.0f, &perp);
00269
00270 /*
00271 We've got the perpendicular to the camera in the
00272 rough direction of the electric bolt center. Walk
00273 the left and right sides, constructing verts, then
00274 do the drawing.
00275 */
00276 for (i = 0; i < be->beNumPoints - 1; i++)
00277 {
00278 geVec3d temp;
00279
00280 geVec3d_Subtract(&be->beCenterPoints[i], &perp, &temp);
00281 verts[0].X = temp.X;
00282 verts[0].Y = temp.Y;
00283 verts[0].Z = temp.Z;
00284 verts[0].u = 0.0f;
00285 verts[0].v = 0.0f;
00286 verts[0].r = be->beCurrentColors[0];
00287 verts[0].g = be->beCurrentColors[1];
00288 verts[0].b = be->beCurrentColors[2];
00289 verts[0].a = LIGHTNINGALPHA;
00290
00291 geVec3d_Subtract(&be->beCenterPoints[i + 1], &perp, &temp);
00292 verts[1].X = temp.X;
00293 verts[1].Y = temp.Y;
00294 verts[1].Z = temp.Z;
00295 verts[1].u = 0.0f;
00296 verts[1].v = 1.0f;
00297 verts[1].r = be->beCurrentColors[0];
00298 verts[1].g = be->beCurrentColors[1];
00299 verts[1].b = be->beCurrentColors[2];
00300 verts[1].a = LIGHTNINGALPHA;
00301
00302 geVec3d_Add(&be->beCenterPoints[i + 1], &perp, &temp);
00303 verts[2].X = temp.X;
00304 verts[2].Y = temp.Y;
00305 verts[2].Z = temp.Z;
00306 verts[2].u = 1.0f;
00307 verts[2].v = 1.0f;
00308 verts[2].r = be->beCurrentColors[0];
00309 verts[2].g = be->beCurrentColors[1];
00310 verts[2].b = be->beCurrentColors[2];
00311 verts[2].a = LIGHTNINGALPHA;
00312
00313 geVec3d_Add(&be->beCenterPoints[i], &perp, &temp);
00314 verts[3].X = temp.X;
00315 verts[3].Y = temp.Y;
00316 verts[3].Z = temp.Z;
00317 verts[3].u = 1.0f;
00318 verts[3].v = 0.0f;
00319 verts[3].r = be->beCurrentColors[0];
00320 verts[3].g = be->beCurrentColors[1];
00321 verts[3].b = be->beCurrentColors[2];
00322 verts[3].a = LIGHTNINGALPHA;
00323
00324 geWorld_AddPolyOnce(World,
00325 verts,
00326 4,
00327 NULL,
00328 GE_GOURAUD_POLY,
00329 GE_RENDER_DO_NOT_OCCLUDE_OTHERS,
00330 1.0f);
00331
00332 }
00333 }
|
|
||||||||||||||||
|
Definition at line 180 of file Genesis3D v1-6/G3D/Engine/Logo/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().
00184 {
00185 Effect->beBaseColors[0] = BaseColor->r;
00186 Effect->beBaseColors[1] = BaseColor->g;
00187 Effect->beBaseColors[2] = BaseColor->b;
00188 Effect->beCurrentColors[0] = BaseColor->r;
00189 Effect->beCurrentColors[1] = BaseColor->g;
00190 Effect->beCurrentColors[2] = BaseColor->b;
00191 Effect->beDominantColor = DominantColor;
00192 }
|
1.3.2