00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __IENGINE_ENGINE_H__
00021 #define __IENGINE_ENGINE_H__
00022
00023 #include "csutil/scf.h"
00024 #include "csgeom/vector3.h"
00025
00026 class csEngine;
00027 class csVector3;
00028 class csMatrix3;
00029 class csColor;
00030 struct csTextureLayer;
00031
00032 struct iSector;
00033 struct iStatLight;
00034 struct iDynLight;
00035 struct iSprite;
00036 struct iMeshObject;
00037 struct iMeshObjectFactory;
00038 struct iMeshWrapper;
00039 struct iMeshFactoryWrapper;
00040 struct iMeshObjectType;
00041 struct iMaterial;
00042 struct iMaterialWrapper;
00043 struct iMaterialList;
00044 struct iTextureWrapper;
00045 struct iTextureList;
00046 struct iCameraPosition;
00047 struct iCameraPositionList;
00048 struct iRegion;
00049 struct iGraphics3D;
00050 struct iClipper2D;
00051 struct iObject;
00052 struct iCollection;
00053 struct iCollectionList;
00054 struct iDataBuffer;
00055 struct iCamera;
00056 struct iRenderView;
00057 struct iSectorList;
00058 struct iMeshList;
00059 struct iMeshFactoryList;
00060 struct iProgressMeter;
00061
00067 #define CS_NLIGHT_SHADOWS 1
00068
00073 #define CS_NLIGHT_STATIC 2
00074
00079 #define CS_NLIGHT_DYNAMIC 4
00080
00085 #define CS_NLIGHT_NEARBYSECTORS 8
00086
00087
00092 #define CS_ENGINE_AUTODETECT 0
00093
00099 #define CS_ENGINE_BACK2FRONT 1
00100
00105 #define CS_ENGINE_FRONT2BACK 2
00106
00111 #define CS_ENGINE_ZBUFFER 3
00112
00117 #define CS_ENGINE_CACHE_READ 1
00118
00123 #define CS_ENGINE_CACHE_WRITE 2
00124
00129 #define CS_CALLBACK_SECTOR 1
00130 #define CS_CALLBACK_SECTOREXIT 2
00131 #define CS_CALLBACK_MESH 3
00132 #define CS_CALLBACK_VISMESH 4
00133
00134 SCF_VERSION (iDrawFuncCallback, 0, 0, 1);
00135
00139 struct iDrawFuncCallback : public iBase
00140 {
00142 virtual void DrawFunc (iRenderView* rview, int type, void* entity) = 0;
00143 };
00144
00145
00146 SCF_VERSION (iEngine, 0, 6, 2);
00147
00153 struct iEngine : public iBase
00154 {
00159 virtual csEngine *GetCsEngine () = 0;
00160
00162 virtual iObject *QueryObject() = 0;
00163
00172 virtual bool Prepare (iProgressMeter* meter = NULL) = 0;
00173
00180 virtual void ShineLights (iRegion* region = NULL,
00181 iProgressMeter* meter = NULL) = 0;
00182
00187 virtual int GetTextureFormat () const = 0;
00188
00192 virtual bool IsPVS () const = 0;
00193
00198 virtual void SelectRegion (const char* iName) = 0;
00203 virtual void SelectRegion (iRegion* region) = 0;
00208 virtual iRegion* GetCurrentRegion () const = 0;
00210 virtual iRegion* FindRegion (const char *name) const = 0;
00211
00213 virtual void DeleteAll () = 0;
00214
00216 virtual void RegisterRenderPriority (const char* name, long priority) = 0;
00218 virtual long GetRenderPriority (const char* name) const = 0;
00220 virtual long GetSkyRenderPriority () const = 0;
00222 virtual long GetWallRenderPriority () const = 0;
00224 virtual long GetObjectRenderPriority () const = 0;
00226 virtual long GetAlphaRenderPriority () const = 0;
00228 virtual void ClearRenderPriorities () = 0;
00229
00234 virtual iMaterial* CreateBaseMaterial (iTextureWrapper* txt) = 0;
00235
00240 virtual iMaterial* CreateBaseMaterial (iTextureWrapper* txt,
00241 int num_layers, iTextureWrapper** wrappers, csTextureLayer* layers) = 0;
00242
00244 virtual iTextureWrapper* CreateTexture (const char *iName,
00245 const char *iFileName, csColor *iTransp, int iFlags) = 0;
00247 virtual iMaterialWrapper* CreateMaterial (const char *iName,
00248 iTextureWrapper* texture) = 0;
00253 virtual iSector *CreateSector (const char *iName, bool link = true) = 0;
00254
00261 virtual iMeshWrapper* CreateSectorWallsMesh (iSector* sector,
00262 const char* name) = 0;
00263
00265 virtual iSectorList* GetSectors () = 0;
00267 virtual iMeshFactoryList* GetMeshFactories () = 0;
00269 virtual iMeshList* GetMeshes () = 0;
00271 virtual iCollectionList* GetCollections () = 0;
00273 virtual iCameraPositionList* GetCameraPositions () = 0;
00275 virtual iTextureList* GetTextureList () const = 0;
00277 virtual iMaterialList* GetMaterialList () const = 0;
00278
00283 virtual void SetLightingCacheMode (int mode) = 0;
00285 virtual int GetLightingCacheMode () = 0;
00286
00288 virtual int GetLightmapCellSize () const = 0;
00290 virtual void SetLightmapCellSize (int Size) = 0;
00291
00293 virtual iCamera* CreateCamera () = 0;
00295 virtual iStatLight* CreateLight (const char* name, const csVector3& pos,
00296 float radius, const csColor& color, bool pseudoDyn) = 0;
00298 virtual iDynLight* CreateDynLight (const csVector3& pos, float radius,
00299 const csColor& color) = 0;
00301 virtual void RemoveDynLight (iDynLight*) = 0;
00302
00308 virtual int GetBeginDrawFlags () const = 0;
00309
00317 virtual void SetEngineMode (int mode) = 0;
00318
00324 virtual int GetEngineMode () const = 0;
00325
00329 virtual iClipper2D* GetTopLevelClipper () const = 0;
00330
00341 virtual iMeshFactoryWrapper* CreateMeshFactory (const char* classId,
00342 const char* name) = 0;
00343
00345 virtual iMeshFactoryWrapper* CreateMeshFactory (iMeshObjectFactory *,
00346 const char* name) = 0;
00347
00349 virtual iMeshFactoryWrapper* CreateMeshFactory (const char* name) = 0;
00350
00354 virtual iMeshFactoryWrapper* LoadMeshFactory (
00355 const char* classId, const char* name,
00356 const char* loaderClassId,
00357 iDataBuffer* input) = 0;
00358
00366 virtual iMeshWrapper* CreateMeshWrapper (iMeshFactoryWrapper* factory,
00367 const char* name, iSector* sector = NULL,
00368 const csVector3& pos = csVector3(0, 0, 0)) = 0;
00370 virtual iMeshWrapper* CreateMeshWrapper (iMeshObject*,
00371 const char* name, iSector* sector = NULL,
00372 const csVector3& pos = csVector3(0, 0, 0)) = 0;
00374 virtual iMeshWrapper* CreateMeshWrapper (const char* name) = 0;
00379 virtual iMeshWrapper* LoadMeshWrapper (
00380 const char* classId, const char* name,
00381 const char* loaderClassId,
00382 iDataBuffer* input, iSector* sector, const csVector3& pos) = 0;
00383
00385 virtual iMeshObjectType* GetThingType () const = 0;
00386
00394 virtual void Draw (iCamera* c, iClipper2D* clipper) = 0;
00395
00403 virtual void DrawFunc (iCamera* c, iClipper2D* clipper,
00404 iDrawFuncCallback* callback) = 0;
00405
00407 virtual void SetContext (iGraphics3D*) = 0;
00409 virtual iGraphics3D *GetContext () const = 0;
00410
00415 virtual void SetAmbientLight (const csColor &) = 0;
00417 virtual void GetAmbientLight (csColor &) const = 0;
00418 };
00419
00420 #endif // __IENGINE_ENGINE_H__