00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GE_WORLD_H
00023 #define GE_WORLD_H
00024
00025 #include "ErrorLog.h"
00026 #include "PtrTypes.h"
00027 #include "Genesis.h"
00028 #include "GBSPFile.h"
00029 #include "Motion.h"
00030 #include "Surface.h"
00031 #include "Fog.h"
00032 #include "WBitmap.h"
00033 #include "User.h"
00034 #include "Light.h"
00035
00036 #include "Bitmaplist.h"
00037
00038 #include "Actor.h"
00039
00040
00041
00042 #include "Sprite.h"
00043
00044
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048
00049
00050 #define MAX_MODELS 256
00051
00052
00053 #define MAX_MIRROR_RECURSION 1
00054 #define MAX_RENDERFACE_VERTS 64
00055
00056
00057
00058
00059 #define MODEL_CHANGED_XFORM (1<<0)
00060
00061 typedef struct geWorld_Model
00062 {
00063 char Name[64];
00064 int32 GFXModelNum;
00065 geXForm3d XForm;
00066 geVec3d Mins, Maxs;
00067 geVec3d TMins, TMaxs;
00068 geVec3d Pivot;
00069 geVec3d RealCenter;
00070 int32 VisFrame;
00071 void *UserData;
00072 GFX_Model * BSPModel;
00073
00074 geBoolean Open;
00075
00076 uint32 Flags;
00077
00078 uint32 ChangedFlags;
00079 } geWorld_Model;
00080
00081 typedef struct geWorld_Leaf
00082 {
00083 int32 VisFrame;
00084 int32 Parent;
00085
00086 gePoly *PolyList;
00087 } geWorld_Leaf;
00088
00089 #define MAX_VISIBLE_FOG 12 // Hope to God there is not this much visible at a time!!!
00090
00091
00092 typedef struct
00093 {
00094 int32 Leaf;
00095
00096 geVec3d Mins;
00097 geVec3d Maxs;
00098
00099 int32 VisFrame;
00100
00101 geWorld *World;
00102 } geWorld_FogData;
00103
00104 typedef struct World_BSP
00105 {
00106 char FileName[200];
00107 GBSP_BSPData BSPData;
00108
00109
00110 Surf_SurfInfo *SurfInfo;
00111 Surf_TexVert *TexVerts;
00112
00113 geWBitmap_Pool *WBitmapPool;
00114
00115 geWorld_Model Models[MAX_MODELS];
00116
00117 geWorld_Leaf *LeafData;
00118
00119 int32 *ClusterVisFrame;
00120 int32 *NodeVisFrame;
00121 int32 *AreaVisFrame;
00122 uint8 AreaConnections[256][256];
00123
00124 int32 *NodeParents;
00125
00126 } World_BSP;
00127
00128 typedef struct
00129 {
00130
00131 geVec3d Verts[6][4];
00132 Surf_TexVert TexVerts[6][4];
00133
00134 geVec3d Axis;
00135 geFloat Dpm;
00136 geFloat DrawScale;
00137 int32 Textures[6];
00138
00139 geFloat Angle;
00140
00141 } World_SkyBox;
00142
00143 typedef struct
00144 {
00145
00146 uint32 SkyFlags;
00147
00148 geVec3d TransformedVecs[6][2];
00149 GFX_Plane TransformedPlanes[6];
00150
00151 int32 NumTransformed;
00152 geVec3d TransformedVerts[6][10];
00153 Surf_TexVert TransformedTexVerts[6][10];
00154 int32 NumTransformedVerts[6];
00155 int32 OriginalFaces[6];
00156
00157 } geWorld_SkyBoxTData;
00158
00159 typedef struct World_Actor
00160 {
00161 geActor *Actor;
00162 uint32 Flags;
00163 uint32 UserFlags;
00164
00165
00166 } World_Actor;
00167
00168
00169
00170 typedef struct World_Sprite
00171 {
00172 geSprite *Sprite;
00173 uint32 Flags;
00174 uint32 UserFlags;
00175
00176
00177 } World_Sprite;
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 #define MAX_WORLD_ENT_CLASS_SETS 256
00189
00190 typedef struct
00191 {
00192 const char *ClassName;
00193 geEntity_EntitySet *Set;
00194 } geWorld_EntClassSet;
00195
00196 typedef struct
00197 {
00198 int32 NumNodesTraversed1;
00199 int32 NumNodesTraversed2;
00200 int32 NumLeafsHit1;
00201 int32 NumLeafsHit2;
00202 int32 NumLeafsWithUserPolys;
00203 int32 NumUserPolys;
00204
00205 } geWorld_DebugInfo;
00206
00207 typedef struct geWorld
00208 {
00209 int32 CurFrameStatic;
00210 int32 CurFrameDynamic;
00211 geFloat CurTime;
00212 int32 CurrentLeaf;
00213 geBoolean ForceVis;
00214
00215 geBoolean VisInfo;
00216
00217
00218 World_BSP *CurrentBSP;
00219
00220 World_SkyBox SkyBox;
00221
00222 Frustum_Info *FrustumInfo;
00223
00224 Light_LightInfo *LightInfo;
00225
00226 Mesh_MeshInfo *MeshInfo;
00227
00228 int32 ActorCount;
00229 World_Actor *ActorArray;
00230
00231
00232
00233 int32 SpriteCount;
00234 World_Sprite *SpriteArray;
00235
00236
00237 geWorld_EntClassSet EntClassSets[MAX_WORLD_ENT_CLASS_SETS];
00238 int32 NumEntClassSets;
00239
00240 User_Info *UserInfo;
00241
00242
00243 int32 ActiveUserPolys;
00244 geWorld_DebugInfo DebugInfo;
00245
00246 geFog *FogList;
00247
00248 geFog *VisibleFog[MAX_VISIBLE_FOG];
00249 int32 NumVisibleFog;
00250
00251 BitmapList *AttachedBitmaps;
00252
00253 geXForm3d LastCameraXForm;
00254
00255 int32 RefCount;
00256
00257 geBoolean Changed;
00258
00259 } geWorld;
00260
00261
00262
00263
00264 GENESISAPI geWorld *geWorld_Create(geVFile *File);
00265 GENESISAPI void geWorld_Free(geWorld *World);
00266 geBoolean geWorld_CreateRef(geWorld *World);
00267
00268 geBoolean World_EngineInit(geEngine *Engine);
00269 void World_EngineShutdown(geEngine *Engine);
00270
00271 geBoolean World_SetEngine(geEngine *Engine);
00272 geBoolean World_SetWorld(geWorld *World);
00273 geBoolean World_SetGBSP(World_BSP *BSP);
00274
00275 geBoolean World_WorldRenderQ(geEngine *Engine, geWorld *World, geCamera *Camera);
00276
00277 GENESISAPI geBoolean geWorld_SetModelXForm(
00278 geWorld * World,
00279 geWorld_Model * Model,
00280 const geXForm3d * XForm);
00281 GENESISAPI geBoolean geWorld_GetModelXForm(
00282 const geWorld * World,
00283 const geWorld_Model * Model,
00284 geXForm3d * XForm);
00285
00286 GENESISAPI geBoolean geWorld_GetModelRotationalCenter(
00287 const geWorld * World,
00288 const geWorld_Model * Model,
00289 geVec3d * Center);
00290
00291 GENESISAPI geMotion * geWorld_ModelGetMotion(geWorld_Model *Model);
00292
00293 GENESISAPI void * geWorld_ModelGetUserData(const geWorld_Model *Model);
00294
00295 GENESISAPI void geWorld_ModelSetUserData(geWorld_Model *Model, void *UserData);
00296
00297
00298
00299 GENESISAPI void geWorld_ModelGetCenter(geWorld_Model *Model, geVec3d *Center);
00300
00301 GENESISAPI geWorld_Model *geWorld_WorldGetNextModel(geWorld *World, geWorld_Model *Start);
00302
00303 GENESISAPI geBoolean geWorld_AddBitmap(geWorld *World, geBitmap *Bitmap);
00304 GENESISAPI geBoolean geWorld_RemoveBitmap(geWorld *World,geBitmap *Bitmap);
00305
00306 GENESISAPI geBitmap *geWorld_GetBitmapByName(geWorld *World, const char *BitmapName);
00307
00308 geBoolean geWorld_AttachAll(geWorld *World, DRV_Driver *Driver, geFloat Gamma);
00309 geBoolean geWorld_DetachAll(geWorld *World);
00310
00311 #ifdef __cplusplus
00312 }
00313 #endif
00314 #endif
00315