iengine/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_interface.h" 00032 00033 #include "csgeom/vector3.h" 00034 00035 #include "iengine/collection.h" 00036 #include "iengine/light.h" 00037 00038 class csBox3; 00039 class csColor; 00040 class csFrustum; 00041 00042 struct iCacheManager; 00043 struct iCamera; 00044 struct iCameraPosition; 00045 struct iCameraPositionList; 00046 struct iClipper2D; 00047 struct iDataBuffer; 00048 struct iFrustumView; 00049 struct iLight; 00050 struct iLightIterator; 00051 struct iLoaderContext; 00052 struct iMaterial; 00053 struct iMaterialList; 00054 struct iMaterialWrapper; 00055 struct iMeshFactoryList; 00056 struct iMeshFactoryWrapper; 00057 struct iMeshList; 00058 struct iMeshObject; 00059 struct iMeshObjectFactory; 00060 struct iMeshObjectType; 00061 struct iMeshWrapper; 00062 struct iMeshWrapperIterator; 00063 struct iObject; 00064 struct iObjectIterator; 00065 struct iObjectWatcher; 00066 struct iPortal; 00067 struct iProgressMeter; 00068 struct iRegion; 00069 struct iRegionList; 00070 struct iRenderLoop; 00071 struct iRenderLoopManager; 00072 struct iRenderView; 00073 struct iSector; 00074 struct iSectorIterator; 00075 struct iSectorList; 00076 struct iSharedVariableList; 00077 struct iTextureHandle; 00078 struct iTextureList; 00079 struct iTextureWrapper; 00080 00081 struct iEngine; 00082 00088 #define CS_ENGINE_CACHE_READ 1 00089 00093 #define CS_ENGINE_CACHE_WRITE 2 00094 00098 #define CS_ENGINE_CACHE_NOUPDATE 4 00099 00103 enum csRenderPrioritySorting 00104 { 00108 CS_RENDPRI_SORT_NONE = 0, 00109 00113 CS_RENDPRI_SORT_BACK2FRONT = 1, 00114 00118 CS_RENDPRI_SORT_FRONT2BACK = 2 00119 }; 00130 struct iEngineFrameCallback : public virtual iBase 00131 { 00132 SCF_INTERFACE(iEngineFrameCallback,1,0,0); 00136 virtual void StartFrame (iEngine* engine, iRenderView* rview) = 0; 00137 }; 00138 00146 struct iEngineSectorCallback : public virtual iBase 00147 { 00148 SCF_INTERFACE(iEngineSectorCallback,2,0,0); 00152 virtual void NewSector (iEngine* engine, iSector* sector) = 0; 00153 00157 virtual void RemoveSector (iEngine* engine, iSector* sector) = 0; 00158 }; 00159 00160 00175 struct iEngine : public virtual iBase 00176 { 00177 SCF_INTERFACE(iEngine, 4, 0, 0); 00178 00180 virtual iObject *QueryObject() = 0; 00181 00202 virtual bool Prepare (iProgressMeter* meter = 0) = 0; 00203 00211 virtual void PrepareTextures () = 0; 00212 00218 virtual void PrepareMeshes () = 0; 00219 00235 virtual void ForceRelight (iRegion* region = 0, 00236 iProgressMeter* meter = 0) = 0; 00237 00250 virtual void ForceRelight (iLight* light, iRegion* region = 0) = 0; 00251 00262 virtual void ShineLights (iBase* base = 0, 00263 iProgressMeter* meter = 0) = 0; 00264 00277 virtual void SetLightingCacheMode (int mode) = 0; 00278 00280 virtual int GetLightingCacheMode () = 0; 00281 00294 virtual void SetCacheManager (iCacheManager* cache_mgr) = 0; 00295 00302 virtual void SetVFSCacheManager (const char* vfspath = 0) = 0; 00303 00307 virtual iCacheManager* GetCacheManager () = 0; 00308 00316 CS_DEPRECATED_METHOD_MSG("Since thing meshes are deprecated SetMaxLightmapSize() is too.") 00317 virtual void SetMaxLightmapSize (int w, int h) = 0; 00318 00325 CS_DEPRECATED_METHOD_MSG("Since thing meshes are deprecated GetMaxLightmapSize() is too.") 00326 virtual void GetMaxLightmapSize (int& w, int& h) = 0; 00327 00333 CS_DEPRECATED_METHOD_MSG("Since thing meshes are deprecated GetDefaultMaxLightmapSize() is too.") 00334 virtual void GetDefaultMaxLightmapSize (int& w, int& h) = 0; 00335 00340 CS_DEPRECATED_METHOD_MSG("Since thing meshes are deprecated GetMaxLightmapAspectRatio() is too.") 00341 virtual int GetMaxLightmapAspectRatio () const = 0; 00342 00380 virtual void RegisterRenderPriority (const char* name, long priority, 00381 csRenderPrioritySorting rendsort = CS_RENDPRI_SORT_NONE) = 0; 00382 00389 virtual long GetRenderPriority (const char* name) const = 0; 00391 virtual csRenderPrioritySorting GetRenderPrioritySorting ( 00392 const char* name) const = 0; 00394 virtual csRenderPrioritySorting GetRenderPrioritySorting ( 00395 long priority) const = 0; 00397 virtual long GetSkyRenderPriority () = 0; 00399 virtual long GetPortalRenderPriority () = 0; 00401 virtual long GetWallRenderPriority () = 0; 00403 virtual long GetObjectRenderPriority () = 0; 00405 virtual long GetAlphaRenderPriority () = 0; 00407 virtual void ClearRenderPriorities () = 0; 00409 virtual int GetRenderPriorityCount () const = 0; 00411 virtual const char* GetRenderPriorityName (long priority) const = 0; 00412 00427 virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt) = 0; 00428 00434 virtual iMaterialWrapper* CreateMaterial (const char *name, 00435 iTextureWrapper* texture) = 0; 00436 00438 virtual iMaterialList* GetMaterialList () const = 0; 00439 00453 virtual iMaterialWrapper* FindMaterial (const char* name, 00454 iBase* base = 0) = 0; 00455 00456 CS_DEPRECATED_METHOD_MSG("Regions are deprecated. Use Collections instead.") 00457 virtual iMaterialWrapper* FindMaterialRegion (const char* name, 00458 iRegion* region) = 0; 00459 00460 virtual iMaterialWrapper* FindMaterialCollection (const char* name, 00461 iCollection* collection = 0) = 0; 00462 00484 virtual iTextureWrapper* CreateTexture (const char *name, 00485 const char *fileName, csColor *transp, int flags) = 0; 00486 00497 virtual iTextureWrapper* CreateBlackTexture (const char *name, 00498 int w, int h, csColor *transp, int flags) = 0; 00499 00504 virtual int GetTextureFormat () const = 0; 00505 00507 virtual iTextureList* GetTextureList () const = 0; 00508 00521 virtual iTextureWrapper* FindTexture (const char* name, 00522 iBase* base = 0) = 0; 00523 00524 CS_DEPRECATED_METHOD_MSG("Regions are deprecated. Use Collections instead.") 00525 virtual iTextureWrapper* FindTextureRegion (const char* name, 00526 iRegion* region) = 0; 00527 00528 virtual iTextureWrapper* FindTextureCollection (const char* name, 00529 iCollection* collection = 0) = 0; 00530 00557 virtual csPtr<iLight> CreateLight (const char* name, const csVector3& pos, 00558 float radius, const csColor& color, 00559 csLightDynamicType dyntype = CS_LIGHT_DYNAMICTYPE_STATIC) = 0; 00560 00565 virtual iLight* FindLight (const char *Name, bool RegionOnly = false) 00566 const = 0; 00567 00572 virtual iLight* FindLightID (const char* light_id) const = 0; 00573 00580 virtual csPtr<iLightIterator> GetLightIterator (iBase* base = 0) = 0; 00581 CS_DEPRECATED_METHOD_MSG("Regions are deprecated. Use Collections instead.") 00582 virtual csPtr<iLightIterator> GetLightIteratorRegion (iRegion* region) = 0; 00583 virtual csPtr<iLightIterator> GetLightIteratorCollection (iCollection* collection = 0) = 0; 00584 00595 virtual void RemoveLight (iLight* light) = 0; 00596 00601 virtual void SetAmbientLight (const csColor &) = 0; 00603 virtual void GetAmbientLight (csColor &) const = 0; 00605 virtual void GetDefaultAmbientLight (csColor &c) const = 0; 00606 00618 virtual int GetNearbyLights (iSector* sector, const csVector3& pos, 00619 iLight** lights, int max_num_lights) = 0; 00620 00632 virtual int GetNearbyLights (iSector* sector, const csBox3& box, 00633 iLight** lights, int max_num_lights) = 0; 00634 00644 virtual iSector *CreateSector (const char *name) = 0; 00645 00647 virtual iSectorList* GetSectors () = 0; 00648 00661 virtual iSector* FindSector (const char* name, 00662 iBase* base = 0) = 0; 00663 CS_DEPRECATED_METHOD_MSG("Regions are deprecated. Use Collections instead.") 00664 virtual iSector* FindSectorRegion (const char* name, 00665 iRegion* region) = 0; 00666 virtual iSector* FindSectorCollection (const char* name, 00667 iCollection* collection = 0) = 0; 00668 00677 virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector, 00678 const csVector3& pos, float radius) = 0; 00679 00688 virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector, 00689 const csBox3& box) = 0; 00690 00695 virtual void AddEngineFrameCallback (iEngineFrameCallback* cb) = 0; 00696 00700 virtual void RemoveEngineFrameCallback (iEngineFrameCallback* cb) = 0; 00701 00706 virtual void AddEngineSectorCallback (iEngineSectorCallback* cb) = 0; 00707 00711 virtual void RemoveEngineSectorCallback (iEngineSectorCallback* cb) = 0; 00712 00731 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshFactoryWrapper* factory, 00732 const char* name, iSector* sector = 0, 00733 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00734 00747 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshObject* meshobj, 00748 const char* name, iSector* sector = 0, 00749 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00750 00770 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* classid, 00771 const char* name, iSector* sector = 0, 00772 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00773 00778 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* name) = 0; 00779 00792 CS_DEPRECATED_METHOD_MSG("Use CS::Geometry::GeneralMeshBuilder instead") 00793 virtual csPtr<iMeshWrapper> CreateSectorWallsMesh (iSector* sector, 00794 const char* name) = 0; 00795 00807 CS_DEPRECATED_METHOD_MSG("Use CS::Geometry::GeneralMeshBuilder instead") 00808 virtual csPtr<iMeshWrapper> CreateThingMesh (iSector* sector, 00809 const char* name) = 0; 00810 00825 virtual csPtr<iMeshWrapper> LoadMeshWrapper ( 00826 const char* name, const char* loaderClassId, 00827 iDataBuffer* input, iSector* sector, const csVector3& pos) = 0; 00828 00833 virtual void AddMeshAndChildren (iMeshWrapper* mesh) = 0; 00834 00841 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00842 const csVector3& pos, float radius, bool crossPortals = true) = 0; 00843 00851 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00852 const csBox3& box, bool crossPortals = true) = 0; 00853 00861 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00862 const csVector3& start, const csVector3& end, 00863 bool crossPortals = true) = 0; 00864 00866 virtual iMeshList* GetMeshes () = 0; 00867 00881 virtual iMeshWrapper* FindMeshObject (const char* name, 00882 iBase* base = 0) = 0; 00883 00884 CS_DEPRECATED_METHOD_MSG("Regions are deprecated. Use Collections instead.") 00885 virtual iMeshWrapper* FindMeshObjectRegion (const char* name, 00886 iRegion* region) = 0; 00887 00888 virtual iMeshWrapper* FindMeshObjectCollection (const char* name, 00889 iCollection* collection = 0) = 0; 00890 00897 virtual void WantToDie (iMeshWrapper* mesh) = 0; 00898 00917 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* classId, 00918 const char* name) = 0; 00919 00927 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory ( 00928 iMeshObjectFactory * factory, const char* name) = 0; 00929 00935 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* name) = 0; 00936 00944 virtual csPtr<iMeshFactoryWrapper> LoadMeshFactory ( 00945 const char* name, const char* loaderClassId, 00946 iDataBuffer* input) = 0; 00947 00960 virtual iMeshFactoryWrapper* FindMeshFactory (const char* name, 00961 iBase* base = 0) = 0; 00962 00963 CS_DEPRECATED_METHOD_MSG("Regions are deprecated. Use Collections instead.") 00964 virtual iMeshFactoryWrapper* FindMeshFactoryRegion (const char* name, 00965 iRegion* region) = 0; 00966 00967 virtual iMeshFactoryWrapper* FindMeshFactoryCollection (const char* name, 00968 iCollection* collection = 0) = 0; 00969 00971 virtual iMeshFactoryList* GetMeshFactories () = 0; 00972 00985 virtual iRegion* CreateRegion (const char* name) = 0; 00987 virtual iRegionList* GetRegions () = 0; 00988 00992 virtual iCollection* CreateCollection(const char* name) = 0; 00993 00994 virtual iCollection* GetCollection(const char* name) const = 0; 00995 00996 virtual csPtr<iCollectionArray> GetCollections() = 0; 00997 00998 virtual void RemoveCollection(iCollection* collect) = 0; 00999 01000 virtual void RemoveCollection(const char* name) = 0; 01001 01002 virtual void RemoveAllCollections() = 0; 01003 01013 virtual csPtr<iCamera> CreateCamera () = 0; 01014 01028 virtual iCameraPosition* FindCameraPosition (const char* name, 01029 iBase* base = 0) = 0; 01030 01031 CS_DEPRECATED_METHOD_MSG("Regions are deprecated. Use Collections instead.") 01032 virtual iCameraPosition* FindCameraPositionRegion (const char* name, 01033 iRegion* region) = 0; 01034 01035 virtual iCameraPosition* FindCameraPositionCollection (const char* name, 01036 iCollection* collection = 0) = 0; 01037 01039 virtual iCameraPositionList* GetCameraPositions () = 0; 01040 01065 virtual csPtr<iMeshWrapper> CreatePortal ( 01066 const char* name, 01067 iMeshWrapper* parentMesh, iSector* destSector, 01068 csVector3* vertices, int num_vertices, 01069 iPortal*& portal) = 0; 01070 01090 virtual csPtr<iMeshWrapper> CreatePortal ( 01091 const char* name, 01092 iSector* sourceSector, const csVector3& pos, 01093 iSector* destSector, 01094 csVector3* vertices, int num_vertices, 01095 iPortal*& portal) = 0; 01096 01110 virtual csPtr<iMeshWrapper> CreatePortalContainer (const char* name, 01111 iSector* sector = 0, const csVector3& pos = csVector3 (0, 0, 0)) = 0; 01112 01130 virtual void SetClearZBuf (bool yesno) = 0; 01131 01135 virtual bool GetClearZBuf () const = 0; 01136 01138 virtual bool GetDefaultClearZBuf () const = 0; 01139 01152 virtual void SetClearScreen (bool yesno) = 0; 01153 01157 virtual bool GetClearScreen () const = 0; 01158 01160 virtual bool GetDefaultClearScreen () const = 0; 01161 01168 virtual int GetBeginDrawFlags () const = 0; 01169 01173 virtual iRenderView* GetTopLevelClipper () const = 0; 01174 01183 virtual void PrecacheDraw (iBase* base = 0) = 0; 01184 virtual void PrecacheDrawCollection (iCollection* collection = 0) = 0; 01185 01194 virtual void PrecacheDrawRegion (iRegion* region) = 0; 01195 01207 virtual void Draw (iCamera* c, iClipper2D* clipper, 01208 iMeshWrapper* mesh = 0) = 0; 01209 01215 virtual void SetContext (iTextureHandle* ctxt) = 0; 01217 virtual iTextureHandle *GetContext () const = 0; 01218 01222 virtual iRenderLoopManager* GetRenderLoopManager () = 0; 01223 01236 virtual iRenderLoop* GetCurrentDefaultRenderloop () = 0; 01237 01244 virtual bool SetCurrentDefaultRenderloop (iRenderLoop* loop) = 0; 01245 01249 virtual uint GetCurrentFrameNumber () const = 0; 01250 01265 virtual void SetSaveableFlag (bool enable) = 0; 01266 01270 virtual bool GetSaveableFlag () = 0; 01271 01280 virtual csPtr<iLoaderContext> CreateLoaderContext ( 01281 iBase* base = 0, bool curRegOnly = true) = 0; 01282 01300 virtual csPtr<iObjectIterator> GetNearbyObjects (iSector* sector, 01301 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 01302 01303 01304 01314 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01315 const csVector3& pos) = 0; 01316 01323 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01324 const csVector3& pos) = 0; 01325 01335 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01336 const csFrustum& frustum) = 0; 01337 01344 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01345 const csFrustum& frustum) = 0; 01346 01353 virtual csPtr<iFrustumView> CreateFrustumView () = 0; 01354 01359 virtual csPtr<iObjectWatcher> CreateObjectWatcher () = 0; 01360 01362 virtual iSharedVariableList* GetVariableList () const = 0; 01363 01379 virtual bool RemoveObject (iBase* object) = 0; 01380 01389 virtual void DelayedRemoveObject (csTicks delay, iBase* object) = 0; 01390 01396 virtual void RemoveDelayedRemoves (bool remove = false) = 0; 01397 01399 virtual void DeleteAll () = 0; 01400 01408 virtual void ResetWorldSpecificSettings() = 0; 01409 01418 virtual void SetDefaultKeepImage (bool enable) = 0; 01419 01424 virtual bool GetDefaultKeepImage () = 0; 01425 01427 }; 01428 01431 #endif // __CS_IENGINE_ENGINE_H__
Generated for Crystal Space 1.4.0 by doxygen 1.5.8