00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <Windows.h>
00024 #include <Math.h>
00025 #include <Assert.h>
00026
00027 #include "Genesis.H"
00028 #include "System.h"
00029 #include "Ram.h"
00030
00031
00032
00033
00034 #include "World.h"
00035 #include "Surface.h"
00036
00037 #include "Light.h"
00038 #include "Plane.h"
00039 #include "Entities.h"
00040 #include "Trace.h"
00041 #include "User.h"
00042
00043 #include "Motion.h"
00044 #include "Vis.h"
00045
00046
00047
00048
00049 static geEngine *CEngine;
00050 static char *geTag="Eclipse!";
00051
00052
00053
00054
00055 geBoolean geEngine_SetWorld(geEngine *Engine, geWorld *World);
00056
00057
00058
00059
00060
00061
00062
00063
00064 GENESISAPI geEngine *geEngine_CreateWithVersion(HWND hWnd, const char *AppName, const char *DriverDirectory, uint32 Version)
00065 {
00066 assert(AppName != NULL);
00067
00068
00069
00070
00071 return Sys_EngineCreate(hWnd, AppName, DriverDirectory, Version);
00072 }
00073
00074
00075
00076
00077 GENESISAPI void geEngine_Free(geEngine *Engine)
00078 {
00079 Sys_EngineFree(Engine);
00080 }
00081
00082
00083
00084
00085 GENESISAPI void geEngine_FillRect(geEngine *Engine, const GE_Rect *Rect, const GE_RGBA *Color)
00086 {
00087 User_EngineFillRect(Engine, Rect, Color);
00088 }
00089
00090
00091
00092
00093 GENESISAPI geBoolean geEngine_ScreenShot(geEngine *Engine, const char *FileName)
00094 {
00095 assert(Engine);
00096
00097 return Engine->DriverInfo.RDriver->ScreenShot(FileName);
00098 }
00099
00100
00101
00102
00103 GENESISAPI void geEngine_EnableFrameRateCounter(geEngine *Engine, geBoolean Enabled)
00104 {
00105 assert(Engine);
00106 Engine->DisplayFrameRateCounter = Enabled;
00107 }
00108
00109
00110
00111
00112
00113
00114
00115
00116 #ifdef MESHES
00117
00118
00119
00120
00121 GENESISAPI geMesh_Def *geWorld_CreateMesh(geWorld *World, const char *BitmapPath, const char *FileName)
00122 {
00123 assert(World != NULL);
00124 assert(FileName != NULL);
00125
00126 return (geMesh_Def*)Sys_WorldCreateMesh(World, BitmapPath, FileName);
00127 }
00128
00129
00130
00131
00132 GENESISAPI void geWorld_FreeMesh(geWorld *World, geMesh_Def *MeshDef)
00133 {
00134 assert(World != NULL);
00135 assert(MeshDef != NULL);
00136
00137 Sys_WorldFreeMesh(World,(Mesh_MeshDef*)MeshDef);
00138 }
00139
00140
00141
00142
00143 GENESISAPI geMesh *geWorld_AddMesh(geWorld *World, geMesh_Def *MeshDef, uint32 Flags, uint32 UserFlags)
00144 {
00145 return (geMesh*)Mesh_WorldAddMesh(World,(Mesh_MeshDef*)MeshDef, Flags, UserFlags);
00146 }
00147
00148
00149
00150
00151 GENESISAPI void geWorld_RemoveMesh(geWorld *World, geMesh *Mesh)
00152 {
00153 assert(World != NULL);
00154 assert(Mesh!= NULL);
00155
00156 Mesh_WorldRemoveMesh(World, (Mesh_RenderQ*)Mesh);
00157 }
00158
00159
00160
00161
00162 GENESISAPI geBoolean geWorld_SetMeshXForm(geWorld *World, geMesh *Mesh, const geXForm3d *XForm)
00163 {
00164 assert(World != NULL);
00165 assert(Mesh!= NULL);
00166 assert(XForm != NULL);
00167
00168 return Mesh_SetMeshXForm((Mesh_RenderQ*)Mesh, XForm);
00169 }
00170
00171
00172
00173
00174 GENESISAPI geBoolean geWorld_SetMeshFrame(geWorld *World, geMesh *Mesh, int32 Frame)
00175 {
00176 assert(World != NULL);
00177 assert(Mesh!= NULL);
00178
00179 return Mesh_SetMeshFrame((Mesh_RenderQ*)Mesh, Frame);
00180 }
00181
00182
00183
00184
00185 GENESISAPI geBoolean geWorld_GetMeshBox(geWorld *World, geMesh_Def *MeshDef, geVec3d *Mins, geVec3d *Maxs)
00186 {
00187 assert (World != NULL);
00188 assert (MeshDef != NULL);
00189 assert (Mins != NULL);
00190 assert (Maxs != NULL);
00191 return Mesh_MeshGetBox(World,(Mesh_MeshDef*)MeshDef, Mins, Maxs);
00192 }
00193
00194
00195
00196
00197 GENESISAPI int geWorld_GetMeshFrameCount(const geWorld *World, const geMesh *Mesh)
00198 {
00199 Mesh_RenderQ * mesh;
00200
00201 mesh = (Mesh_RenderQ *)Mesh;
00202 assert(mesh);
00203 assert(mesh->MeshDef);
00204 return (int)mesh->MeshDef->NumFrames;
00205 }
00206 #endif
00207
00208 #if 0
00209
00210
00211
00212 GENESISAPI geBoolean geWorld_SetModelXForm(geWorld *World, geWorld_Model *Model, const geXForm3d *XForm)
00213 {
00214 return World_SetModelXForm(World, Model, XForm);
00215 }
00216
00217 GENESISAPI geBoolean geWorld_ModelMotionGetTimeExtents(
00218 const GE_ModelMotion * M,
00219 GE_TimeType * StartTime,
00220 GE_TimeType * EndTime)
00221 {
00222 return geMotion_GetTimeExtents((const geMotion *)M, StartTime, EndTime);
00223 }
00224
00225 GENESISAPI GE_ModelMotion *geWorld_ModelGetMotion(geWorld_Model *Model)
00226 {
00227 return (GE_ModelMotion *)World_ModelGetMotion(Model);
00228 }
00229
00230 GENESISAPI void geWorld_ModelMotionSample(
00231 GE_ModelMotion * M,
00232 GE_TimeType Time,
00233 geXForm3d * XForm)
00234 {
00235 gePath * P;
00236
00237 P = geMotion_GetPath((const geMotion *)M, 0);
00238 assert(P);
00239 gePath_Sample(P, Time, XForm);
00240 }
00241
00242 GENESISAPI void * geWorld_ModelGetUserData(const geWorld_Model *Model)
00243 {
00244 return World_ModelGetUserData(Model);
00245 }
00246
00247 GENESISAPI void geWorld_ModelSetUserData(geWorld_Model *Model, void *UserData)
00248 {
00249 World_ModelSetUserData(Model, UserData);
00250 }
00251 #endif
00252
00253
00254
00255
00256 GENESISAPI geLight *geWorld_AddLight(geWorld *World)
00257 {
00258 assert(World != NULL);
00259
00260 return (geLight*)Light_WorldAddLight(World);
00261 }
00262
00263
00264
00265
00266 GENESISAPI void geWorld_RemoveLight(geWorld *World, geLight *Light)
00267 {
00268 assert(World != NULL);
00269 assert(Light != NULL);
00270
00271 Light_WorldRemoveLight(World, (Light_DLight*)Light);
00272 }
00273
00274
00275
00276
00277 GENESISAPI geBoolean geWorld_SetLightAttributes( geWorld *World,
00278 geLight *Light,
00279 const geVec3d *Pos,
00280 const GE_RGBA *RGBA,
00281 geFloat Radius,
00282 geBoolean CastShadow)
00283 {
00284 assert(World != NULL);
00285 assert(Light != NULL);
00286 assert(Pos != NULL);
00287 assert(RGBA != NULL);
00288
00289 return Light_SetAttributes((Light_DLight*)Light, Pos, RGBA, Radius, CastShadow);
00290 }
00291
00292
00293
00294
00295 GENESISAPI geBoolean geWorld_SetLTypeTable(geWorld *World, int32 LType, const char *Table)
00296 {
00297 assert(World != NULL);
00298 assert(Table != NULL);
00299
00300 return Light_WorldSetLTypeTable(World, LType, Table);
00301 }
00302
00303
00304
00305
00306 GENESISAPI geBoolean geWorld_TestModelMove( geWorld *World,
00307 geWorld_Model *Model,
00308 const geXForm3d *DXForm,
00309 const geVec3d *Mins, const geVec3d *Maxs,
00310 const geVec3d *In, geVec3d *Out)
00311 {
00312 return Trace_TestModelMove( World, Model, DXForm,
00313 Mins, Maxs,
00314 In, Out);
00315 }
00316
00317
00318
00319
00320 GENESISAPI geBoolean geWorld_ModelCollision(geWorld *World,
00321 geWorld_Model *Model,
00322 const geXForm3d *DXForm,
00323 GE_Collision *Collision)
00324 {
00325 Collision->Mesh = NULL;
00326 Collision->Actor = NULL;
00327 Collision->Model = NULL;
00328 return Trace_ModelCollision(World,
00329 Model,
00330 DXForm,
00331 Collision,
00332
00333 &Collision->Impact);
00334 }
00335
00336
00337
00338
00339
00340 GENESISAPI geBoolean geWorld_Collision(geWorld *World, const geVec3d *Mins, const geVec3d *Maxs, const geVec3d *Front, const geVec3d *Back, uint32 Contents, uint32 CollideFlags, uint32 UserFlags, GE_CollisionCB *CollisionCB, void *Context, GE_Collision *Col)
00341 {
00342 return Trace_GEWorldCollision(World, Mins, Maxs, Front, Back, Contents, CollideFlags, UserFlags, CollisionCB, Context, Col);
00343 }
00344
00345
00346
00347
00348 GENESISAPI geBoolean geWorld_GetContents(geWorld *World, const geVec3d *Pos, const geVec3d *Mins, const geVec3d *Maxs, uint32 Flags, uint32 UserFlags, GE_CollisionCB *CollisionCB, void *Context, GE_Contents *Contents)
00349 {
00350 return Trace_GetContents(World, Pos, Mins, Maxs, Flags, UserFlags, CollisionCB, Context, Contents);
00351 }
00352
00353
00354
00355
00356
00357
00358 GENESISAPI geBoolean geWorld_GetTextureName(geWorld *World, const geVec3d *Pos, const geVec3d *Mins, const geVec3d *Maxs, char *TexName)
00359 {
00360 return Trace_GetTexureName(World, Pos, Mins, Maxs, TexName);
00361 }
00362
00363
00364
00365
00366
00367
00368