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/light.h" 00036 00037 class csBox3; 00038 class csColor; 00039 class csFrustum; 00040 00041 struct iCacheManager; 00042 struct iCamera; 00043 struct iCameraPosition; 00044 struct iCameraPositionList; 00045 struct iClipper2D; 00046 struct iCollection; 00047 struct iCollectionList; 00048 struct iDataBuffer; 00049 struct iFrustumView; 00050 struct iLight; 00051 struct iLightIterator; 00052 struct iLoaderContext; 00053 struct iMaterial; 00054 struct iMaterialList; 00055 struct iMaterialWrapper; 00056 struct iMeshFactoryList; 00057 struct iMeshFactoryWrapper; 00058 struct iMeshList; 00059 struct iMeshObject; 00060 struct iMeshObjectFactory; 00061 struct iMeshObjectType; 00062 struct iMeshWrapper; 00063 struct iMeshWrapperIterator; 00064 struct iObject; 00065 struct iObjectIterator; 00066 struct iObjectWatcher; 00067 struct iPortal; 00068 struct iProgressMeter; 00069 struct iRegion; 00070 struct iRegionList; 00071 struct iRenderLoop; 00072 struct iRenderLoopManager; 00073 struct iRenderView; 00074 struct iSector; 00075 struct iSectorIterator; 00076 struct iSectorList; 00077 struct iSharedVariableList; 00078 struct iTextureHandle; 00079 struct iTextureList; 00080 struct iTextureWrapper; 00081 00082 struct iEngine; 00083 00089 #define CS_ENGINE_CACHE_READ 1 00090 00094 #define CS_ENGINE_CACHE_WRITE 2 00095 00099 #define CS_ENGINE_CACHE_NOUPDATE 4 00100 00104 enum csRenderPrioritySorting 00105 { 00109 CS_RENDPRI_SORT_NONE = 0, 00110 00114 CS_RENDPRI_SORT_BACK2FRONT = 1, 00115 00119 CS_RENDPRI_SORT_FRONT2BACK = 2 00120 }; 00128 struct iEngineFrameCallback : public virtual iBase 00129 { 00130 SCF_INTERFACE(iEngineFrameCallback,1,0,0); 00134 virtual void StartFrame (iEngine* engine, iRenderView* rview) = 0; 00135 }; 00136 00141 struct iEngineSectorCallback : public virtual iBase 00142 { 00143 SCF_INTERFACE(iEngineSectorCallback,2,0,0); 00147 virtual void NewSector (iEngine* engine, iSector* sector) = 0; 00148 00152 virtual void RemoveSector (iEngine* engine, iSector* sector) = 0; 00153 }; 00154 00155 00170 struct iEngine : public virtual iBase 00171 { 00172 SCF_INTERFACE(iEngine,2,0,0); 00173 00175 virtual iObject *QueryObject() = 0; 00176 00195 virtual bool Prepare (iProgressMeter* meter = 0) = 0; 00196 00204 virtual void PrepareTextures () = 0; 00205 00211 virtual void PrepareMeshes () = 0; 00212 00228 virtual void ForceRelight (iRegion* region = 0, 00229 iProgressMeter* meter = 0) = 0; 00230 00243 virtual void ForceRelight (iLight* light, iRegion* region = 0) = 0; 00244 00255 virtual void ShineLights (iRegion* region = 0, 00256 iProgressMeter* meter = 0) = 0; 00257 00270 virtual void SetLightingCacheMode (int mode) = 0; 00271 00273 virtual int GetLightingCacheMode () = 0; 00274 00287 virtual void SetCacheManager (iCacheManager* cache_mgr) = 0; 00288 00295 virtual void SetVFSCacheManager (const char* vfspath = 0) = 0; 00296 00300 virtual iCacheManager* GetCacheManager () = 0; 00301 00308 virtual void SetMaxLightmapSize (int w, int h) = 0; 00309 00314 virtual void GetMaxLightmapSize (int& w, int& h) = 0; 00315 00320 virtual void GetDefaultMaxLightmapSize (int& w, int& h) = 0; 00321 00323 virtual int GetMaxLightmapAspectRatio () const = 0; 00324 00351 virtual void RegisterRenderPriority (const char* name, long priority, 00352 csRenderPrioritySorting rendsort = CS_RENDPRI_SORT_NONE) = 0; 00353 00361 virtual long GetRenderPriority (const char* name) const = 0; 00363 virtual csRenderPrioritySorting GetRenderPrioritySorting ( 00364 const char* name) const = 0; 00366 virtual csRenderPrioritySorting GetRenderPrioritySorting ( 00367 long priority) const = 0; 00369 virtual long GetSkyRenderPriority () = 0; 00371 virtual long GetPortalRenderPriority () = 0; 00373 virtual long GetWallRenderPriority () = 0; 00375 virtual long GetObjectRenderPriority () = 0; 00377 virtual long GetAlphaRenderPriority () = 0; 00379 virtual void ClearRenderPriorities () = 0; 00381 virtual int GetRenderPriorityCount () const = 0; 00383 virtual const char* GetRenderPriorityName (long priority) const = 0; 00384 00399 virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt) = 0; 00400 00406 virtual iMaterialWrapper* CreateMaterial (const char *name, 00407 iTextureWrapper* texture) = 0; 00408 00410 virtual iMaterialList* GetMaterialList () const = 0; 00411 00424 virtual iMaterialWrapper* FindMaterial (const char* name, 00425 iRegion* region = 0) = 0; 00426 00448 virtual iTextureWrapper* CreateTexture (const char *name, 00449 const char *fileName, csColor *transp, int flags) = 0; 00450 00461 virtual iTextureWrapper* CreateBlackTexture (const char *name, 00462 int w, int h, csColor *transp, int flags) = 0; 00463 00468 virtual int GetTextureFormat () const = 0; 00469 00471 virtual iTextureList* GetTextureList () const = 0; 00472 00485 virtual iTextureWrapper* FindTexture (const char* name, 00486 iRegion* region = 0) = 0; 00487 00514 virtual csPtr<iLight> CreateLight (const char* name, const csVector3& pos, 00515 float radius, const csColor& color, 00516 csLightDynamicType dyntype = CS_LIGHT_DYNAMICTYPE_STATIC) = 0; 00517 00522 virtual iLight* FindLight (const char *Name, bool RegionOnly = false) 00523 const = 0; 00524 00529 virtual iLight* FindLightID (const char* light_id) const = 0; 00530 00537 virtual csPtr<iLightIterator> GetLightIterator (iRegion* region = 0) = 0; 00538 00549 virtual void RemoveLight (iLight* light) = 0; 00550 00555 virtual void SetAmbientLight (const csColor &) = 0; 00557 virtual void GetAmbientLight (csColor &) const = 0; 00559 virtual void GetDefaultAmbientLight (csColor &c) const = 0; 00560 00572 virtual int GetNearbyLights (iSector* sector, const csVector3& pos, 00573 iLight** lights, int max_num_lights) = 0; 00574 00586 virtual int GetNearbyLights (iSector* sector, const csBox3& box, 00587 iLight** lights, int max_num_lights) = 0; 00588 00598 virtual iSector *CreateSector (const char *name) = 0; 00599 00601 virtual iSectorList* GetSectors () = 0; 00602 00615 virtual iSector* FindSector (const char* name, 00616 iRegion* region = 0) = 0; 00617 00623 virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector, 00624 const csVector3& pos, float radius) = 0; 00625 00630 virtual void AddEngineFrameCallback (iEngineFrameCallback* cb) = 0; 00631 00635 virtual void RemoveEngineFrameCallback (iEngineFrameCallback* cb) = 0; 00636 00641 virtual void AddEngineSectorCallback (iEngineSectorCallback* cb) = 0; 00642 00646 virtual void RemoveEngineSectorCallback (iEngineSectorCallback* cb) = 0; 00647 00666 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshFactoryWrapper* factory, 00667 const char* name, iSector* sector = 0, 00668 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00669 00682 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshObject* meshobj, 00683 const char* name, iSector* sector = 0, 00684 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00685 00705 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* classid, 00706 const char* name, iSector* sector = 0, 00707 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00708 00713 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* name) = 0; 00714 00725 virtual csPtr<iMeshWrapper> CreateSectorWallsMesh (iSector* sector, 00726 const char* name) = 0; 00727 00737 virtual csPtr<iMeshWrapper> CreateThingMesh (iSector* sector, 00738 const char* name) = 0; 00739 00754 virtual csPtr<iMeshWrapper> LoadMeshWrapper ( 00755 const char* name, const char* loaderClassId, 00756 iDataBuffer* input, iSector* sector, const csVector3& pos) = 0; 00757 00762 virtual void AddMeshAndChildren (iMeshWrapper* mesh) = 0; 00763 00770 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00771 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 00772 00780 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00781 const csBox3& box, bool crossPortals = true ) = 0; 00782 00784 virtual iMeshList* GetMeshes () = 0; 00785 00798 virtual iMeshWrapper* FindMeshObject (const char* name, 00799 iRegion* region = 0) = 0; 00800 00807 virtual void WantToDie (iMeshWrapper* mesh) = 0; 00808 00827 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* classId, 00828 const char* name) = 0; 00829 00837 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory ( 00838 iMeshObjectFactory * factory, const char* name) = 0; 00839 00845 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* name) = 0; 00846 00854 virtual csPtr<iMeshFactoryWrapper> LoadMeshFactory ( 00855 const char* name, const char* loaderClassId, 00856 iDataBuffer* input) = 0; 00857 00870 virtual iMeshFactoryWrapper* FindMeshFactory (const char* name, 00871 iRegion* region = 0) = 0; 00872 00874 virtual iMeshFactoryList* GetMeshFactories () = 0; 00875 00887 virtual iRegion* CreateRegion (const char* name) = 0; 00889 virtual iRegionList* GetRegions () = 0; 00890 00900 virtual csPtr<iCamera> CreateCamera () = 0; 00901 00914 virtual iCameraPosition* FindCameraPosition (const char* name, 00915 iRegion* region = 0) = 0; 00916 00918 virtual iCameraPositionList* GetCameraPositions () = 0; 00919 00944 virtual csPtr<iMeshWrapper> CreatePortal ( 00945 const char* name, 00946 iMeshWrapper* parentMesh, iSector* destSector, 00947 csVector3* vertices, int num_vertices, 00948 iPortal*& portal) = 0; 00949 00969 virtual csPtr<iMeshWrapper> CreatePortal ( 00970 const char* name, 00971 iSector* sourceSector, const csVector3& pos, 00972 iSector* destSector, 00973 csVector3* vertices, int num_vertices, 00974 iPortal*& portal) = 0; 00975 00989 virtual csPtr<iMeshWrapper> CreatePortalContainer (const char* name, 00990 iSector* sector = 0, const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00991 01009 virtual void SetClearZBuf (bool yesno) = 0; 01010 01014 virtual bool GetClearZBuf () const = 0; 01015 01017 virtual bool GetDefaultClearZBuf () const = 0; 01018 01031 virtual void SetClearScreen (bool yesno) = 0; 01032 01036 virtual bool GetClearScreen () const = 0; 01037 01039 virtual bool GetDefaultClearScreen () const = 0; 01040 01047 virtual int GetBeginDrawFlags () const = 0; 01048 01052 virtual iRenderView* GetTopLevelClipper () const = 0; 01053 01062 virtual void PrecacheDraw (iRegion* region = 0) = 0; 01063 01071 virtual void Draw (iCamera* c, iClipper2D* clipper) = 0; 01072 01078 virtual void SetContext (iTextureHandle* ctxt) = 0; 01080 virtual iTextureHandle *GetContext () const = 0; 01081 01085 virtual iRenderLoopManager* GetRenderLoopManager () = 0; 01086 01099 virtual iRenderLoop* GetCurrentDefaultRenderloop () = 0; 01100 01107 virtual bool SetCurrentDefaultRenderloop (iRenderLoop* loop) = 0; 01108 01112 virtual uint GetCurrentFrameNumber () const = 0; 01113 01128 virtual void SetSaveableFlag (bool enable) = 0; 01129 01133 virtual bool GetSaveableFlag () = 0; 01134 01143 virtual csPtr<iLoaderContext> CreateLoaderContext ( 01144 iRegion* region = 0, bool curRegOnly = true) = 0; 01145 01163 virtual csPtr<iObjectIterator> GetNearbyObjects (iSector* sector, 01164 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 01165 01166 01167 01177 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01178 const csVector3& pos) = 0; 01179 01186 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01187 const csVector3& pos) = 0; 01188 01198 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01199 const csFrustum& frustum) = 0; 01200 01207 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01208 const csFrustum& frustum) = 0; 01209 01216 virtual csPtr<iFrustumView> CreateFrustumView () = 0; 01217 01222 virtual csPtr<iObjectWatcher> CreateObjectWatcher () = 0; 01223 01225 virtual iSharedVariableList* GetVariableList () const = 0; 01226 01228 virtual iCollectionList* GetCollections () = 0; 01229 01242 virtual iCollection* FindCollection (const char* name, 01243 iRegion* region = 0) = 0; 01244 01260 virtual bool RemoveObject (iBase* object) = 0; 01261 01263 virtual void DeleteAll () = 0; 01264 01272 virtual void ResetWorldSpecificSettings() = 0; 01273 01275 }; 01276 01279 #endif // __CS_IENGINE_ENGINE_H__
Generated for Crystal Space by doxygen 1.4.6