#include "genesis.h"Go to the source code of this file.
Compounds | |
| struct | Corona |
Typedefs | |
| typedef Corona | Corona |
Functions | |
| geBoolean | Corona_Init (geEngine *Engine, geWorld *World, geVFile *MainFS) |
| geBoolean | Corona_Shutdown (void) |
| geBoolean | Corona_Frame (geWorld *World, const geXForm3d *XForm, geFloat DeltaTime) |
|
|
Referenced by DoSplashScreen(). |
|
||||||||||||||||
|
Definition at line 72 of file corona.c. References GE_LVertex::a, Corona::AllowRotation, GE_RGBA::b, GE_LVertex::b, Corona::Color, CoronaBitmap, CWorld, EffectScale, Corona::FadeOut, Corona::FadeTime, GE_RGBA::g, GE_LVertex::g, GE_COLLIDE_MODELS, GE_CONTENTS_CANNOT_OCCUPY, GE_FALSE, GE_RENDER_DO_NOT_OCCLUDE_OTHERS, GE_RENDER_DO_NOT_OCCLUDE_SELF, GE_TEXTURED_POINT, GE_TRUE, geBoolean, geEngine_Printf(), geEntity_EntitySetGetNextEntity(), geEntity_GetUserData(), geFloat, geVec3d_Add(), geVec3d_Length(), geVec3d_Subtract(), geWorld_AddPolyOnce(), geWorld_Collision(), geWorld_GetEntitySet(), geWorld_GetLeaf(), geWorld_GetModelRotationalCenter(), geWorld_GetModelXForm(), geWorld_MightSeeLeaf(), geXForm3d_Transform(), int32, Corona::LastTime, Corona::LastVisibleRadius, Corona::LastVisibleTime, Corona::MaxRadius, Corona::MaxRadiusDistance, Corona::MaxVisibleDistance, Corona::MinRadius, Corona::MinRadiusDistance, Corona::Model, NULL, Corona::origin, GE_LVertex::r, GE_RGBA::r, TheEngine, geXForm3d::Translation, GE_LVertex::u, GE_LVertex::v, geVec3d::X, GE_LVertex::X, geVec3d::Y, GE_LVertex::Y, geVec3d::Z, and GE_LVertex::Z. Referenced by RenderWorld().
00073 {
00074 geEntity_EntitySet * Set;
00075 geEntity * Entity;
00076 GE_Collision Collision;
00077
00078 assert(World);
00079 assert(World == CWorld);
00080
00081 Set = geWorld_GetEntitySet(World, "Corona");
00082
00083 if (Set == NULL)
00084 return GE_TRUE;
00085
00086 Entity = geEntity_EntitySetGetNextEntity(Set, NULL);
00087
00088 while (Entity)
00089 {
00090 Corona * C;
00091 geVec3d Pos;
00092 geFloat DistanceToCorona;
00093 geVec3d Delta;
00094 geFloat Radius;
00095 geBoolean Visible;
00096 geBoolean Fading;
00097 int32 Leaf;
00098
00099 C = geEntity_GetUserData(Entity);
00100
00101 geWorld_GetLeaf(World, &C->origin, &Leaf);
00102
00103 if (geWorld_MightSeeLeaf(World, Leaf))
00104 {
00105
00106 if (C->Model)
00107 {
00108 geXForm3d XForm;
00109
00110 geWorld_GetModelXForm(World, C->Model, &XForm);
00111
00112 Pos = C->origin;
00113 if (C->AllowRotation)
00114 {
00115 geVec3d Center;
00116
00117 geWorld_GetModelRotationalCenter(World, C->Model, &Center);
00118 geVec3d_Subtract(&Pos, &Center, &Pos);
00119 geXForm3d_Transform(&XForm, &Pos, &Pos);
00120 geVec3d_Add(&Pos, &Center, &Pos);
00121 }
00122 else
00123 geVec3d_Add(&Pos, &XForm.Translation, &Pos);
00124 }
00125 else
00126 {
00127 Pos = C->origin;
00128 }
00129
00130 geVec3d_Subtract(&Pos, &XForm->Translation, &Delta);
00131 DistanceToCorona = geVec3d_Length(&Delta);
00132
00133 if (!geWorld_Collision(World,
00134 NULL,
00135 NULL,
00136 &Pos,
00137 &XForm->Translation,
00138 GE_CONTENTS_CANNOT_OCCUPY,
00139 GE_COLLIDE_MODELS,
00140 0xffffffff, NULL, NULL,
00141 &Collision) &&
00142 (DistanceToCorona < C->MaxVisibleDistance))
00143 {
00144 Visible = GE_TRUE;
00145 C->LastVisibleTime = C->LastTime;
00146 }
00147 else
00148 {
00149 Visible = GE_FALSE;
00150 }
00151
00152 Fading = (C->FadeOut && (C->LastTime <= C->LastVisibleTime + C->FadeTime)) ? GE_TRUE : GE_FALSE;
00153
00154 #if 0
00155 if (!Visible && C->Color.r != 255.0f)
00156 {
00157 geEngine_Printf(TheEngine, 2, 50, "Fading = %s", Fading ? "GE_TRUE " : "GE_FALSE");
00158 geEngine_Printf(TheEngine, 2, 50 + 12, "LastVisible = %4.2f", C->LastVisibleTime);
00159 geEngine_Printf(TheEngine, 2, 50 + 12 + 12, "LastTime = %4.2f", C->LastTime);
00160 }
00161 #endif
00162
00163 if (Visible || Fading)
00164 {
00165 GE_LVertex Vert;
00166
00167 Vert.X = Pos.X;
00168 Vert.Y = Pos.Y;
00169 Vert.Z = Pos.Z;
00170 Vert.r = C->Color.r;
00171 Vert.g = C->Color.g;
00172 Vert.b = C->Color.b;
00173 Vert.a = 255.0f;
00174 Vert.u = Vert.v = 0.0f;
00175
00176 if (Visible)
00177 {
00178 if (DistanceToCorona >= C->MaxRadiusDistance)
00179 {
00180 Radius = (geFloat)C->MaxRadius;
00181 }
00182 else if (DistanceToCorona <= C->MinRadiusDistance)
00183 {
00184 Radius = (geFloat)C->MinRadius;
00185 }
00186 else
00187 {
00188 geFloat Slope;
00189
00190 Slope = (geFloat)(C->MaxRadius - C->MinRadius) / (geFloat)(C->MaxRadiusDistance - C->MinRadiusDistance);
00191 Radius = (geFloat)C->MinRadius + Slope * (geFloat)(DistanceToCorona - C->MinRadiusDistance);
00192 }
00193 C->LastVisibleRadius = Radius;
00194 }
00195 else
00196 {
00197 assert(Fading == GE_TRUE);
00198 assert(C->LastTime <= C->LastVisibleTime + C->FadeTime);
00199 Radius = (1.0f - (C->LastTime - C->LastVisibleTime) / C->FadeTime) * C->LastVisibleRadius;
00200 }
00201
00202 //geEngine_Printf(TheEngine, 2, 50, "Radius = %4.2f", Radius);
00203 //geEngine_Printf(TheEngine, 2, 50 + 12, "Dist = %4.2f", DistanceToCorona);
00204 geWorld_AddPolyOnce(World,
00205 &Vert,
00206 1,
00207 CoronaBitmap,
00208 GE_TEXTURED_POINT,
00209 GE_RENDER_DO_NOT_OCCLUDE_OTHERS | GE_RENDER_DO_NOT_OCCLUDE_SELF,
00210 Radius * EffectScale);
00211 }
00212
00213 C->LastTime += DeltaTime;
00214 }
00215
00216 Entity = geEntity_EntitySetGetNextEntity(Set, Entity);
00217 }
00218
00219 return GE_TRUE;
00220 }
|
|
||||||||||||||||
|
Definition at line 20 of file corona.c. References CoronaBitmap, CWorld, Engine, GE_FALSE, GE_TRUE, geBitmap_Destroy(), geBitmapUtil_CreateFromFileAndAlphaNames(), geBoolean, geErrorLog_AddString, geWorld_AddBitmap(), geWorld_GetEntitySet(), MainFS, NULL, and TheEngine. Referenced by GameMgr_SetWorld().
00021 {
00022 assert(Engine);
00023 assert(World);
00024 assert(MainFS);
00025
00026 CWorld = World;
00027 TheEngine = Engine;
00028
00029 if (!geWorld_GetEntitySet(World, "Corona"))
00030 return GE_TRUE;
00031
00032 CoronaBitmap = geBitmapUtil_CreateFromFileAndAlphaNames(MainFS, "Bmp\\Corona.Bmp", "Bmp\\Corona_a.Bmp");
00033
00034 if(!CoronaBitmap)
00035 {
00036 geErrorLog_AddString(-1, "Corona_SetWorld: geBitmapUtil_CreateFromFileAndAlphaNames failed:","Bmp\\Corona.Bmp, Bmp\\Corona_a.Bmp");
00037 return GE_FALSE;
00038 }
00039
00040 if (!geWorld_AddBitmap(World, CoronaBitmap))
00041 {
00042 geBitmap_Destroy(&CoronaBitmap);
00043 geErrorLog_AddString(-1, "Corona_SetWorld: geWorld_AddBitmap failed", NULL);
00044 return GE_FALSE;
00045 }
00046
00047 return GE_TRUE;
00048 }
|
|
|
Definition at line 50 of file corona.c. References CoronaBitmap, CWorld, GE_FALSE, GE_TRUE, geBitmap_Destroy(), geBoolean, geWorld_RemoveBitmap(), and NULL. Referenced by GameMgr_FreeWorld().
00051 {
00052 geBoolean Ret;
00053
00054 Ret = GE_TRUE;
00055
00056 if (CoronaBitmap)
00057 {
00058 assert(CWorld);
00059
00060 if (!geWorld_RemoveBitmap(CWorld, CoronaBitmap))
00061 Ret = GE_FALSE;
00062
00063 geBitmap_Destroy(&CoronaBitmap);
00064 }
00065
00066 CWorld = NULL;
00067 CoronaBitmap = NULL;
00068
00069 return Ret;
00070 }
|
1.3.2