Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
engine.h
Go to the documentation of this file.00001 /* 00002 Crystal Space 3D Engine 00003 Copyright (C) 1998-2002 by Jorrit Tyberghein 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_IENGINE_ENGINE_H__ 00021 #define __CS_IENGINE_ENGINE_H__ 00022 00031 #include "csutil/scf.h" 00032 #include "csgeom/vector3.h" 00033 #include "iengine/light.h" 00034 00035 class csEngine; 00036 class csVector3; 00037 class csFrustum; 00038 class csMatrix3; 00039 class csColor; 00040 class csBox3; 00041 struct csTextureLayer; 00042 00043 struct iSector; 00044 struct iFrustumView; 00045 struct iSectorIterator; 00046 struct iObjectIterator; 00047 struct iLight; 00048 struct iLightIterator; 00049 struct iSprite; 00050 struct iMeshWrapperIterator; 00051 struct iMeshObject; 00052 struct iMeshObjectFactory; 00053 struct iMeshWrapper; 00054 struct iMeshFactoryWrapper; 00055 struct iMeshObjectType; 00056 struct iMaterial; 00057 struct iMaterialWrapper; 00058 struct iMaterialList; 00059 struct iTextureWrapper; 00060 struct iTextureHandle; 00061 struct iTextureList; 00062 struct iCameraPosition; 00063 struct iCameraPositionList; 00064 struct iRegion; 00065 struct iPortal; 00066 struct iGraphics3D; 00067 struct iClipper2D; 00068 struct iObject; 00069 struct iObjectWatcher; 00070 struct iCollection; 00071 struct iCollectionList; 00072 struct iDataBuffer; 00073 struct iCamera; 00074 struct iRenderView; 00075 struct iSectorList; 00076 struct iMeshList; 00077 struct iMeshFactoryList; 00078 struct iProgressMeter; 00079 struct iRegionList; 00080 struct iLoaderContext; 00081 struct iCacheManager; 00082 struct iSharedVariableList; 00083 struct iRenderLoopManager; 00084 struct iRenderLoop; 00085 struct iEngine; 00086 00092 #define CS_ENGINE_CACHE_READ 1 00093 00097 #define CS_ENGINE_CACHE_WRITE 2 00098 00102 #define CS_ENGINE_CACHE_NOUPDATE 4 00103 00110 #define CS_RENDPRI_NONE 0 00111 00115 #define CS_RENDPRI_BACK2FRONT 1 00116 00120 #define CS_RENDPRI_FRONT2BACK 2 00121 00124 SCF_VERSION (iEngineSectorCallback, 0, 0, 1); 00125 00130 struct iEngineSectorCallback : public iBase 00131 { 00135 virtual void NewSector (iEngine* engine, iSector* sector) = 0; 00136 00140 virtual void RemoveSector (iEngine* engine, iSector* sector) = 0; 00141 }; 00142 00143 00144 SCF_VERSION (iEngine, 0, 23, 1); 00145 00164 struct iEngine : public iBase 00165 { 00167 virtual iObject *QueryObject() = 0; 00168 00184 virtual bool Prepare (iProgressMeter* meter = 0) = 0; 00185 00201 virtual void ForceRelight (iRegion* region = 0, 00202 iProgressMeter* meter = 0) = 0; 00203 00216 virtual void ForceRelight (iLight* light, iRegion* region = 0) = 0; 00217 00228 virtual void RemoveLight (iLight* light) = 0; 00229 00237 virtual void PrepareTextures () = 0; 00238 00244 virtual void PrepareMeshes () = 0; 00245 00256 virtual void ShineLights (iRegion* region = 0, 00257 iProgressMeter* meter = 0) = 0; 00258 00263 virtual int GetTextureFormat () const = 0; 00264 00266 virtual void DeleteAll () = 0; 00267 00289 virtual void RegisterRenderPriority (const char* name, long priority, 00290 int rendsort = CS_RENDPRI_NONE) = 0; 00291 00299 virtual long GetRenderPriority (const char* name) const = 0; 00301 virtual int GetRenderPrioritySorting (const char* name) const = 0; 00303 virtual int GetRenderPrioritySorting (long priority) const = 0; 00305 virtual long GetSkyRenderPriority () = 0; 00307 virtual long GetPortalRenderPriority () = 0; 00309 virtual long GetWallRenderPriority () = 0; 00311 virtual long GetObjectRenderPriority () = 0; 00313 virtual long GetAlphaRenderPriority () = 0; 00315 virtual void ClearRenderPriorities () = 0; 00317 virtual int GetRenderPriorityCount () const = 0; 00319 virtual const char* GetRenderPriorityName (long priority) const = 0; 00320 00330 virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt) = 0; 00331 00347 virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt, 00348 int num_layers, iTextureWrapper** wrappers, csTextureLayer* layers) = 0; 00349 00368 virtual iTextureWrapper* CreateTexture (const char *name, 00369 const char *fileName, csColor *transp, int flags) = 0; 00370 00381 virtual iTextureWrapper* CreateBlackTexture (const char *name, 00382 int w, int h, csColor *transp, int flags) = 0; 00383 00389 virtual iMaterialWrapper* CreateMaterial (const char *name, 00390 iTextureWrapper* texture) = 0; 00395 virtual iSector *CreateSector (const char *name) = 0; 00396 00401 virtual void AddEngineSectorCallback (iEngineSectorCallback* cb) = 0; 00402 00406 virtual void RemoveEngineSectorCallback (iEngineSectorCallback* cb) = 0; 00407 00418 virtual csPtr<iMeshWrapper> CreateSectorWallsMesh (iSector* sector, 00419 const char* name) = 0; 00420 00430 virtual csPtr<iMeshWrapper> CreateThingMesh (iSector* sector, 00431 const char* name) = 0; 00432 00434 virtual iSectorList* GetSectors () = 0; 00436 virtual iMeshFactoryList* GetMeshFactories () = 0; 00438 virtual iMeshList* GetMeshes () = 0; 00440 virtual iCollectionList* GetCollections () = 0; 00442 virtual iCameraPositionList* GetCameraPositions () = 0; 00444 virtual iTextureList* GetTextureList () const = 0; 00446 virtual iMaterialList* GetMaterialList () const = 0; 00448 virtual iSharedVariableList* GetVariableList () const = 0; 00449 00454 virtual void AddMeshAndChildren (iMeshWrapper* mesh) = 0; 00455 00462 virtual iRegion* CreateRegion (const char* name) = 0; 00464 virtual iRegionList* GetRegions () = 0; 00465 00478 virtual iMaterialWrapper* FindMaterial (const char* name, 00479 iRegion* region = 0) = 0; 00492 virtual iTextureWrapper* FindTexture (const char* name, 00493 iRegion* region = 0) = 0; 00494 00507 virtual iSector* FindSector (const char* name, 00508 iRegion* region = 0) = 0; 00509 00522 virtual iMeshWrapper* FindMeshObject (const char* name, 00523 iRegion* region = 0) = 0; 00536 virtual iMeshFactoryWrapper* FindMeshFactory (const char* name, 00537 iRegion* region = 0) = 0; 00550 virtual iCameraPosition* FindCameraPosition (const char* name, 00551 iRegion* region = 0) = 0; 00564 virtual iCollection* FindCollection (const char* name, 00565 iRegion* region = 0) = 0; 00566 00580 virtual void SetLightingCacheMode (int mode) = 0; 00581 00583 virtual int GetLightingCacheMode () = 0; 00584 00597 virtual void SetClearZBuf (bool yesno) = 0; 00598 00602 virtual bool GetClearZBuf () const = 0; 00603 00605 virtual bool GetDefaultClearZBuf () const = 0; 00606 00619 virtual void SetClearScreen (bool yesno) = 0; 00620 00624 virtual bool GetClearScreen () const = 0; 00625 00627 virtual bool GetDefaultClearScreen () const = 0; 00628 00635 virtual void SetMaxLightmapSize(int w, int h) = 0; 00636 00641 virtual void GetMaxLightmapSize(int& w, int& h) = 0; 00642 00647 virtual void GetDefaultMaxLightmapSize(int& w, int& h) = 0; 00648 00650 virtual int GetMaxLightmapAspectRatio () const = 0; 00651 00659 virtual void ResetWorldSpecificSettings() = 0; 00660 00665 virtual csPtr<iCamera> CreateCamera () = 0; 00666 00688 virtual csPtr<iLight> CreateLight (const char* name, const csVector3& pos, 00689 float radius, const csColor& color, 00690 csLightDynamicType dyntype = CS_LIGHT_DYNAMICTYPE_STATIC) = 0; 00691 00696 virtual iLight* FindLight (const char *Name, bool RegionOnly = false) 00697 const = 0; 00698 00703 virtual iLight* FindLightID (const char* light_id) const = 0; 00704 00711 virtual csPtr<iLightIterator> GetLightIterator (iRegion* region = 0) = 0; 00712 00719 virtual int GetBeginDrawFlags () const = 0; 00720 00724 virtual iRenderView* GetTopLevelClipper () const = 0; 00725 00739 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* classId, 00740 const char* name) = 0; 00741 00749 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory ( 00750 iMeshObjectFactory * factory, const char* name) = 0; 00751 00757 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* name) = 0; 00758 00767 virtual csPtr<iLoaderContext> CreateLoaderContext ( 00768 iRegion* region = 0, bool curRegOnly = true) = 0; 00769 00777 virtual csPtr<iMeshFactoryWrapper> LoadMeshFactory ( 00778 const char* name, const char* loaderClassId, 00779 iDataBuffer* input) = 0; 00780 00794 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshFactoryWrapper* factory, 00795 const char* name, iSector* sector = 0, 00796 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00797 00810 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshObject* meshobj, 00811 const char* name, iSector* sector = 0, 00812 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00813 00833 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* classid, 00834 const char* name, iSector* sector = 0, 00835 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00836 00841 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* name) = 0; 00842 00857 virtual csPtr<iMeshWrapper> LoadMeshWrapper ( 00858 const char* name, const char* loaderClassId, 00859 iDataBuffer* input, iSector* sector, const csVector3& pos) = 0; 00860 00874 virtual csPtr<iMeshWrapper> CreatePortalContainer (const char* name, 00875 iSector* sector = 0, const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00876 00896 virtual csPtr<iMeshWrapper> CreatePortal ( 00897 const char* name, 00898 iMeshWrapper* parentMesh, iSector* destSector, 00899 csVector3* vertices, int num_vertices, 00900 iPortal*& portal) = 0; 00901 00921 virtual csPtr<iMeshWrapper> CreatePortal ( 00922 const char* name, 00923 iSector* sourceSector, const csVector3& pos, 00924 iSector* destSector, 00925 csVector3* vertices, int num_vertices, 00926 iPortal*& portal) = 0; 00927 00936 virtual void PrecacheDraw (iRegion* region = 0) = 0; 00937 00945 virtual void Draw (iCamera* c, iClipper2D* clipper) = 0; 00946 00952 virtual void SetContext (iTextureHandle* ctxt) = 0; 00954 virtual iTextureHandle *GetContext () const = 0; 00955 00960 virtual void SetAmbientLight (const csColor &) = 0; 00962 virtual void GetAmbientLight (csColor &) const = 0; 00963 00975 virtual int GetNearbyLights (iSector* sector, const csVector3& pos, 00976 iLight** lights, int max_num_lights) = 0; 00977 00989 virtual int GetNearbyLights (iSector* sector, const csBox3& box, 00990 iLight** lights, int max_num_lights) = 0; 00991 00997 virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector, 00998 const csVector3& pos, float radius) = 0; 00999 01012 virtual csPtr<iObjectIterator> GetNearbyObjects (iSector* sector, 01013 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 01014 01021 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 01022 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 01023 01033 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01034 const csVector3& pos) = 0; 01035 01042 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01043 const csVector3& pos) = 0; 01044 01054 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01055 const csFrustum& frustum) = 0; 01056 01063 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01064 const csFrustum& frustum) = 0; 01065 01081 virtual bool RemoveObject (iBase* object) = 0; 01082 01090 virtual void SetCacheManager (iCacheManager* cache_mgr) = 0; 01091 01095 virtual iCacheManager* GetCacheManager () = 0; 01096 01098 virtual void GetDefaultAmbientLight (csColor &c) const = 0; 01099 01106 virtual csPtr<iFrustumView> CreateFrustumView () = 0; 01107 01112 virtual csPtr<iObjectWatcher> CreateObjectWatcher () = 0; 01113 01120 virtual void WantToDie (iMeshWrapper* mesh) = 0; 01121 01122 // ====================================================================== 01123 // Render loop stuff 01124 // ====================================================================== 01125 01130 virtual iRenderLoopManager* GetRenderLoopManager () = 0; 01131 01145 virtual iRenderLoop* GetCurrentDefaultRenderloop () = 0; 01146 01153 virtual bool SetCurrentDefaultRenderloop (iRenderLoop* loop) = 0; 01154 01158 virtual uint GetCurrentFrameNumber () const = 0; 01159 01169 virtual void SetSaveableFlag (bool enable) = 0; 01173 virtual bool GetSaveableFlag () = 0; 01174 }; 01175 01178 #endif // __CS_IENGINE_ENGINE_H__
Generated for Crystal Space by doxygen 1.3.9.1