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 iSectorIterator;
00034 struct iObjectIterator;
00035 struct iLight;
00036 struct iStatLight;
00037 struct iDynLight;
00038 struct iSprite;
00039 struct iMeshObject;
00040 struct iMeshObjectFactory;
00041 struct iMeshWrapper;
00042 struct iMeshFactoryWrapper;
00043 struct iMeshObjectType;
00044 struct iMaterial;
00045 struct iMaterialWrapper;
00046 struct iMaterialList;
00047 struct iTextureWrapper;
00048 struct iTextureList;
00049 struct iCameraPosition;
00050 struct iCameraPositionList;
00051 struct iRegion;
00052 struct iGraphics3D;
00053 struct iClipper2D;
00054 struct iObject;
00055 struct iCollection;
00056 struct iCollectionList;
00057 struct iDataBuffer;
00058 struct iCamera;
00059 struct iRenderView;
00060 struct iSectorList;
00061 struct iMeshList;
00062 struct iMeshFactoryList;
00063 struct iProgressMeter;
00064 struct iRegionList;
00065 struct iLoaderContext;
00066 struct iCacheManager;
00067
00073 #define CS_NLIGHT_SHADOWS 1
00074
00079 #define CS_NLIGHT_STATIC 2
00080
00085 #define CS_NLIGHT_DYNAMIC 4
00086
00091 #define CS_NLIGHT_NEARBYSECTORS 8
00092
00093
00098 #define CS_ENGINE_AUTODETECT 0
00099
00105 #define CS_ENGINE_BACK2FRONT 1
00106
00111 #define CS_ENGINE_FRONT2BACK 2
00112
00117 #define CS_ENGINE_ZBUFFER 3
00118
00123 #define CS_ENGINE_CACHE_READ 1
00124
00129 #define CS_ENGINE_CACHE_WRITE 2
00130
00134 #define CS_RENDPRI_NONE 0
00135
00139 #define CS_RENDPRI_BACK2FRONT 1
00140
00144 #define CS_RENDPRI_FRONT2BACK 2
00145
00150 #define CS_CALLBACK_SECTOR 1
00151 #define CS_CALLBACK_SECTOREXIT 2
00152 #define CS_CALLBACK_MESH 3
00153 #define CS_CALLBACK_VISMESH 4
00154
00155 SCF_VERSION (iDrawFuncCallback, 0, 0, 1);
00156
00160 struct iDrawFuncCallback : public iBase
00161 {
00172 virtual void DrawFunc (iRenderView* rview, int type, void* entity) = 0;
00173 };
00174
00175
00176 SCF_VERSION (iEngine, 0, 7, 5);
00177
00183 struct iEngine : public iBase
00184 {
00189 virtual csEngine *GetCsEngine () = 0;
00190
00192 virtual iObject *QueryObject() = 0;
00193
00202 virtual bool Prepare (iProgressMeter* meter = NULL) = 0;
00203
00211 virtual void PrepareTextures () = 0;
00212
00218 virtual void PrepareMeshes () = 0;
00219
00226 virtual void ShineLights (iRegion* region = NULL,
00227 iProgressMeter* meter = NULL) = 0;
00228
00233 virtual int GetTextureFormat () const = 0;
00234
00238 virtual bool IsPVS () const = 0;
00239
00244 virtual void SelectRegion (const char* name) = 0;
00249 virtual void SelectRegion (iRegion* region) = 0;
00254 virtual iRegion* GetCurrentRegion () const = 0;
00255
00257 virtual void DeleteAll () = 0;
00258
00270 virtual void RegisterRenderPriority (const char* name, long priority,
00271 int rendsort = CS_RENDPRI_NONE) = 0;
00273 virtual long GetRenderPriority (const char* name) const = 0;
00275 virtual int GetRenderPrioritySorting (const char* name) const = 0;
00277 virtual int GetRenderPrioritySorting (long priority) const = 0;
00279 virtual long GetSkyRenderPriority () const = 0;
00281 virtual long GetWallRenderPriority () const = 0;
00283 virtual long GetObjectRenderPriority () const = 0;
00285 virtual long GetAlphaRenderPriority () const = 0;
00287 virtual void ClearRenderPriorities () = 0;
00288
00293 virtual iMaterial* CreateBaseMaterial (iTextureWrapper* txt) = 0;
00294
00299 virtual iMaterial* CreateBaseMaterial (iTextureWrapper* txt,
00300 int num_layers, iTextureWrapper** wrappers, csTextureLayer* layers) = 0;
00301
00303 virtual iTextureWrapper* CreateTexture (const char *name,
00304 const char *fileName, csColor *transp, int flags) = 0;
00306 virtual iMaterialWrapper* CreateMaterial (const char *name,
00307 iTextureWrapper* texture) = 0;
00311 virtual iSector *CreateSector (const char *name) = 0;
00312
00320 virtual iMeshWrapper* CreateSectorWallsMesh (iSector* sector,
00321 const char* name) = 0;
00322
00324 virtual iSectorList* GetSectors () = 0;
00326 virtual iMeshFactoryList* GetMeshFactories () = 0;
00328 virtual iMeshList* GetMeshes () = 0;
00330 virtual iCollectionList* GetCollections () = 0;
00332 virtual iCameraPositionList* GetCameraPositions () = 0;
00334 virtual iTextureList* GetTextureList () const = 0;
00336 virtual iMaterialList* GetMaterialList () const = 0;
00338 virtual iRegionList* GetRegions () = 0;
00339
00350 virtual iMaterialWrapper* FindMaterial (const char* name,
00351 iRegion* region = NULL) = 0;
00362 virtual iTextureWrapper* FindTexture (const char* name,
00363 iRegion* region = NULL) = 0;
00374 virtual iSector* FindSector (const char* name,
00375 iRegion* region = NULL) = 0;
00386 virtual iMeshWrapper* FindMeshObject (const char* name,
00387 iRegion* region = NULL) = 0;
00398 virtual iMeshFactoryWrapper* FindMeshFactory (const char* name,
00399 iRegion* region = NULL) = 0;
00410 virtual iCameraPosition* FindCameraPosition (const char* name,
00411 iRegion* region = NULL) = 0;
00422 virtual iCollection* FindCollection (const char* name,
00423 iRegion* region = NULL) = 0;
00424
00433 virtual void SetLightingCacheMode (int mode) = 0;
00435 virtual int GetLightingCacheMode () = 0;
00436
00438 virtual int GetLightmapCellSize () const = 0;
00440 virtual void SetLightmapCellSize (int Size) = 0;
00442 virtual int GetDefaultLightmapCellSize () const = 0;
00443
00454 virtual void SetClearZBuf (bool yesno) = 0;
00455
00459 virtual bool GetClearZBuf () const = 0;
00461 virtual bool GetDefaultClearZBuf () const = 0;
00462
00467 virtual void SetMaxLightmapSize(int w, int h) = 0;
00469 virtual void GetMaxLightmapSize(int& w, int& h) = 0;
00471 virtual void GetDefaultMaxLightmapSize(int& w, int& h) = 0;
00472
00480 virtual void ResetWorldSpecificSettings() = 0;
00481
00483 virtual iCamera* CreateCamera () = 0;
00485 virtual iStatLight* CreateLight (const char* name, const csVector3& pos,
00486 float radius, const csColor& color, bool pseudoDyn) = 0;
00488 virtual iStatLight* FindLight (const char *Name, bool RegionOnly = false)
00489 const = 0;
00491 virtual iDynLight* CreateDynLight (const csVector3& pos, float radius,
00492 const csColor& color) = 0;
00494 virtual void RemoveDynLight (iDynLight*) = 0;
00495
00502 virtual int GetBeginDrawFlags () const = 0;
00503
00518 virtual void SetEngineMode (int mode) = 0;
00519
00525 virtual int GetEngineMode () const = 0;
00526
00530 virtual iClipper2D* GetTopLevelClipper () const = 0;
00531
00542 virtual iMeshFactoryWrapper* CreateMeshFactory (const char* classId,
00543 const char* name) = 0;
00544
00546 virtual iMeshFactoryWrapper* CreateMeshFactory (iMeshObjectFactory *,
00547 const char* name) = 0;
00548
00550 virtual iMeshFactoryWrapper* CreateMeshFactory (const char* name) = 0;
00551
00559 virtual iLoaderContext* CreateLoaderContext (iRegion* region = NULL) = 0;
00560
00564 virtual iMeshFactoryWrapper* LoadMeshFactory (
00565 const char* name, const char* loaderClassId,
00566 iDataBuffer* input) = 0;
00567
00575 virtual iMeshWrapper* CreateMeshWrapper (iMeshFactoryWrapper* factory,
00576 const char* name, iSector* sector = NULL,
00577 const csVector3& pos = csVector3(0, 0, 0)) = 0;
00579 virtual iMeshWrapper* CreateMeshWrapper (iMeshObject*,
00580 const char* name, iSector* sector = NULL,
00581 const csVector3& pos = csVector3(0, 0, 0)) = 0;
00583 virtual iMeshWrapper* CreateMeshWrapper (const char* name) = 0;
00588 virtual iMeshWrapper* LoadMeshWrapper (
00589 const char* name, const char* loaderClassId,
00590 iDataBuffer* input, iSector* sector, const csVector3& pos) = 0;
00591
00596 virtual iMeshObjectType* GetThingType () const = 0;
00597
00605 virtual void Draw (iCamera* c, iClipper2D* clipper) = 0;
00606
00614 virtual void DrawFunc (iCamera* c, iClipper2D* clipper,
00615 iDrawFuncCallback* callback) = 0;
00616
00618 virtual void SetContext (iGraphics3D*) = 0;
00620 virtual iGraphics3D *GetContext () const = 0;
00621
00626 virtual void SetAmbientLight (const csColor &) = 0;
00628 virtual void GetAmbientLight (csColor &) const = 0;
00629
00649 virtual int GetNearbyLights (iSector* sector, const csVector3& pos,
00650 uint32 flags, iLight** lights, int max_num_lights) = 0;
00651
00657 virtual iSectorIterator* GetNearbySectors (iSector* sector,
00658 const csVector3& pos, float radius) = 0;
00659
00667 virtual iObjectIterator* GetNearbyObjects (iSector* sector,
00668 const csVector3& pos, float radius) = 0;
00669
00687 virtual bool RemoveObject (iBase* object) = 0;
00688
00696 virtual void SetCacheManager (iCacheManager* cache_mgr) = 0;
00697
00701 virtual iCacheManager* GetCacheManager () = 0;
00702 };
00703
00704 #endif // __IENGINE_ENGINE_H__